helm/templates/deployment.yml

86 lines
2.7 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mediawiki.fullname" . }}
labels:
{{- include "mediawiki.labels" . | nindent 4 }}
app.kubernetes.io/component: mediawiki
spec:
selector:
matchLabels:
{{- include "mediawiki.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: mediawiki
replicas: {{ .Values.replicas | default 1 }}
strategy:
{{- toYaml .Values.strategy | nindent 4 }}
template:
metadata:
annotations:
{{- with .Values.annotations }}
{{ . | toYaml | nindent 8 }}
{{- end }}
labels:
{{- include "mediawiki.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: mediawiki
{{- with .Values.labels }}
{{ . | toYaml | nindent 8 }}
{{- end }}
spec:
{{- include "mediawiki.imagePullSecrets" . | nindent 6 }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: mediawiki-container
image: "{{ .Values.image.repository }}:{{ include "mediawiki.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
- name: config
mountPath: "/var/www/html/"
readOnly: true
- mountPath: /var/www/html/images
name: image-volume
{{- with .Values.extraVolumeMounts }}
{{- . | toYaml | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
ports:
- containerPort: 80
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "sleep 210 && /usr/local/bin/php /var/www/html/maintenance/rebuildFileCache.php --overwrite"]
volumes:
- name: config
configMap:
name: {{ include "mediawiki.fullname" . }}
items:
- key: "robots.txt"
path: "robots.txt"
{{- if .Values.persistence.enabled }}
- name: image-volume
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "mediawiki.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.extraVolumes }}
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}