How to check if helm template exists?

Viewed 36

I have task, which need to check if template exists as a file. My structure inside common(lib)-chart:

├── Chart.yaml
├── templates
│   ├── _deployment.yaml
│   ├── _configmap.yaml

And then I need to check checksum of configmap. I found that solution, but has trouble, when configmap.yaml doesn't exist as a file.

I found that solution Check if files/dirs/ used in templates exists

I tried:

{{- $configmapexists := .Files.Glob "templates/configmap.yaml" }}

{{- if $configmapexists }}
test: {{ print $configmapexists }}
{{- end }}

And that return for me:

test: map[] 

and it's doesn't work.. So i tried to play with .Template.BasePath, but I didn't get the right solution

{{ include ("mylibchart.configmap") . | sha256sum }} doesnt work for me, because we have configmap outside of lib chart

0 Answers
Related