oecis-charts/charts/tandoor/templates/deployment.yaml

151 lines
5.4 KiB
YAML
Raw Normal View History

2023-08-27 13:38:38 +00:00
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
2023-11-29 10:47:33 +00:00
emptyDir: {}
2023-08-27 13:38:38 +00:00
- name: nginx-config
configMap:
name: tandoor-nginx-config
{{- if not (empty .Values.extraVolumes ) }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if not (empty .Values.initContainers)}}
2023-08-27 13:38:38 +00:00
initContainers:
{{- toYaml .Values.initContainers | nindent 10}}
2023-08-27 13:38:38 +00:00
{{- 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) }}
2023-08-27 13:38:38 +00:00
command:
{{- toYaml .Values.tandoor.command | nindent 12 }}
2023-08-27 13:38:38 +00:00
{{- end }}
livenessProbe:
httpGet:
path: /
scheme: HTTP
port: 8080
periodSeconds: 15
2024-04-11 17:30:56 +00:00
initialDelaySeconds: 120
2023-08-27 13:38:38 +00:00
readinessProbe:
httpGet:
path: /
scheme: HTTP
port: 8080
periodSeconds: 15
2024-04-11 17:30:56 +00:00
initialDelaySeconds: 120
2023-08-27 13:38:38 +00:00
env:
- name: DB_ENGINE
2023-11-29 10:47:33 +00:00
value: "django.db.backends.postgresql"
2023-08-27 13:38:38 +00:00
- 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"
2023-11-29 10:47:33 +00:00
- name: GUNICORN_MEDIA
value: "0"
2023-08-27 13:38:38 +00:00
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
2023-11-29 10:47:33 +00:00
name: {{ .Values.tandoor.config.postgres.password.secretName }}
key: {{ .Values.tandoor.config.postgres.password.secretKey }}
2023-08-27 13:38:38 +00:00
- name: POSTGRES_DB
value: {{ .Values.tandoor.config.postgres.db }}
- name: SECRET_KEY
valueFrom:
secretKeyRef:
2023-11-29 10:47:33 +00:00
name: {{ .Values.tandoor.config.encryptionKey.secretName }}
key: {{ .Values.tandoor.config.encryptionKey.secretKey }}
2023-08-27 13:38:38 +00:00
{{- 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}}
2023-08-27 13:38:38 +00:00
- 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 }}