deployment.yaml 2.69 KB
Newer Older
Evili del Rio's avatar
Evili del Rio committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "django.fullname" . }}
  labels:
    {{- include "django.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "django.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "django.selectorLabels" . | nindent 8 }}
    spec:
    {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      serviceAccountName: {{ include "django.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
Evili del Rio's avatar
Evili del Rio committed
30 31 32 33 34 35
          env:
          - name: POSTGRES_PASSWORD
            valueFrom:
              secretKeyRef:
                name: {{ .Release.Name }}-postgresql
                key: postgresql-password
36
          envFrom:
Evili del Rio's avatar
Evili del Rio committed
37
            - configMapRef:
Evili del Rio's avatar
Evili del Rio committed
38
                name: {{ .Release.Name }}-django-config
Evili del Rio's avatar
Evili del Rio committed
39
            - configMapRef:
Evili del Rio's avatar
Evili del Rio committed
40
                name: {{ .Release.Name }}-postgres-config
Evili del Rio's avatar
Evili del Rio committed
41
            - secretRef:
Evili del Rio's avatar
Evili del Rio committed
42
                name: {{ .Release.Name }}-django-secret-key
Evili del Rio's avatar
Evili del Rio committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56
          ports:
            - name: gunicorn
              containerPort: 5000
              protocol: TCP
          volumeMounts:
            - mountPath: /static
              name: django-files
              subPath: static
            - mountPath: /media
              name: django-files
              subPath: media
          livenessProbe:
            httpGet:
              path: /health_checks
Evili del Rio's avatar
Evili del Rio committed
57
              port: gunicorn
Evili del Rio's avatar
Evili del Rio committed
58 59 60 61 62 63
            initialDelaySeconds: 30
            periodSeconds: 10
            timeoutSeconds: 5
          readinessProbe:
            httpGet:
              path: /health_checks
Evili del Rio's avatar
Evili del Rio committed
64
              port: gunicorn
Evili del Rio's avatar
Evili del Rio committed
65 66 67 68 69 70 71
            initialDelaySeconds: 30
            periodSeconds: 10
            timeoutSeconds: 5
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      volumes:
        - name: django-files
Evili del Rio's avatar
Evili del Rio committed
72
{{- if .Values.persistence.enabled }}
Evili del Rio's avatar
Evili del Rio committed
73
          persistentVolumeClaim:
Evili del Rio's avatar
Evili del Rio committed
74 75 76 77
            claimName: {{ include "django.claimName" . }}
{{- else }}
          emptyDir: {}
{{- end }}
Evili del Rio's avatar
Evili del Rio committed
78 79 80 81 82 83 84 85 86 87 88 89
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
    {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
    {{- end }}