wordpresskubernetesenvironment-variableskubernetes-helm

Helm chart: Why environment variable defined in values.yml of helm chart not added to generated manifest?


I am trying to add environment variable to my wordpress helm chart. My values.yml file looks like :

#pvc wordpress
persistence:
  enabled: false

#pvc mariadb
mariadb:
  enabled: false 

externalDatabase:
  host: mysql
  port: 3306
  user: benighil@benighil 
  password: "SomePassword"
  database: bitnami_wordpress

extraEnv:
  - name: "WORDPRESS_DATABASE_SSL_CA_FILE" # <== THIS ONE
    value: /tmp/ca-cert

## Additional volume mounts
## Example: Mount CA file
extraVolumeMounts:
  - name: ca-cert
    mountPath: /tmp

## Additional volumes
## Example: Add secret volume
extraVolumes:
 - name: ca-cert
   secret:
     secretName: ca-cert

But i generate a template using the following cmd :

helm template wp azure-marketplace/wordpress -n app --create-namespace -f values.yml > template.yml

and when i search the word : WORDPRESS_DATABASE_SSL_CA_FILE in the file template.yml :

terminal: grep WORDPRESS_DATABASE_SSL_CA_FILE template.yml there is nothing returned !

I would like to know why ?

Thank you in advance!


Solution

  • The correct param is extraEnvVars not extraEnv

    ## @param extraEnvVars Array with extra environment variables to add to the WordPress container
    ## e.g:
    ## extraEnvVars:
    ##   - name: FOO
    ##     value: "bar"
    

    so the values should be

    extraEnvVars:
      - name: "WORDPRESS_DATABASE_SSL_CA_FILE" # <== THIS ONE
        value: /tmp/ca-cert
    

    https://github.com/bitnami/azure-marketplace-charts/blob/master/bitnami/wordpress/values.yaml#L225

    helm template wp azure-marketplace/wordpress -f values.yaml | grep "WORDPRESS_DATABASE_SSL_CA_FILE"