Move Install phase into Job

This commit is contained in:
paul 2021-01-12 20:54:31 +01:00
parent b14cad0db2
commit 44f8aee7e2
3 changed files with 58 additions and 22 deletions

View file

@ -24,18 +24,6 @@ spec:
{{- end }} {{- end }}
securityContext: securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }} {{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: setup
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ['db-setup.sh']
env:
{{- include "mediawiki.env" . | nindent 12 }}
volumeMounts:
- name: data-volume
mountPath: /var/www/data
- name: localstore-volume
mountPath: /var/www/localstore
containers: containers:
- name: {{ .Chart.Name }}-web - name: {{ .Chart.Name }}-web
securityContext: securityContext:

View file

@ -0,0 +1,46 @@
{{- if and .Values.wiki.install (ne "sqlite" .Values.database.type) }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "mediawiki.fullname" . }}
labels:
{{- include "mediawiki.labels" . | nindent 4 }}
spec:
template:
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: setup
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ['db-setup.sh']
env:
{{- include "mediawiki.env" . | nindent 12 }}
volumeMounts:
- name: data-volume
mountPath: /var/www/data
- name: localstore-volume
mountPath: /var/www/localstore
volumes:
- name: localstore-volume
emptyDir: {}
- name: data-volume
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{ end }}

View file

@ -12,6 +12,8 @@ nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
wiki: wiki:
# Install decides if a job should be started to install the database schema once.
install: false
server: "https://wiki.example.org" server: "https://wiki.example.org"
secretKey: "1166f2af9b8c1e1401f38a11d95628629bef0b75b90d09b296390041d19c3b2c" secretKey: "1166f2af9b8c1e1401f38a11d95628629bef0b75b90d09b296390041d19c3b2c"
@ -33,16 +35,16 @@ podAnnotations: {}
podSecurityContext: podSecurityContext:
fsGroup: 33 # www-data fsGroup: 33 # www-data
securityContext: securityContext: {}
runAsNonRoot: true # runAsNonRoot: true
runAsUser: 33 # www-data # runAsUser: 33 # www-data
allowPrivilegeEscalation: false # allowPrivilegeEscalation: false
capabilities: # capabilities:
drop: # drop:
- all # - all
add: # add:
- NET_BIND_SERVICE # For listening on port 80 # - NET_BIND_SERVICE # For listening on port 80
# readOnlyRootFilesystem: true # # readOnlyRootFilesystem: true
service: service:
type: ClusterIP type: ClusterIP