I have defined a parent chart called base-microservice and is available at mycompany.github.com/pages/base-microservice
Structure is as follows :
base-microservice
- templates
- deployment.yaml
- ingress.yaml
- service.yaml
- Chart.yaml
- values.yaml
- index.yaml
- base-microservice-0.1.0.tgz
I would like to define a customapp chart which inherits from the parent chart.
Structure is as follows :
customapp-service
- customapp
- Chart.yaml
- charts
- requirements.yaml
- values.yaml
- src
requirements.yaml is as follows :
dependencies:
- name: base-microservice
repository: https://mycompany.github.com/pages/base-microservice
version: 0.1.0
When I do
helm install --repo https://mycompany.github.com/pages/base-microservice --name customapp --values customapp/values.yaml
It creates and deploys base-microservice instead of customapp.. in other words my Chart.yaml and values.yaml in custom app chart don’t override what was defined in the base one..
Kindly advice how to structure the app ?
You can use a --set flag in your Helm commands to override the value of a setting in the YAML file. Specify the name of the setting and its new value after the --set flag in the Helm command. The --set flag in the above command overrides the value for the <service>. deployment.
In helm, there is a command called helm template . Using the template command you can convert any helm chart to a YAML manifest. The resultant manifest file will have all the default values set in the helm values. yaml.
To perform a helm release upgrade using the CLI, run the following command provided: helm upgrade <release name> <chart directory> -f my-values. yaml using the configuration specified in the customized values. yaml file. After a successful upgrade, the helm will return the following message.
You may want to read the Subcharts and Global Values doc page within Helm's repo. It covers Creating a Subchart, Adding Values and a Template to the Subchart, Overriding Values from a Parent Chart, Global Chart Values, and Sharing Templates with Subcharts. It sounds like you want the example in Overriding Values from a Parent Chart. Note that all values passed from the parent to the subchart are nested below a YAML key by the same name as the subchart. --set
syntax is the same concept, just prefix the key with the subchart name (--set subchartname.subchartkey=myvalue
.
Also, docs.helm.sh has good, consolidated Helm documentation, and the Scope, Dependencies, and Values section of Intro To Charts gives more context to the use case above as well as others.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With