From b06b3edf1dcb2174870cbe297ff7ed6dc04a02f5 Mon Sep 17 00:00:00 2001 From: justusbunsi Date: Fri, 22 Apr 2022 06:13:19 +0800 Subject: [PATCH] Consider imagePullPolicy for init containers (#317) The default behaviour for container image pulls depend on different values such as image tag usage and its value. See https://kubernetes.io/docs/concepts/containers/images/#imagepullpolicy-defaulting It leads to an unintended behaviour for this Helm Chart. Kubernetes will always pull the image for init containers when using the `latest` Gitea image tag, even if `Values.image.pullPolicy` defines a different value for the runtime container. Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/317 Reviewed-by: techknowlogick Reviewed-by: Gusted Co-authored-by: justusbunsi Co-committed-by: justusbunsi --- templates/gitea/statefulset.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/gitea/statefulset.yaml b/templates/gitea/statefulset.yaml index 8ae7bd6..7dbe417 100644 --- a/templates/gitea/statefulset.yaml +++ b/templates/gitea/statefulset.yaml @@ -48,6 +48,7 @@ spec: initContainers: - name: init-directories image: "{{ include "gitea.image" . }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} command: ["/usr/sbin/init_directory_structure.sh"] env: - name: GITEA_APP_INI @@ -78,6 +79,7 @@ spec: {{- toYaml .Values.containerSecurityContext | nindent 12 }} - name: init-app-ini image: "{{ include "gitea.image" . }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} command: ["/usr/sbin/config_environment.sh"] env: - name: GITEA_APP_INI @@ -118,6 +120,7 @@ spec: - name: configure-gitea image: "{{ include "gitea.image" . }}" command: ["/usr/sbin/configure_gitea.sh"] + imagePullPolicy: {{ .Values.image.pullPolicy }} securityContext: {{- /* By default this container runs as user 1000 unless otherwise stated */ -}} {{- $csc := deepCopy .Values.containerSecurityContext -}}