Adds pullSecret option and simplifies image usage (#1765)

Adds a value field to set a Secret to pull the image from an image registry with authentication, in case you need to host the image yourself and your registry has authentication.

To simplify the configuration we set the initContainers to use the same image as the application itself.
This has the following advantages:
- No additional configuration for image and pull Secret in values needed
- The used image is always up-to-date now. No need to maintain an extra alpine image.
- Faster startup times. No extra images have to be pulled.

Signed-off-by: pmarkiewka <philipp.markiewka@cloudogu.com>
This commit is contained in:
pmarkiewka
2021-08-11 08:45:20 +02:00
committed by GitHub
parent 8558572c99
commit 5aae743053
2 changed files with 14 additions and 4 deletions

View File

@@ -45,19 +45,27 @@ spec:
app: {{ include "scm-manager.name" . }}
release: {{ .Release.Name }}
spec:
{{- if .Values.image.pullSecret }}
imagePullSecrets:
- name: {{ .Values.image.pullSecret }}
{{- end }}
initContainers:
- name: volume-permissions
image: alpine:3.8
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: IfNotPresent
command: ['sh', '-c', 'chown 1000:1000 /data']
securityContext:
runAsUser: 0
volumeMounts:
- name: data
mountPath: /data
{{- if .Values.plugins }}
- name: install-plugins
image: alpine:3.8
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: IfNotPresent
command: ['sh', '/scripts/install-plugins.sh']
securityContext:
runAsUser: 0
volumeMounts:
- name: data
mountPath: /data
@@ -113,11 +121,11 @@ spec:
emptyDir: {}
{{- end }}
- name: config
configMap:
configMap:
name: {{ include "scm-manager.fullname" . }}
{{- if .Values.plugins }}
- name: scripts
configMap:
configMap:
name: {{ include "scm-manager.fullname" . }}-scripts
{{- end }}
{{- with .Values.extraVolumes }}

View File

@@ -33,6 +33,8 @@ image:
tag: ${dockerTag}
# image.pullPolicy -- SCM-Manager image pull policy
pullPolicy: IfNotPresent
# image.pullSecret -- Secret with credentials for the image registry
# pullSecret: registry-credentials
# nameOverride -- Override the resource name prefix
nameOverride: ""