Kubernetes - Set Release.Namespace to dependencies values on values.yaml
While it does not appear that helm, itself, can do that, helmfile can via either its integration with kustomize or with its prepare
hook. I'll show the prepare
hook because it's much shorter
releases:- name: kong-config chart: whatever/kong version: 1.0.0 values: - ./generated-values.yaml hooks: - events: ['prepare'] command: bash args: - -c - | printf 'websso:\n service:\n fullnameOverride: my-helm.{{`{{ .Release.Namespace }}`}}.svc.cluster.local\n' > generated-values.yaml
I solved this executing one additional command outside of my helm chart. As I have a Makefile
file for my project build process where I can run some scripts for the multiple stages of my build. And so I added this command to the deploy stage:
sed -i "s/_RELEASE_NAMESPACE_/$(NAMESPACE)/g" $(MODULE_PATH)/chart/values.yaml
This works for a build workflow in some tool. But when I want to install manually my helm chart somewhere, it can't be done and I need to change manually that value with the server value.