apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "n8n.fullname" . }} labels: {{- include "n8n.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: {{- include "n8n.selectorLabels" . | nindent 6 }} strategy: type: Recreate template: metadata: annotations: checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "n8n.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "n8n.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: n8n securityContext: {{- toYaml .Values.securityContext | nindent 10 }} image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http containerPort: 5678 protocol: TCP env: - name: N8N_PORT value: "5678" - name: N8N_PROTOCOL value: {{ .Values.n8n.protocol | quote }} - name: N8N_HOST value: {{ .Values.n8n.host | quote }} {{- if .Values.n8n.webhookUrl }} - name: WEBHOOK_URL value: {{ .Values.n8n.webhookUrl | quote }} {{- end }} - name: GENERIC_TIMEZONE value: {{ .Values.n8n.timezone | quote }} - name: N8N_LOG_LEVEL value: {{ .Values.n8n.logLevel | quote }} - name: N8N_USER_FOLDER value: "/home/node/.n8n" - name: N8N_ENCRYPTION_KEY valueFrom: secretKeyRef: name: {{ include "n8n.secretName" . }} key: encryption-key {{- if .Values.n8n.basicAuth.enabled }} - name: N8N_BASIC_AUTH_ACTIVE value: "true" - name: N8N_BASIC_AUTH_USER value: {{ .Values.n8n.basicAuth.user | quote }} - name: N8N_BASIC_AUTH_PASSWORD valueFrom: secretKeyRef: name: {{ .Values.n8n.basicAuth.existingSecret | default (include "n8n.fullname" .) }} key: {{ .Values.n8n.basicAuth.passwordKey }} {{- end }} - name: N8N_SECURE_COOKIE {{- if and .Values.ingress.enabled .Values.ingress.tls }} value: "true" {{- else }} value: "false" {{- end }} - name: EXECUTIONS_DATA_PRUNE value: {{ .Values.n8n.executions.pruneData | quote }} - name: EXECUTIONS_DATA_MAX_AGE value: {{ .Values.n8n.executions.pruneDataMaxAge | quote }} - name: EXECUTIONS_DATA_MAX_COUNT value: {{ .Values.n8n.executions.pruneDataMaxCount | quote }} - name: DB_TYPE value: {{ .Values.n8n.database.type | quote }} {{- if eq .Values.n8n.database.type "postgresdb" }} - name: DB_POSTGRESDB_HOST value: {{ .Values.n8n.database.postgresdb.host | quote }} - name: DB_POSTGRESDB_PORT value: {{ .Values.n8n.database.postgresdb.port | quote }} - name: DB_POSTGRESDB_DATABASE value: {{ .Values.n8n.database.postgresdb.database | quote }} - name: DB_POSTGRESDB_USER value: {{ .Values.n8n.database.postgresdb.user | quote }} - name: DB_POSTGRESDB_PASSWORD valueFrom: secretKeyRef: name: {{ .Values.n8n.database.postgresdb.existingSecret | default (include "n8n.fullname" .) }} key: {{ .Values.n8n.database.postgresdb.passwordKey }} {{- end }} {{- range $key, $val := .Values.n8n.extraEnv }} - name: {{ $key }} value: {{ $val | quote }} {{- end }} {{- if .Values.livenessProbe.enabled }} livenessProbe: httpGet: path: /healthz port: http initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.livenessProbe.periodSeconds }} timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} failureThreshold: {{ .Values.livenessProbe.failureThreshold }} successThreshold: {{ .Values.livenessProbe.successThreshold }} {{- end }} {{- if .Values.readinessProbe.enabled }} readinessProbe: httpGet: path: /healthz port: http initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.readinessProbe.periodSeconds }} timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} failureThreshold: {{ .Values.readinessProbe.failureThreshold }} successThreshold: {{ .Values.readinessProbe.successThreshold }} {{- end }} resources: {{- toYaml .Values.resources | nindent 10 }} volumeMounts: - name: data mountPath: /home/node/.n8n volumes: - name: data {{- if .Values.persistence.enabled }} persistentVolumeClaim: claimName: {{ include "n8n.pvcName" . }} {{- else }} emptyDir: {} {{- 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 }}