Closed hobbypunk90 closed 10 months ago
Hello @hobbypunk90
I would have thought that extraSecretNamesForEnvFrom would be the best option for this kind of variable, which contains sensitive values? This will pull in a list of secrets, secrets can be added like this:
kubectl --namespace drone create secret generic drone-database-datasource --from-literal= DRONE_DATABASE_DATASOURCE ='postgres://$(username):$(password)@drone-database/$(username)?sslmode=require'
You would then add this to your values yaml:
extraSecretNamesForEnvFrom:
- drone-database-datasource
Would this work for you?
Hey,
that was my first try 😅 And after a bit digging in k8s issues I learned, that this variable interpolation works only in direct env variables, not in env variables from config maps or secrets 🥲 That's why I created this PR 😁
Greets Marcel
@hobbypunk90 can you change the version to 0.7.0
? That will resolve the conflict. Thanks
Anything blocking this? There are some very valid use cases here. One example: secrets generated by another chart/operator that have a different key name and need to be pulled in with a secretRef, such as if using the Percona PostgreSQL Operator, real world e.g.
env:
- name: DRONE_DATABASE_DATASOURCE
valueFrom:
secretKeyRef:
name: gitea-db-pguser-drone
key: pgbouncer-uri
Thanks for your attention here and moving this along!
The option to add direct environment variables is needed to combine env variables. I use it to combine the
DRONE_DATABASE_DATASOURCE
from the managed secret of my postgres operator. It looks like this: