HelmBurger
HelmBurger

Reputation: 1298

data node empty in Configmap on helm install

These are my helm charts:

# helm/templates/configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-configmap
data:
  mycfgmap: |-
{{ .Files.Get (printf "environments/configmap.%s\n.yaml" .Values.namespace) | indent 4 }}

# helm/environments/values.dev.yaml

namespace: dev
# helm/environments/configmap.dev.yaml

MY_ENV_VARIABLE_1: "true"

This is how I am installing my helm charts:

helm install --dry-run --debug --create-namespace -n dev -f helm/environments/values.dev.yaml my-test-release helm

This is the output I am getting:

# Source: helm/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-configmap
data:
  mycfgmap: |-
---

I am expecting this to be in the data node (as defined in my configmap.dev.yaml):

MY_ENV_VARIABLE_1: "true"

Please note that I have alredy tried these for helm/templates/config.yaml:

{{ .Files.Get (printf "../environments/configmap.%s\n.yaml" .Values.namespace) | indent 4 }}

# and

{{ .Files.Get (printf "environments/configmap.%s.yaml" .Values.namespace) | indent 4 }}

and it doesn't work. I have also looked at similar questions answered on SO, but my problem seem to be something else.

Upvotes: 1

Views: 490

Answers (1)

SV Madhava Reddy
SV Madhava Reddy

Reputation: 2018

I can see from your message that the file you have used for configmap yaml is # helm/environments/config.dev.yaml. Please rename it to configmap.dev.yml. And change your printf statement like below. Once you make these changes, things should work fine.

{{ .Files.Get (printf "environments/configmap.%s.yaml" .Values.namespace) | indent 4 }}

Upvotes: 1

Related Questions