| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 1 | {{- if and .Values.preUpgradeChecker.jobEnabled .Values.preUpgradeChecker.upgradeVersionCheck}} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 2 | apiVersion: batch/v1 |
| 3 | kind: Job |
| 4 | metadata: |
| 5 | annotations: |
| 6 | "helm.sh/hook": pre-upgrade |
| 7 | "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation,hook-failed |
| 8 | name: longhorn-pre-upgrade |
| 9 | namespace: {{ include "release_namespace" . }} |
| 10 | labels: {{- include "longhorn.labels" . | nindent 4 }} |
| 11 | spec: |
| 12 | activeDeadlineSeconds: 900 |
| 13 | backoffLimit: 1 |
| 14 | template: |
| 15 | metadata: |
| 16 | name: longhorn-pre-upgrade |
| 17 | labels: {{- include "longhorn.labels" . | nindent 8 }} |
| 18 | spec: |
| 19 | containers: |
| 20 | - name: longhorn-pre-upgrade |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame^] | 21 | image: {{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.manager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.manager.repository }}:{{ .Values.image.longhorn.manager.tag }} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 22 | imagePullPolicy: {{ .Values.image.pullPolicy }} |
| gio | c9b92b1 | 2025-05-22 08:57:18 +0400 | [diff] [blame] | 23 | securityContext: |
| 24 | privileged: true |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 25 | command: |
| 26 | - longhorn-manager |
| 27 | - pre-upgrade |
| gio | c9b92b1 | 2025-05-22 08:57:18 +0400 | [diff] [blame] | 28 | volumeMounts: |
| 29 | - name: proc |
| 30 | mountPath: /host/proc/ |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 31 | env: |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame^] | 32 | {{- if .Values.longhornManager.distro }} |
| 33 | - name: LONGHORN_DISTRO |
| 34 | value: {{ .Values.longhornManager.distro | quote }} |
| 35 | {{- end }} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 36 | - name: POD_NAMESPACE |
| 37 | valueFrom: |
| 38 | fieldRef: |
| 39 | fieldPath: metadata.namespace |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame^] | 40 | {{- include "longhorn.timezoneEnv" . | nindent 8 }} |
| gio | c9b92b1 | 2025-05-22 08:57:18 +0400 | [diff] [blame] | 41 | volumes: |
| 42 | - name: proc |
| 43 | hostPath: |
| 44 | path: /proc/ |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 45 | restartPolicy: OnFailure |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame^] | 46 | {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 47 | imagePullSecrets: |
| gio | 3e1b96b | 2026-07-21 18:52:35 +0400 | [diff] [blame^] | 48 | {{- $imagePullSecrets := list }} |
| 49 | {{- if kindIs "string" . }} |
| 50 | {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }} |
| 51 | {{- else }} |
| 52 | {{- range . }} |
| 53 | {{- if kindIs "string" . }} |
| 54 | {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }} |
| 55 | {{- else }} |
| 56 | {{- $imagePullSecrets = append $imagePullSecrets . }} |
| 57 | {{- end }} |
| 58 | {{- end }} |
| 59 | {{- end }} |
| 60 | {{- toYaml $imagePullSecrets | nindent 8 }} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 61 | {{- end }} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 62 | serviceAccountName: longhorn-service-account |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 63 | {{- if or .Values.global.tolerations .Values.longhornManager.tolerations .Values.global.cattle.windowsCluster.enabled }} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 64 | tolerations: |
| 65 | {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }} |
| 66 | {{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }} |
| 67 | {{- end }} |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 68 | {{- if or .Values.global.tolerations .Values.longhornManager.tolerations }} |
| 69 | {{ default .Values.global.tolerations .Values.longhornManager.tolerations | toYaml | indent 6 }} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 70 | {{- end }} |
| 71 | {{- end }} |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 72 | {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector .Values.global.cattle.windowsCluster.enabled }} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 73 | nodeSelector: |
| 74 | {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }} |
| 75 | {{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }} |
| 76 | {{- end }} |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 77 | {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector }} |
| 78 | {{ default .Values.global.nodeSelector .Values.longhornManager.nodeSelector | toYaml | indent 8 }} |
| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 79 | {{- end }} |
| 80 | {{- end }} |
| gio | 16bb638 | 2025-05-21 18:42:40 +0400 | [diff] [blame] | 81 | {{- end }} |