Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion charts/common/templates/cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{{- $postgres := .Values.postgres -}}
{{- $secrets := .Values.secrets -}}
{{- $cronjob := .Values.cron -}}
{{- $globalPullPolicy := .Values.imagePullPolicy | default "Always" -}}
{{- if $cronjob.enabled -}}
{{- /* YAML Spec */}}

Expand Down Expand Up @@ -57,7 +58,7 @@ spec:
{{- printf "\n " -}}
- name: {{ .name | default $app }}
image: {{ $image }}
imagePullPolicy: Always
imagePullPolicy: {{ .pullPolicy | default $globalPullPolicy }}
{{- if .command }}
command: {{ .command }}
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion charts/common/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
{{- $maxSurge := .Values.deployment.maxSurge | default "25%" }}
{{- $maxUnavailable := .Values.deployment.maxUnavailable | default "25%" }}
{{- $hpa := .Values.hpa | default dict }}
{{- $globalPullPolicy := .Values.imagePullPolicy | default "Always" }}
{{- if $enabled }}
{{- /* YAML Spec */}}
apiVersion: apps/v1
Expand Down Expand Up @@ -82,7 +83,7 @@ spec:
{{- printf "\n " -}}
- name: {{ .name | default $app }}
image: {{ $image }}
imagePullPolicy: Always
imagePullPolicy: {{ .pullPolicy | default $globalPullPolicy }}
{{- if .command }}
command: {{ .command }}
{{- end }}
Expand Down
26 changes: 25 additions & 1 deletion charts/common/tests/cron_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,28 @@ tests:
asserts:
- equal:
path: spec.jobTemplate.spec.activeDeadlineSeconds
value: 1200
value: 1200
- it: imagePullPolicy defaults to Always
asserts:
- equal:
path: spec.jobTemplate.spec.template.spec.containers[0].imagePullPolicy
value: Always
- it: imagePullPolicy can be overridden globally
set:
imagePullPolicy: Never
asserts:
- equal:
path: spec.jobTemplate.spec.template.spec.containers[0].imagePullPolicy
value: Never
- it: per-container pullPolicy takes precedence over global imagePullPolicy
set:
imagePullPolicy: Never
containers:
- image: img
pullPolicy: IfNotPresent
probes:
enabled: false
asserts:
- equal:
path: spec.jobTemplate.spec.template.spec.containers[0].imagePullPolicy
value: IfNotPresent
35 changes: 35 additions & 0 deletions charts/common/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,41 @@ tests:
- equal:
path: spec.minReadySeconds
value: 10
- it: imagePullPolicy defaults to Always
asserts:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
- it: imagePullPolicy can be overridden globally
set:
imagePullPolicy: Never
asserts:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Never
- it: imagePullPolicy can be overridden per container
set:
containers:
- image: img
pullPolicy: IfNotPresent
probes:
enabled: false
asserts:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: IfNotPresent
- it: per-container pullPolicy takes precedence over global imagePullPolicy
set:
imagePullPolicy: Never
containers:
- image: img
pullPolicy: Always
probes:
enabled: false
asserts:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
- it: can set initContainers
set:
initContainers:
Expand Down
6 changes: 6 additions & 0 deletions charts/common/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ releaseName:
# @default -- `{ app shortname team common:version environment }`
labels: {}

# -- Override image pull policy for all containers. Useful for local cluster testing (kind/k3s) where images are loaded directly. Valid values: Always, IfNotPresent, Never
# @default -- Always
imagePullPolicy:

ingress:
# -- Enable or disable the ingress
enabled: true
Expand Down Expand Up @@ -139,6 +143,8 @@ container:
# -- Name of container
# @default -- .app
name:
# -- Override image pull policy for this container. Overrides the global `imagePullPolicy`. Valid values: Always, IfNotPresent, Never
pullPolicy:
# -- Add labels to your pods
labels: {}
# -- Optionally set the command that will run in the pod. If not set, the entrypoint for the container-image is used (recommended for most Java-apps).
Expand Down