cloudposse / charts

The "Cloud Posse" Distribution of Kubernetes Applications
https://cloudposse.com/accelerate
Apache License 2.0
158 stars 63 forks source link

Adds ability to use secretKeyRef in env spec #264

Closed asiegman closed 3 years ago

asiegman commented 3 years ago

what

Adds the ability to use the secretKeyRef style of adding environment variables to kubernetes specs.

why

While this is already provided via envFrom in this chart, and the corresponding kubernetes features, envFrom doesn't allow you to specify the target environment variable name in your pods, nor does it allow you to use keys in your secrets that aren't valid environment variable names.

reference

example

Providing this value:

        envFromSecretKeyRef:
          - name: CELERY_BROKER_USERNAME
            secret: example-rabbitmq-default-user
            key: username
          - name: CELERY_BROKER_PASSWORD
            secret: example-rabbitmq-default-user
            key: password

Would add the following to the template:

        env:
          - name: CELERY_BROKER_USERNAME
            valueFrom:
              secretKeyRef:
                name: example-rabbitmq-default-user
                key: username
          - name: CELERY_BROKER_PASSWORD
            valueFrom:
              secretKeyRef:
                name: example-rabbitmq-default-user
                key: password
asiegman commented 3 years ago

It seems the GitHub Actions failure is for an unrelated mysql chart.