This is a large release with several features and many improvements added including:
- Enhancement of the Kubernetes search for
kube_capture
andkube_get
- Script function
run_local
now always return a result, even on error, to avoid halting script execution. - Introduction of the new script function
log
to print timed messages - Script configuration function
kube_config
now supports cluster context name - Introduction of script module load when executing script using the exec package
run_local
update
Before this release, a call to run_local
with an error would cause the entire script to stop and exit in an error. With this release, when a run_local
encounters an error, the error string is returned to the script, allowing for further handling.
log
function
This new script function prints a message, along with an optional prefix, as part of the script execution:
log(prefix="Info", msg="Hello World!")
kube_config
cluster context
This long-awaited update makes it possible for scripts that use Kubernetes-releated functions (kube_capture
, kube_get
) to use specify the cluster's context name to use to connect to the server.
kube_config(path="/path/to/kubeconfig", cluster_context="my-cluster")
Preloading script modules
This new feature is for people using the Crashd-Diagnostics packages to run their own script. With this addition, a script can be launched by passing both the script and a set of other library scripts which are pre-loaded before the actual script.
func main() {
lib := `
def multiply(x, y):
return x*y
`
src := `log(msg="{} * {} = {}".format(3,5, multiply(3,5)))`
exec.ExecuteWithModules("test", strings.NewReader(src), StarlarkModule{Name:"multiply", Srouce:strings.NewReader(lib)})
}
Changelog
65f2d6f Support for script module preloading
a31dd61 Support for cluster context name in kube_config function (#122)
7a31101 Implement starlark log script function
d004762 Modify run_local to return error (#197)
a89ee34 Enhance Kubernetes search and avoid overwriting captured object logs
0f7b22c Extend the timeout for linter
2299d20 Bump up k8s libraries This commit bumps up the k8s libraries to enforce the use of a newer version of github.com/gogo/protobuf.