apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "pixelfed.fullname" . }} labels: {{- include "pixelfed.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: {{- include "pixelfed.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "pixelfed.labels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "pixelfed.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http containerPort: {{ .Values.service.targetPort }} protocol: TCP envFrom: - configMapRef: name: {{ include "pixelfed.fullname" . }}-env env: # redis - name: REDIS_HOST {{- if .Values.externalValkey.existingSecret }} valueFrom: secretKeyRef: name: {{ .Values.externalValkey.existingSecret }} key: {{ .Values.externalValkey.existingSecretKeys.host }} {{- else }} value: {{ printf "%s-primary" (.Values.valkey.fullnameOverride) }} {{- end }} - name: REDIS_PORT {{- if .Values.externalValkey }} {{- if .Values.externalValkey.existingSecret }} valueFrom: secretKeyRef: name: {{ .Values.externalValkey.existingSecret }} key: {{ .Values.externalValkey.existingSecretKeys.port }} {{- else }} value: {{ .Values.externalValkey.port | quote }} {{- end }} {{- else }} value: {{ .Values.valkey.primary.service.ports.valkey | quote }} {{- end }} - name: REDIS_PASSWORD valueFrom: secretKeyRef: {{- if .Values.externalValkey.existingSecret }} name: {{ .Values.externalValkey.existingSecret }} key: {{ .Values.externalValkey.existingSecretKeys.password }} {{- else if .Values.valkey.auth.existingSecret }} name: {{ .Values.valkey.auth.existingSecret }} key: password {{- else }} name: {{ .Values.valkey.fullnameOverride }} key: valkey-password {{- end }} # mail - name: MAIL_HOST valueFrom: secretKeyRef: {{- if .Values.pixelfed.mail.existingSecret }} name: {{ .Values.pixelfed.mail.existingSecret }} key: {{ .Values.pixelfed.mail.existingSecretKeys.host }} {{- else }} name: pixelfed-mail key: host {{- end }} - name: MAIL_PORT valueFrom: secretKeyRef: {{- if .Values.pixelfed.mail.existingSecret }} name: {{ .Values.pixelfed.mail.existingSecret }} key: {{ .Values.pixelfed.mail.existingSecretKeys.port }} {{- else }} name: pixelfed-mail key: port {{- end }} - name: MAIL_FROM_ADDRESS value: "{{ .Values.pixelfed.mail.from_address }}" - name: MAIL_FROM_NAME value: "{{ .Values.pixelfed.mail.from_name }}" - name: MAIL_USERNAME valueFrom: secretKeyRef: {{- if .Values.pixelfed.mail.existingSecret }} name: {{ .Values.pixelfed.mail.existingSecret }} key: {{ .Values.pixelfed.mail.existingSecretKeys.username }} {{- else }} name: pixelfed-mail key: username {{- end }} - name: MAIL_PASSWORD valueFrom: secretKeyRef: {{- if .Values.pixelfed.mail.existingSecret }} name: {{ .Values.pixelfed.mail.existingSecret }} key: {{ .Values.pixelfed.mail.existingSecretKeys.password }} {{- else }} name: pixelfed-mail key: password {{- end }} # database configuration - name: DB_HOST {{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret }} valueFrom: secretKeyRef: name: {{ .Values.externalDatabase.existingSecret }} key: {{ .Values.externalDatabase.existingSecretKeys.host }} {{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecret) }} value: {{ .Values.externalDatabase.host }} {{- else }} value: {{ .Values.postgresql.fullnameOverride }} {{- end }} - name: DB_USERNAME {{- if .Values.externalDatabase.enabled }} {{- if .Values.externalDatabase.existingSecret }} valueFrom: secretKeyRef: name: {{ .Values.externalDatabase.existingSecret }} key: {{ .Values.externalDatabase.existingSecretKeys.username }} {{- else }} value: {{ .Values.externalDatabase.username }} {{- end }} {{- else }} value: postgres {{- end }} - name: DB_PASSWORD {{- if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecret) }} value: {{ .Values.externalDatabase.password }} {{- else }} valueFrom: secretKeyRef: {{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret }} name: {{ .Values.externalDatabase.existingSecret }} key: {{ .Values.externalDatabase.existingSecretKeys.password }} {{- else if .Values.postgresql.auth.existingSecret }} name: {{ .Values.postgresql.auth.existingSecret }} key: postgres-password {{- else }} name: {{ .Values.postgresql.fullnameOverride }} key: postgres-password {{- end }} {{- end }} - name: DB_DATABASE {{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret }} valueFrom: secretKeyRef: name: {{ .Values.externalDatabase.existingSecret }} key: {{ .Values.externalDatabase.existingSecretKeys.database }} {{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecret) }} value: {{ .Values.externalDatabase.database }} {{- else }} value: postgres {{- end }} - name: DB_PORT {{- if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecret) }} value: {{ .Values.externalDatabase.port }} {{- else if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret }} valueFrom: secretKeyRef: name: {{ .Values.externalDatabase.existingSecret }} key: {{ .Values.externalDatabase.existingSecretKeys.port }} {{- else }} value: {{ .Values.postgresql.primary.service.ports.postgresql | quote }} {{- end }} {{- with .Values.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.readinessProbe }} readinessProbe: {{- toYaml . | nindent 12 }} {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.volumeMounts }} volumeMounts: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.volumes }} volumes: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}