Last active
August 2, 2018 09:06
-
-
Save stefanooldeman/d9b5f7f55309017f3e27ac06b1146672 to your computer and use it in GitHub Desktop.
my helm chart template functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{/* | |
imagePullPolicy: | |
this function will parse the imageTag with semver | |
imagePullPolicy is determined based of a versions prerelease | |
example usage: | |
``` | |
image: {{ .Values.ImageTag }} | |
{{ include "imagePullPolicy" .Values.ImageTag | indent 8 }} | |
env: ... | |
``` | |
*/}} | |
{{- define "imagePullPolicy" -}} | |
{{ $parsed := replace "_" "+" . | semver -}} | |
# semver prerelease: '{{ print $parsed.Prerelease }}' | |
# semver build metadata: '{{ print $parsed.Metadata }}' | |
{{- if eq $parsed.Prerelease "SNAPSHOT" }} | |
imagePullPolicy: Always | |
{{- else }} | |
imagePullPolicy: IfNotPresent | |
{{- end }} | |
# imagePullPolicy is set by "imagePullPolicy" in _helpers.tpl | |
{{- end -}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment