Demo helm library for templates
⚠️ Warning: Please read this first
Here is a simple example of a library chart based on the official Helm docs. In my opinion, using functions like demo-library.util.merge
may be risky and unnecessary in the long run. Proceed with caution.
For my production solution, I will develop a distinct version of the library, relying on common sense and straightforward templates, avoiding Go template merging or similar techniques.
You need create your oci registry, for example, use quay.io docs
Set your quay.io username and password:
- Go to https://quay.io/repository
- Login
- In the right top corner click at your name
Account Settings
- Click on link:
CLI Password: Generate Encrypted Password
- Input your password
- You get 2 values
Username & Encrypted Password
- Save them and add to your shell envs:
export QUAY_USERNAME=''
export QUAY_PASSWD_ENCRYPTED=''
- Now you can login in your registry
helm registry login -u $QUAY_USERNAME -p $QUAY_PASSWD_ENCRYPTED quay.io
Assuming your chart is in the current directory. This creates an archive with versions specified in Chart.yaml
helm package .
example:
$ helm package .
Successfully packaged chart and saved it to: /path/to/demo-helm-library/demo-library-0.1.2.tgz
# Chart.yaml inside the package has been created with the version from the current Chart.yaml:
$ tar -qxvf demo-library-0.1.2.tgz && cat demo-library/Chart.yaml | grep version
version: 0.1.2
Also, we can set the chart version manually. This may be useful if you will test some features locally.
helm package -u --version 0.1.2 .
example:
$ helm package -u --version 0.1.2 .
Successfully packaged chart and saved it to: /path/to/demo-helm-library/demo-library-0.1.2.tgz
# Chart.yaml inside the package has been created with the bumped version:
$ tar -qxvf demo-library-0.1.2.tgz && cat demo-library/Chart.yaml | grep version
version: 0.1.2
helm push demo-library-0.1.2.tgz oci://quay.io/$QUAY_USERNAME/test-helm
example:
$ helm push demo-library-0.1.2.tgz oci://quay.io/$QUAY_USERNAME/test-helm
Pushed: quay.io/$QUAY_USERNAME/test-helm/demo-library:0.1.2
Digest: sha256:ae96270ed2cc592b52550a289dd82650ee6b39428a4befde721d58c20531aa5c
This helm library is used in my demo chart in another repository.This helm library used in my demo chart in other repo
If you are creating a CI/CD pipeline or doing manual builds, don't forget to delete archives after a successful push in the registry.