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 }}
securityContext:
{{- 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:
- name: {{ .Chart.Name }}-web
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: ""
wiki:
# Install decides if a job should be started to install the database schema once.
install: false
server: "https://wiki.example.org"
secretKey: "1166f2af9b8c1e1401f38a11d95628629bef0b75b90d09b296390041d19c3b2c"
@ -33,16 +35,16 @@ podAnnotations: {}
podSecurityContext:
fsGroup: 33 # www-data
securityContext:
runAsNonRoot: true
runAsUser: 33 # www-data
allowPrivilegeEscalation: false
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE # For listening on port 80
# readOnlyRootFilesystem: true
securityContext: {}
# runAsNonRoot: true
# runAsUser: 33 # www-data
# allowPrivilegeEscalation: false
# capabilities:
# drop:
# - all
# add:
# - NET_BIND_SERVICE # For listening on port 80
# # readOnlyRootFilesystem: true
service:
type: ClusterIP