Replies: 2 comments 5 replies
-
will check today. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@deblaci Check if this helps. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I have ytt template what generate one microservice k8s objects in a list. It can happen, one microservice has one or more configmap. If it has configmap, configmap will be added with overlay feature, usually these configmaps contains templates.
How can I generate one ultimate ( or one by configmap) checksum annotation from the templated configmaps in pod template of Deployment?
Templated output:
`
apiVersion: v1
items:
...
...
name: nameone
...
name: nametwo
...
`
My idea was to create function what collect all the templated configmap content into a variable then generate a checksum. But I couldn't figure out how I can get the templated content, only the raw.
functions.star: def getConfigMapsContent(data): configMapFilesContent = "" for fileName in [ fileName for fileName in data.list() if fileName.endswith(".yaml") ]: fileContent = data.read(fileName) if "kind: ConfigMap" in fileContent: configMapFilesContent += fileContent end end return configMapFilesContent end
templte.yaml: #@ load("@ytt:data", "data") #@ load("@ytt:sha256", "sha256") #@ load("functions.star", "fc") ... template: metadata: annotations: configMapChecksum: #@ sha256.sum(fc.getConfigMapsContent(data))
Could you please help me how I can fix it? Or suggest new "design" to handle configmap templating and checksum generation?
Beta Was this translation helpful? Give feedback.
All reactions