Skip to content

Tired of creating Helm Charts from scratch? Try Kustohelmize today!

License

Notifications You must be signed in to change notification settings

yeahdongcn/kustohelmize

Repository files navigation

Kustohelmize

Go Report Card GitHub last commit (branch) GitHub

Kustohelmize lets you easily create a Helm Chart from a kustomized YAML file.

CLI

kustohelmize

❯ ./kustohelmize
Automate Helm chart creation from any existing Kubernetes manifests

Usage:
  kustohelmize [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  create      Create a chart from a given YAML file
  help        Help about any command
  version     print the client version information

Flags:
  -h, --help   help for kustohelmize

Use "kustohelmize [command] --help" for more information about a command.

kustohelmize create

❯ ./kustohelmize create --help
Create a new Helm chart

Usage:
  kustohelmize create NAME [flags]

Flags:
  -a, --app-version string                     The version of the application enclosed inside of this chart
  -d, --description string                     A one-sentence description of the chart
  -f, --from string                            The path to a kustomized YAML file
  -h, --help                                   help for create
  -k, --kubernetes-split-yaml-command string   kubernetes-split-yaml command (path to executable) (default "kubernetes-split-yaml")
  -p, --starter string                         the name or absolute path to Helm starter scaffold
  -s, --suppress-namespace                     Whether to suppress creation of namespace resource, which Kustomize will emit. RBAC bindings for SAs will be to {{ .Release.Namespace }}
  -v, --version string                         A SemVer 2 conformant version string of the chart

User scenario

Work with kustomize.

Say you have a project created by Operator SDK and the Makefile should look like this:

.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
    cd config/manager && $(KUSTOMIZE) edit set image controller=${IMAGE}
    $(KUSTOMIZE) build config/default | kubectl apply -f -

make deploy will create the YAML file with kustomize and deploy it into the cluster. This might be good enough during development, but may not very helpful for end-users.

We can slightly duplicate the target and update it like this:

.PHONY: helm
helm: manifests kustomize kustohelmize
    cd config/manager && $(KUSTOMIZE) edit set image controller=${IMAGE}
    $(KUSTOMIZE) build config/default --output config/production.yaml
    $(KUSTOHELMIZE) --from=config/production.yaml create mychart

Then a Helm chart with default configurations will be created for you. The directory hierarchy will look like this:

.
├── mychart
├── mychart-generated
└── mychart.config

The full example from scratch can be found at examples.

Note that you can use this tool in an ad-hoc manner against any YAML file containing multiple resources to generate a helm chart skeleton simply by pointing --from at that file.

Community

About

Tired of creating Helm Charts from scratch? Try Kustohelmize today!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published