|
| 1 | +{{- if .Values.pixelfed.horizon.separate_deployment }} |
| 2 | +--- |
| 3 | +apiVersion: apps/v1 |
| 4 | +kind: Deployment |
| 5 | +metadata: |
| 6 | + name: {{ include "pixelfed.fullname" . }}-backend |
| 7 | + labels: |
| 8 | + {{- include "pixelfed.labels" . | nindent 4 }} |
| 9 | +spec: |
| 10 | + {{- if not .Values.autoscaling.enabled }} |
| 11 | + replicas: {{ .Values.pixelfed.horizon.replicas }} |
| 12 | + {{- end }} |
| 13 | + selector: |
| 14 | + matchLabels: |
| 15 | + {{- include "pixelfed.horizon.selectorLabels" . | nindent 6 }} |
| 16 | + revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} |
| 17 | + template: |
| 18 | + metadata: |
| 19 | + annotations: |
| 20 | + # reload deployment if config files change |
| 21 | + php-config-hash: {{ toJson .Values.phpConfigs | sha256sum }} |
| 22 | + checksum/config: {{ include (print $.Template.BasePath "/configmap_env.yaml") . | sha256sum }} |
| 23 | + {{- with .Values.podAnnotations }} |
| 24 | + {{- toYaml . | nindent 8 }} |
| 25 | + {{- end }} |
| 26 | + labels: |
| 27 | + {{- include "pixelfed.horizon.selectorLabels" . | nindent 8 }} |
| 28 | + {{- include "pixelfed.labels" . | nindent 8 }} |
| 29 | + {{- with .Values.podLabels }} |
| 30 | + {{- toYaml . | nindent 8 }} |
| 31 | + {{- end }} |
| 32 | + spec: |
| 33 | + {{- with .Values.imagePullSecrets }} |
| 34 | + imagePullSecrets: |
| 35 | + {{- toYaml . | nindent 8 }} |
| 36 | + {{- end }} |
| 37 | + serviceAccountName: {{ include "pixelfed.serviceAccountName" . }} |
| 38 | + {{- with .Values.podSecurityContext }} |
| 39 | + securityContext: |
| 40 | + {{- toYaml . | nindent 8 }} |
| 41 | + {{- end }} |
| 42 | + {{- with .Values.extraInitContainers }} |
| 43 | + initContainers: |
| 44 | + {{- toYaml . | nindent 8 }} |
| 45 | + {{- end }} |
| 46 | + containers: |
| 47 | + - name: {{ .Chart.Name }}-backend |
| 48 | + {{- with .Values.securityContext }} |
| 49 | + securityContext: |
| 50 | + {{- toYaml . | nindent 12 }} |
| 51 | + {{- end }} |
| 52 | + image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 53 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 54 | + command: ["php"] |
| 55 | + args: ["artisan", "horizon"] |
| 56 | + envFrom: |
| 57 | + {{- with .Values.extraEnvFrom }} |
| 58 | + {{- toYaml . | nindent 12 }} |
| 59 | + {{- end }} |
| 60 | + - configMapRef: |
| 61 | + name: {{ include "pixelfed.fullname" . }}-env |
| 62 | + env: |
| 63 | + {{- with .Values.extraEnv }} |
| 64 | + {{- toYaml . | nindent 12 }} |
| 65 | + {{- end }} |
| 66 | + |
| 67 | + # pixelfed app key |
| 68 | + - name: APP_KEY |
| 69 | + valueFrom: |
| 70 | + secretKeyRef: |
| 71 | + {{- if and .Values.pixelfed.app.existingSecret .Values.pixelfed.app.existingSecretKey }} |
| 72 | + name: {{ .Values.pixelfed.app.existingSecret }} |
| 73 | + key: {{ .Values.pixelfed.app.existingSecretKey }} |
| 74 | + {{- else }} |
| 75 | + name: {{ include "pixelfed.fullname" . }}-app-key |
| 76 | + key: key |
| 77 | + {{- end }} |
| 78 | + |
| 79 | + # valkey AKA redis |
| 80 | + {{- if and .Values.externalValkey.enabled .Values.externalValkey.existingSecretKeys.host }} |
| 81 | + - name: REDIS_HOST |
| 82 | + valueFrom: |
| 83 | + secretKeyRef: |
| 84 | + {{- if and .Values.externalValkey.existingSecret .Values.externalValkey.existingSecretKeys.host }} |
| 85 | + name: {{ .Values.externalValkey.existingSecret }} |
| 86 | + key: {{ .Values.externalValkey.existingSecretKeys.host }} |
| 87 | + {{- else }} |
| 88 | + name: {{ include "pixelfed.fullname" . }}-valkey |
| 89 | + key: host |
| 90 | + {{- end }} |
| 91 | + {{- end }} |
| 92 | + |
| 93 | + {{- if and .Values.externalValkey.enabled .Values.externalValkey.existingSecret .Values.externalValkey.existingSecretKeys.port }} |
| 94 | + - name: REDIS_PORT |
| 95 | + valueFrom: |
| 96 | + secretKeyRef: |
| 97 | + {{- if and .Values.externalValkey.existingSecret .Values.externalValkey.existingSecretKeys.port }} |
| 98 | + name: {{ .Values.externalValkey.existingSecret }} |
| 99 | + key: {{ .Values.externalValkey.existingSecretKeys.port }} |
| 100 | + {{- else }} |
| 101 | + name: {{ include "pixelfed.fullname" . }}-valkey |
| 102 | + key: port |
| 103 | + {{- end }} |
| 104 | + {{- end }} |
| 105 | + |
| 106 | + - name: REDIS_PASSWORD |
| 107 | + valueFrom: |
| 108 | + secretKeyRef: |
| 109 | + {{- if and .Values.externalValkey.enabled .Values.externalValkey.existingSecret }} |
| 110 | + name: {{ .Values.externalValkey.existingSecret }} |
| 111 | + key: {{ .Values.externalValkey.existingSecretKeys.password }} |
| 112 | + {{- else if and .Values.externalValkey.enabled (not .Values.externalValkey.existingSecret) }} |
| 113 | + name: {{ include "pixelfed.fullname" . }}-valkey |
| 114 | + key: password |
| 115 | + {{- else if .Values.valkey.auth.existingSecret }} |
| 116 | + name: {{ .Values.valkey.auth.existingSecret }} |
| 117 | + key: password |
| 118 | + {{- else }} |
| 119 | + name: {{ .Values.valkey.fullnameOverride }} |
| 120 | + key: valkey-password |
| 121 | + {{- end }} |
| 122 | + |
| 123 | + # database configuration |
| 124 | + {{- if .Values.externalDatabase.enabled }} |
| 125 | + - name: DB_HOST |
| 126 | + valueFrom: |
| 127 | + secretKeyRef: |
| 128 | + {{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret .Values.externalDatabase.existingSecretKeys.host }} |
| 129 | + name: {{ .Values.externalDatabase.existingSecret }} |
| 130 | + key: {{ .Values.externalDatabase.existingSecretKeys.host }} |
| 131 | + {{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecretKeys.host) }} |
| 132 | + name: {{ include "pixelfed.fullname" . }}-database |
| 133 | + key: host |
| 134 | + {{- end }} |
| 135 | + {{- end }} |
| 136 | + |
| 137 | + {{- if .Values.externalDatabase.enabled }} |
| 138 | + - name: DB_USERNAME |
| 139 | + valueFrom: |
| 140 | + secretKeyRef: |
| 141 | + {{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret .Values.externalDatabase.existingSecretKeys.username }} |
| 142 | + name: {{ .Values.externalDatabase.existingSecret }} |
| 143 | + key: {{ .Values.externalDatabase.existingSecretKeys.username }} |
| 144 | + {{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecretKeys.username) }} |
| 145 | + name: {{ include "pixelfed.fullname" . }}-database |
| 146 | + key: username |
| 147 | + {{- end }} |
| 148 | + {{- end }} |
| 149 | + |
| 150 | + {{- if .Values.externalDatabase.enabled }} |
| 151 | + - name: DB_DATABASE |
| 152 | + valueFrom: |
| 153 | + secretKeyRef: |
| 154 | + {{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret .Values.externalDatabase.existingSecretKeys.database }} |
| 155 | + name: {{ .Values.externalDatabase.existingSecret }} |
| 156 | + key: {{ .Values.externalDatabase.existingSecretKeys.database }} |
| 157 | + {{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecretKeys.database) }} |
| 158 | + name: {{ include "pixelfed.fullname" . }}-database |
| 159 | + key: database |
| 160 | + {{- end }} |
| 161 | + {{- end }} |
| 162 | + |
| 163 | + {{- if .Values.externalDatabase.enabled }} |
| 164 | + - name: DB_PORT |
| 165 | + valueFrom: |
| 166 | + secretKeyRef: |
| 167 | + {{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret .Values.externalDatabase.existingSecretKeys.port }} |
| 168 | + name: {{ .Values.externalDatabase.existingSecret }} |
| 169 | + key: {{ .Values.externalDatabase.existingSecretKeys.port }} |
| 170 | + {{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecretKeys.port) }} |
| 171 | + name: {{ include "pixelfed.fullname" . }}-database |
| 172 | + key: port |
| 173 | + {{- end }} |
| 174 | + {{- end }} |
| 175 | + |
| 176 | + - name: DB_PASSWORD |
| 177 | + {{- if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecret) }} |
| 178 | + value: {{ .Values.externalDatabase.password }} |
| 179 | + {{- else }} |
| 180 | + valueFrom: |
| 181 | + secretKeyRef: |
| 182 | + {{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret }} |
| 183 | + name: {{ .Values.externalDatabase.existingSecret }} |
| 184 | + key: {{ .Values.externalDatabase.existingSecretKeys.password }} |
| 185 | + {{- else if .Values.postgresql.auth.existingSecret }} |
| 186 | + name: {{ .Values.postgresql.auth.existingSecret }} |
| 187 | + key: postgres-password |
| 188 | + {{- else }} |
| 189 | + name: {{ .Values.postgresql.fullnameOverride }} |
| 190 | + key: postgres-password |
| 191 | + {{- end }} |
| 192 | + {{- end }} |
| 193 | + |
| 194 | + {{- with .Values.resources }} |
| 195 | + resources: |
| 196 | + {{- toYaml . | nindent 12 }} |
| 197 | + {{- end }} |
| 198 | + |
| 199 | + {{- if or .Values.extraVolumeMounts .Values.phpConfigs }} |
| 200 | + volumeMounts: |
| 201 | + {{- with .Values.extraVolumeMounts }} |
| 202 | + {{- toYaml . | nindent 12 }} |
| 203 | + {{- end }} |
| 204 | + {{- range $key, $value := .Values.phpConfigs }} |
| 205 | + - name: phpconfig |
| 206 | + mountPath: {{ print "/usr/local/etc/php-fpm.d/%s" $key | quote }} |
| 207 | + subPath: {{ $key }} |
| 208 | + {{- end }} |
| 209 | + {{- end }}{{/* end volumeMounts */}} |
| 210 | + |
| 211 | + {{- if or .Values.phpConfigs .Values.extraVolumes }} |
| 212 | + volumes: |
| 213 | + {{- with .Values.extraVolumes }} |
| 214 | + {{- toYaml . | nindent 8 }} |
| 215 | + {{- end }} |
| 216 | + {{- if .Values.phpConfigs }} |
| 217 | + - name: phpconfig |
| 218 | + configMap: |
| 219 | + name: {{ template "pixelfed.fullname" . }}-phpconfig |
| 220 | + {{- end }} |
| 221 | + {{- end }} |
| 222 | + {{- with .Values.nodeSelector }} |
| 223 | + nodeSelector: |
| 224 | + {{- toYaml . | nindent 8 }} |
| 225 | + {{- end }} |
| 226 | + {{- with .Values.affinity }} |
| 227 | + affinity: |
| 228 | + {{- toYaml . | nindent 8 }} |
| 229 | + {{- end }} |
| 230 | + {{- with .Values.tolerations }} |
| 231 | + tolerations: |
| 232 | + {{- toYaml . | nindent 8 }} |
| 233 | + {{- end }} |
| 234 | +{{- end }} |
0 commit comments