I have a secret created as an environment variable in k8s cluster.
Secret name: user-list
Below is what's inside of user-list:
USER_1: 10 bytes
With my limited knowledge on k8s, it looks like I can pull the values of USER_1 into values.yaml this way:
env:
- name: SECRET_USERNAME_1
valueFrom:
secretKeyRef:
name: user-list
key: USER_1
My question is:
Is it possible to get USER_1 value into configmap.yaml ?
My configmap looks like below:
apiVersion: v1
kind: ConfigMap
metadata:
name: user-test
data:
user.properties: |
connector.name: {{ USER_1 }} ---> I want to be able to pull USER_1 value here
postgresql.array-mapping=AS_JSON
decimal-default-scale=20
decimal-mapping=ALLOW_OVERFLOW
decimal-rounding-mode=HALF_DOWN
Kind of. You can't pull values per se but you can can grab data via the lookup
function. However this is a very slippery slope to unmaintainable code.
More likely what you want is the ConfigMapSecrets operator which allows basic runtime templating using CM and Secret data.