I have an ExternalSecret
definition pulling secrets from Azure key vault.
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
name: my-es
spec:
dataFrom:
- find:
... copy some values over
secretStoreRef:
kind: SecretStore
name: my-special-store <-- This is the name I want to pull from my config map
The thing is that the above store is the same across all my environments apart from the secretStoreRef.Name
. Hence I have to redefine an ExternalSecret in each environment. Not the whole thing but I do have to override the name.
Each environment already has a config map. Is there no way to add the name in the ConfigMap
and somehow reference it from withing in the ExternalSecret defintion?
apiVersion: v1
kind: ConfigMap
metadata:
name: my-cm
data:
val: value1
my_special_secret_store_name: my-special-store <-- Can I not define my secret store name here and use it in the ExternalSecret
I know there is a way of using yq
but I do not have yq
available and all kustomise configs in one file separated by ---
per environment aka i do not have a configmap.yaml.
$(cat configmap.yaml | yq eval '.data.myVaultName' -)
Is there a way to pull the name from the configMap?
You can patch the resource using kustomize. Given an input of:
If you use the following
kustomization.yaml
:The output of
kustomize build
will be: