{{- $clusterDomain := default "cluster.local" .Values.clusterDomain}} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "mailman3.fullname" . }}-web labels: {{- include "mailman3.labels" . | nindent 4 }} app.kubernetes.io/component: web spec: replicas: 1 selector: matchLabels: {{- include "mailman3.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: web template: metadata: {{- with .Values.web.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "mailman3.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: web spec: {{- with .Values.web.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: {{- toYaml .Values.web.podSecurityContext | nindent 8 }} volumes: - name: web-data persistentVolumeClaim: claimName: {{ include "web.claimName" . }} containers: - name: mailman-web securityContext: {{- toYaml .Values.web.securityContext | nindent 12 }} image: "{{ .Values.web.image.repository }}:{{ .Values.web.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.web.image.pullPolicy }} env: - name: HYPERKITTY_API_KEY value: {{ .Values.hyperkittyApiKey }} - name: SECRET_KEY value: {{ .Values.djangoSecretKey }} - name: MAILMAN_REST_URL value: http://{{ include "mailman3.fullname" . }}-core.{{ .Release.Namespace }}.svc.{{ $clusterDomain }}:8001 - name: POSTORIUS_TEMPLATE_BASE_URL value: http://{{ include "mailman3.fullname" . }}-web.{{ .Release.Namespace }}.svc.{{ $clusterDomain }}:80 {{- if .Values.ingress.enabled }} - name: SERVE_FROM_DOMAIN value: {{ .Values.hostname | quote }} {{- end }} {{- if .Values.postgresql.enabled }} - name: DATABASE_URL value: "postgresql://{{ .Values.postgresql.global.postgresql.auth.username }}:{{ .Values.postgresql.global.postgresql.auth.password }}@postgresql/mailman" - name: DATABASE_TYPE value: postgresql {{- else }} - name: DATABASE_URL value: sqlite://///opt/mailman-web-data/mailmanweb.db - name: DATABASE_TYPE value: sqlite {{- end }} - name: MAILMAN_ADMIN_USER value: {{ .Values.admin.username }} - name: MAILMAN_ADMIN_EMAIL value: {{ .Values.admin.email }} {{- if .Values.smtp }} - name: SMTP_HOST value: {{ .Values.smtp.host }} - name: SMTP_PORT value: {{ .Values.smtp.port }} - name: SMTP_HOST_USER value: {{ .Values.smtp.host_user }} - name: SMTP_HOST_PASSWORD value: {{ .Values.smtp.host_password }} - name: SMTP_USE_TLS value: {{ .Values.smtp.use_tls }} {{- else }} - name: SMTP_HOST value: {{ include "mailman3.fullname" . }}-core.{{ .Release.Namespace }}.svc.{{ $clusterDomain }} {{- end }} args: - uwsgi - --ini - /opt/mailman-web/uwsgi.ini - --static-map - /static=/opt/mailman-web-data/static ports: - name: http containerPort: 8000 protocol: TCP livenessProbe: # httpGet: # path: / # port: http # readinessProbe: # httpGet: # path: / # port: http volumeMounts: - name: web-data mountPath: /opt/mailman-web-data resources: {{- toYaml .Values.web.resources | nindent 12 }} {{- 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 }} strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 maxSurge: 0 --- apiVersion: v1 kind: Service metadata: name: {{ include "mailman3.fullname" . }}-web labels: {{- include "mailman3.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: - name: http port: 80 targetPort: 8000 protocol: TCP selector: {{- include "mailman3.selectorLabels" . | nindent 4 }} app.kubernetes.io/component: web