apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "django.fullname" . }}-web labels: {{- include "django.labels" . | nindent 4 }} app.kubernetes.io/component: web spec: {{- if not .Values.web.autoscaling.enabled }} replicas: {{ .Values.web.replicaCount }} {{- end }} selector: matchLabels: {{- include "django.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: web template: metadata: annotations: checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} tag: "{{ .Values.image.tag }}" labels: {{- include "django.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: web 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 }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http containerPort: 8080 protocol: TCP livenessProbe: failureThreshold: {{ .Values.web.livenessProbe.failureThreshold }} httpGet: path: /_health/ port: 8080 initialDelaySeconds: {{ .Values.web.livenessProbe.initialDelaySeconds }} timeoutSeconds: {{ .Values.web.livenessProbe.timeoutSeconds }} readinessProbe: failureThreshold: {{ .Values.web.readinessProbe.failureThreshold }} httpGet: path: /_health/ port: 8080 initialDelaySeconds: {{ .Values.web.readinessProbe.initialDelaySeconds }} timeoutSeconds: {{ .Values.web.readinessProbe.timeoutSeconds }} resources: {{- toYaml .Values.web.resources | nindent 12 }} env: {{- if .Values.redisURL }} - name: REDIS_URL value: {{ .Values.redisURL }} {{- end }} {{- if .Values.redis.enabled }} - name: REDIS_PASSWORD valueFrom: secretKeyRef: key: redis-password name: {{ include "django.fullname" . }}-redis - name: REDIS_HOST value: {{ template "django.redis.host" . }} - name: REDIS_PORT value: {{ template "django.redis.port" . }} {{- end }} - name: POD_IP valueFrom: fieldRef: fieldPath: status.podIP envFrom: - secretRef: name: {{ include "django.fullname" . }} - configMapRef: name: {{ include "django.fullname" . }} {{- with .Values.web.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.web.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.web.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}