blob: de660e1e7fdfed360ee0b5e6fe3955874e511137 [file] [log] [blame]
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04001apiVersion: batch/v1
2kind: Job
3metadata:
4 annotations:
5 "helm.sh/hook": pre-delete
6 "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
7 name: longhorn-uninstall
8 namespace: {{ include "release_namespace" . }}
9 labels: {{- include "longhorn.labels" . | nindent 4 }}
10spec:
11 activeDeadlineSeconds: 900
12 backoffLimit: 1
13 template:
14 metadata:
15 name: longhorn-uninstall
16 labels: {{- include "longhorn.labels" . | nindent 8 }}
17 spec:
18 containers:
19 - name: longhorn-uninstall
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040020 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 Lekveishvili4ec4c022024-08-17 15:09:24 +040021 imagePullPolicy: {{ .Values.image.pullPolicy }}
22 command:
23 - longhorn-manager
24 - uninstall
25 - --force
26 env:
27 - name: LONGHORN_NAMESPACE
28 valueFrom:
29 fieldRef:
30 fieldPath: metadata.namespace
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040031 {{- include "longhorn.timezoneEnv" . | nindent 8 }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040032 restartPolicy: Never
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040033 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040034 imagePullSecrets:
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040035 {{- $imagePullSecrets := list }}
36 {{- if kindIs "string" . }}
37 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
38 {{- else }}
39 {{- range . }}
40 {{- if kindIs "string" . }}
41 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
42 {{- else }}
43 {{- $imagePullSecrets = append $imagePullSecrets . }}
44 {{- end }}
45 {{- end }}
46 {{- end }}
47 {{- toYaml $imagePullSecrets | nindent 8 }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040048 {{- end }}
49 {{- if .Values.longhornManager.priorityClass }}
50 priorityClassName: {{ .Values.longhornManager.priorityClass | quote }}
51 {{- end }}
52 serviceAccountName: longhorn-service-account
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +040053 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040054 tolerations:
55 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }}
56{{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }}
57 {{- end }}
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +040058 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations }}
59{{ default .Values.global.tolerations .Values.longhornManager.tolerations | toYaml | indent 6 }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040060 {{- end }}
61 {{- end }}
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +040062 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040063 nodeSelector:
64 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }}
65{{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }}
66 {{- end }}
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +040067 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector }}
68{{ default .Values.global.nodeSelector .Values.longhornManager.nodeSelector | toYaml | indent 8 }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040069 {{- end }}
70 {{- end }}