kubestar
is an experimental tool for converting between YAML and
skycfg-based starlark. It's meant to
complement the starlark-related functionality in kubeapply
.
Run the following:
GO111MODULE="on" go get github.com/segmentio/kubeapply/cmd/kubestar
The kubestar
binary will be placed in $GOPATH/bin
.
The star2yaml
subcommand evaluates a starlark entrypoint (i.e., of the form
def main(ctx):
) and outputs the associated Kubernetes YAML to stdout
.
Note that this conversion is already supported in kubeapply expand
, so this
subcommand shouldn't be needed if you're already using the former.
kubestar star2yaml [star path] [flags]
Flags:
--cluster-config string Path to a kubeapply-formatted YAML cluster config; used to set vars in
ctx object (optional)
-h, --help help for star2yaml
--vars string Extra JSON-formatted vars to insert in ctx object (optional)
Global Flags:
-d, --debug Enable debug logging
Run the following from the repo root:
kubestar star2yaml pkg/star/expand/testdata/app.star \
--vars '{"key":"value"}'
Any proto: tag has too few fields: "-"
errors are expected and shouldn't
affect the conversion process.
The yaml2star
subcommand converts one or more YAML-formatted Kubernetes
manifests to a skycfg-compatible starlark file. This file can be either
a top-level entrypoint, i.e. with def main(ctx):
, or a non-top-level
function that's called from elsewhere.
kubestar yaml2star [YAML configs] [flags]
Flags:
--args stringArray List of arguments to add to custom (non-main) entrypoint, in key=value format
--entrypoint string Name of entrypoint (default "main")
-h, --help help for yaml2star
Global Flags:
-d, --debug Enable debug logging
The arg values will be used as the default values in the entrypoint. Also, if the values are found in the body of the YAML, they'll be substituted with the variable name.
Run the following from the repo root:
kubestar yaml2star pkg/star/convert/testdata/deployment.yaml \
--args 'name=special-config' \
--entrypoint=my_deployment