oecis-charts/charts/tandoor/templates/deployment.yaml
2023-12-01 12:32:25 +01:00

149 lines
5.3 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "tandoor.fullname" . }}
labels:
{{- include "tandoor.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "tandoor.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "tandoor.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "tandoor.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
- name: mediafiles
persistentVolumeClaim:
{{- if not .Values.persistence.mediafiles.existingClaim }}
claimName: {{ .Values.persistence.mediafiles.name }}
{{- else }}
claimName: {{ .Values.persistence.mediafiles.existingClaim }}
{{- end }}
- name: staticfiles
emptyDir: {}
- name: nginx-config
configMap:
name: tandoor-nginx-config
{{- if not (empty .Values.extraVolumes ) }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if not (empty .Values.initContainers)}}
initContainers:
{{- toYaml .Values.initContainers | nindent 10}}
{{- end }}
containers:
- name: {{ include "tandoor.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.tandoor.image.repository }}:{{ .Values.tandoor.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.tandoor.image.pullPolicy }}
{{- if not (empty .Values.tandoor.command) }}
command:
{{- toYaml .Values.tandoor.command | nindent 12 }}
{{- end }}
livenessProbe:
httpGet:
path: /
scheme: HTTP
port: 8080
periodSeconds: 15
readinessProbe:
httpGet:
path: /
scheme: HTTP
port: 8080
periodSeconds: 15
env:
- name: DB_ENGINE
value: "django.db.backends.postgresql"
- name: POSTGRES_HOST
value: {{ .Values.tandoor.config.postgres.host | quote }}
- name: POSTGRES_PORT
value: {{ .Values.tandoor.config.postgres.port | quote }}
- name: POSTGRES_USER
value: {{ .Values.tandoor.config.postgres.user | quote }}
- name: TANDOOR_PORT
value: "8080"
- name: GUNICORN_WORKERS
value: "2"
- name: GUNICORN_THREADS
value: "2"
- name: GUNICORN_MEDIA
value: "0"
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.tandoor.config.postgres.password.secretName }}
key: {{ .Values.tandoor.config.postgres.password.secretKey }}
- name: POSTGRES_DB
value: {{ .Values.tandoor.config.postgres.db }}
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.tandoor.config.encryptionKey.secretName }}
key: {{ .Values.tandoor.config.encryptionKey.secretKey }}
{{- if not (empty .Values.tandoor.extraEnv) }}
{{- toYaml .Values.tandoor.extraEnv | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.tandoor.resources | nindent 12 }}
volumeMounts:
- mountPath: /opt/recipes/mediafiles
name: mediafiles
- mountPath: /opt/recipes/staticfiles
name: staticfiles
{{- if not (empty .Values.tandoor.extraVolumeMounts) }}
{{- toYaml .Values.tandoor.extraVolumeMounts | nindent 12 }}
{{- end}}
- name: {{ include "tandoor.fullname" . }}-nginx
image: {{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}
imagePullPolicy: {{ .Values.nginx.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.nginx.port }}
protocol: TCP
name: http
- containerPort: {{ .Values.service.gunicorn.port }}
protocol: TCP
name: gunicorn
resources:
{{- toYaml .Values.nginx.resources | nindent 12 }}
volumeMounts:
- mountPath: /media
name: mediafiles
readOnly: true
- mountPath: /static
name: staticfiles
readOnly: true
- mountPath: /etc/nginx/nginx.conf
name: nginx-config
readOnly: true
subPath: nginx-config
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}