-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
I have a JSON string in a ConfigMap using an ExternalSecret to template in some secrets. All entirely normal.
---
apiVersion: v1
kind: ConfigMap
metadata:
name: configjson-eso-template
data:
configjson.json:
"{\"secret\": \"{{ .clientSecret }}\"}"
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: configjson-config
spec:
refreshInterval: 1m
secretStoreRef:
kind: ClusterSecretStore
name: secretstore
target:
name: configjson-config
template:
engineVersion: v2
templateFrom:
- target: Data
configMap:
name: configjson-eso-template
items:
- key: configjson.json
templateAs: Values
data:
- remoteRef:
key: 'client1-clientSecret'
secretKey: clientSecret
I now need to have another element in the JSON that needs to be the literal string '{{otherValue}}'.
No amount of weird extra quoting or escaping is letting me get that past ESO. I either get some sort of parsing failure, unexpected characters, or an invalid string in the resulting secret.
Using three, instead of two, curly braces results in: unexpected "{" in command.
A single backslash on all four curly braces is illegal for kubernetes.
Two backslashes on all four curly braces is legal, and passes ESO, but the resulting string is \{\{otherValue\}\} which isn't legal to the container parsing the JSON.
'{{'otherValue'}}', and not trying to escape otherValue, just results in ESO trying to go-template it, which obviously fails because ESO can't do that.
How do I make ESO ignore something in mustaches?