blob: 4e4e77f71b93c1d8f64d265202cfeb3a65e8cf82 [file] [log] [blame]
gio16bb6382025-05-21 18:42:40 +04001{{- if and .Values.preUpgradeChecker.jobEnabled .Values.preUpgradeChecker.upgradeVersionCheck}}
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +04002apiVersion: batch/v1
3kind: Job
4metadata:
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 }}
11spec:
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
gio3e1b96b2026-07-21 18:52:35 +040021 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 Lekveishvili285ab622023-11-22 13:50:45 +040022 imagePullPolicy: {{ .Values.image.pullPolicy }}
gioc9b92b12025-05-22 08:57:18 +040023 securityContext:
24 privileged: true
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040025 command:
26 - longhorn-manager
27 - pre-upgrade
gioc9b92b12025-05-22 08:57:18 +040028 volumeMounts:
29 - name: proc
30 mountPath: /host/proc/
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040031 env:
gio3e1b96b2026-07-21 18:52:35 +040032 {{- if .Values.longhornManager.distro }}
33 - name: LONGHORN_DISTRO
34 value: {{ .Values.longhornManager.distro | quote }}
35 {{- end }}
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040036 - name: POD_NAMESPACE
37 valueFrom:
38 fieldRef:
39 fieldPath: metadata.namespace
gio3e1b96b2026-07-21 18:52:35 +040040 {{- include "longhorn.timezoneEnv" . | nindent 8 }}
gioc9b92b12025-05-22 08:57:18 +040041 volumes:
42 - name: proc
43 hostPath:
44 path: /proc/
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040045 restartPolicy: OnFailure
gio3e1b96b2026-07-21 18:52:35 +040046 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040047 imagePullSecrets:
gio3e1b96b2026-07-21 18:52:35 +040048 {{- $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 Lekveishvili285ab622023-11-22 13:50:45 +040061 {{- end }}
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040062 serviceAccountName: longhorn-service-account
gio16bb6382025-05-21 18:42:40 +040063 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040064 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 }}
gio16bb6382025-05-21 18:42:40 +040068 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations }}
69{{ default .Values.global.tolerations .Values.longhornManager.tolerations | toYaml | indent 6 }}
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040070 {{- end }}
71 {{- end }}
gio16bb6382025-05-21 18:42:40 +040072 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040073 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 }}
gio16bb6382025-05-21 18:42:40 +040077 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector }}
78{{ default .Values.global.nodeSelector .Values.longhornManager.nodeSelector | toYaml | indent 8 }}
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040079 {{- end }}
80 {{- end }}
gio16bb6382025-05-21 18:42:40 +040081{{- end }}