I am actually working on a development environment using Gradle, Docker, Minikube and Helm.
I am using a bunch of bash scripts to get things done.
What I achieved so far is:
Now I need to be able to propagate the version calculated by Gradle to Helm so it can pick the right docker image.
The approach I already have in mind is to define an environment variable so it can be used by Helm.
The problem is that I would need to redefine it afterward.
Is any better way of doing that?
The $_ is used to suppress undesired output as "set" returns the new dictionary. The above returns: - name: mongod-none. Any values added to the dictionary will live beyond the call. If you want to avoid polluting an existing dictionary you can force a deep copy with: {{- $d := merge (dict) . -}}
{{- (with the dash and space added) indicates that whitespace should be chomped left, while -}} means whitespace to the right should be consumed.
All Helm packed applications have an associated values. yaml file which dictates the configuration of an application. By design many applications ship with a default values. yaml file that is tuned for production deployments which quite often impacts the viability of a prototype or trial deployment.
Most Helm charts contain at least the following in their values.yaml
file, which sets a default docker image tag, and also allows the user installing/upgrading the chart to specify a different image without having to modify the chart itself.
# values.yaml
image:
repository: <docker-repo-url-here>
tag: <docker-image-tag-here>
And in the deployment yaml, fetch the values from the values.yaml
# deployment.yaml
kind: Deployment
spec:
template:
spec:
containers:
- name: container-name
image: "{{ .Values.image.repository }}:{{ .Values.image.tag}}"
From there, you can do a simple helm upgrade <release-name> <chart-path> --set image.tag=<new-image-tag>
when you want to use a new image.
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