github vmware-tanzu/crash-diagnostics v0.3.0

latest releases: v0.3.10, v0.3.9, v0.3.8...
3 years ago

v0.3.0

This version introduces a new direction for the project. Instead of continuing with a Dockerfile-like configuration language, this version has been completely redesigned to adopt Starlark, a Python-like language, as the configuration language to write Crashd scripts. There are many other important new features introduced in this version:

  • Use Starlark to create simple or complex scripts to automate interaction with Kubernetes cluster
  • Use Python-like constructs and functions to create scripts to query or capture infrastructure information
  • Support for provider model that allows interaction with a growing list of infrastructure providers including local KinD clusters, plain Kubernetes clusters, and Cluster-API based clusters
  • Ability to automatically enumerate nodes and execute commands on those nodes to capture
  • Easily query and capture object and other cluster information from Kubernetes API server
  • Adoption of the shortened named crashd for the referring to the project and the built binary.
  • Update go directive in the go.mod file to version 1.15.

The Crashd Script

This release introduces the use of Starlark as the language to create scripts to interact with the Kubernetes cluster. For instance, the following script shows how to use the kube_nodes_provider which uses the Kubernetes Nodes objects to enumerate and discover compute resources that are part of the cluster. Then (assuming ability to securely SSH to the node) the script executes a simple command on each node and retrieves and prints the result:

# setup and configuration
ssh=ssh_config(
    username=os.username,
    private_key_path=args.ssh_pk_path,
    port=args.ssh_port,
    max_retries=50,
)

hosts=resources(
    provider=kube_nodes_provider(
        kube_config=kube_config(path=args.kubecfg),
        ssh_config=ssh,
    ),
)

# commands to run on each host
uptimes = run(cmd="uptime", resources=hosts)

# result for resource 0 (localhost)
print(uptimes.result)

Explore more example scripts here.

Script Elements Available

Release 0.3.0 comes with many built-in functions and other types to help you create functioning and useful scripts. Each built-in function falls in to one the following category:

Configuration functions

  • crashd_config()
  • kube_config()
  • ssh_config()

Provider functions

  • capa_provider()
  • capv_provider()
  • host_list_provider()
  • kube_nodes_provider()
  • resources()

Command functions

  • archive()
  • capture()
  • capture_local()
  • copy_from()
  • run()
  • run_local()

Kubernetes functions

  • kube_capture()
  • kube_get()

See the complete list of script elements here

Known Issues

N/A

Changelog

6a8c896 Adds docs for --args-file and use-ssh-agent
689a4fe Adds .crashd directory when running the program
ec0d453 Adds support for passphrase protected ssh key
ecafae3 Adds args-file flag to run command
bf00df2 updates the args flag example
da64801 Refactor e2e test framework
985a657 Changes ssh command string for proxy args
c342713 Updates extensions for the example scripts
7384add Updates the CLI name to crashd
2501def Includes a new provider for CAPA managed objects
cf42fe3 Replaces named flag with positional argument
6118ba0 Reference documentation update
9ec5022 Fixes the function name for kube functions
dc5b5cc Adds the set_as_default directive
1013294 Adds meaningful constructor name to starlark structs
7bfa1a0 New provider for CAPV resource enumeration
a2d6299 Multiple Example Starlark Scripts
4afbef5 Implementation of the archive function
427eece Adds kube_nodes_provider starlark built-in
f108963 Implementation of the capture_local() Starlark function
a46c358 Implementation of the Starlark run_local() function
d17fad8 Implementation of starlark copy_from() function
0f489be Adds kube_get starlark built-in
6257c24 Implementation of the capture() starlark function.
12be3fc Implementation of kube_capture starlark function
ac2a419 Adds kube_config built-in
1dda5e6 Implementation of run starlark function
daf30cb Implemenation of host_list_provider function.
90209bf Starlark - Base implementation to support configuration

Known Issues

  • Running crashd without the --args-file flag and the default args file fails to run [#176]

Don't miss a new crash-diagnostics release

NewReleases is sending notifications on new releases.