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 persistentVolumeClaim: {{- if not .Values.persistence.staticfiles.existingClaim }} claimName: {{ .Values.persistence.staticfiles.name }} {{- else }} claimName: {{ .Values.persistence.staticfiles.existingClaim }} {{- end }} - name: nginx-config configMap: name: tandoor-nginx-config {{- if .Values.oauth2InitContainer.enabled }} - name: env emptyDir: medium: Memory initContainers: - name: {{ include "tandoor.fullname" . }}-oidc-env-populator image: busybox volumeMounts: - mountPath: /env name: env command: ["/bin/sh"] args: ["-c", {{ quote (printf "echo 'export SOCIALACCOUNT_PROVIDERS=%q' > /env/oauth2_config" ( .Values.oauth2InitContainer.config | toJson )) }}] {{- if not (empty .Values.oauth2InitContainer.env) }} env: {{- toYaml .Values.oauth2InitContainer.env | nindent 12 }} {{- end}} {{- 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 .Values.oauth2InitContainer.enabled }} command: - sh - -c - | set -e echo "Loading oauth2 config from /env/oauth2_config" source /env/oauth2_config echo "Starting 'recipes'" /opt/recipes/boot.sh {{- 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_psycopg2 - 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: POSTGRES_PASSWORD {{- if not .Values.tandoor.config.secretKeys.postgresUserPasswordKey }} value: {{ .Values.tandoor.config.postgres.password | quote }} {{- else }} valueFrom: secretKeyRef: name: {{ .Values.tandoor.config.existingSecret }} key: {{ .Values.tandoor.config.secretKeys.postgresUserPasswordKey }} {{- end }} - name: POSTGRES_DB value: {{ .Values.tandoor.config.postgres.db }} - name: SECRET_KEY {{- if not .Values.tandoor.config.secretKeys.encryptionSecretKey }} value: {{ .Values.tandoor.config.encryptionSecret }} {{- else }} valueFrom: secretKeyRef: name: {{ .Values.tandoor.config.existingSecret }} key: {{ .Values.tandoor.config.secretKeys.encryptionSecretKey }} {{- end}} {{- 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 .Values.oauth2InitContainer.enabled }} - mountPath: /env name: env {{- 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 }}