It is a Kubernetes Best Practice to not override defaults, including imagePullPolicy. Using helm create ... to create a sample chart, the generated sample is explicitly setting the imagePullPolicy, making it appear as if it is a Best Practice to do such a thing.
I would like to note that imagePullPolicy has a dynamic default in Kubernetes -- the default is different depending on the docker image tag being used (tag omitted, or set to :latest the default is Always, otherwise it defaults to IfNotPresent).
The sample chart (from "helm create ...") should not explicitly override the imagePullPolicy, but it should allow someone to override the default Kubernetes behavior.
I would suggest the values.yaml to have something like this (see where I commented out the pullPolicy):
image:
repository: nginx
# pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
and the deployment.yaml to have:
{{ if .Values.image.pullPolicy }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{ end }}
With these changes, the default/sample helm chart is more closely aligned with Kubernetes' inbuilt defaults and best practices:
Don't specify default values unnecessarily: simple, minimal configuration will make errors less likely.
Output of helm version: same behavior in helm2 and helm3
Output of kubectl version: na
Cloud Provider/Platform (AKS, GKE, Minikube etc.): na
It is a Kubernetes Best Practice to not override defaults, including
imagePullPolicy. Usinghelm create ...to create a sample chart, the generated sample is explicitly setting theimagePullPolicy, making it appear as if it is a Best Practice to do such a thing.I would like to note that
imagePullPolicyhas a dynamic default in Kubernetes -- the default is different depending on the docker image tag being used (tag omitted, or set to:latestthe default isAlways, otherwise it defaults toIfNotPresent).The sample chart (from "helm create ...") should not explicitly override the imagePullPolicy, but it should allow someone to override the default Kubernetes behavior.
I would suggest the
values.yamlto have something like this (see where I commented out thepullPolicy):and the
deployment.yamlto have:With these changes, the default/sample helm chart is more closely aligned with Kubernetes' inbuilt defaults and best practices:
Output of
helm version: same behavior in helm2 and helm3Output of
kubectl version: naCloud Provider/Platform (AKS, GKE, Minikube etc.): na