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 Contributors GitHub last commit GitHub license

Kustohelmize allows you to 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   Command to split Kubernetes YAML (default "kubernetes-split-yaml")
  -p, --starter string                         The name or absolute path to Helm starter scaffold
  -s, --suppress-namespace                     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

Working with kustomize

Suppose you have a project created by Operator SDK. 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 -

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

We can slightly modify 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

This will create a Helm chart with default configurations. The directory structure will look like this:

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

A complete example from scratch can be found in the examples directory.

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

Contributors 4

  •  
  •  
  •  
  •