blob: d9beeaa35f490896a5fa223dbb5d1e2cb3b75e9d [file] [log] [blame]
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +04001apiVersion: apps/v1
2kind: Deployment
3metadata:
4 name: longhorn-driver-deployer
5 namespace: {{ include "release_namespace" . }}
6 labels: {{- include "longhorn.labels" . | nindent 4 }}
7spec:
8 replicas: 1
9 selector:
10 matchLabels:
11 app: longhorn-driver-deployer
12 template:
13 metadata:
14 labels: {{- include "longhorn.labels" . | nindent 8 }}
15 app: longhorn-driver-deployer
16 spec:
17 initContainers:
18 - name: wait-longhorn-manager
gio3e1b96b2026-07-21 18:52:35 +040019 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 Lekveishvili725bb392023-05-05 18:24:27 +040020 command: ['sh', '-c', 'while [ $(curl -m 1 -s -o /dev/null -w "%{http_code}" http://longhorn-backend:9500/v1) != "200" ]; do echo waiting; sleep 2; done']
21 containers:
22 - name: longhorn-driver-deployer
gio3e1b96b2026-07-21 18:52:35 +040023 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 Lekveishvili725bb392023-05-05 18:24:27 +040024 imagePullPolicy: {{ .Values.image.pullPolicy }}
25 command:
26 - longhorn-manager
27 - -d
gio16bb6382025-05-21 18:42:40 +040028 {{- if eq .Values.longhornDriver.log.format "json" }}
29 - -j
30 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040031 - deploy-driver
32 - --manager-image
gio3e1b96b2026-07-21 18:52:35 +040033 - "{{ 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 Lekveishvili725bb392023-05-05 18:24:27 +040034 - --manager-url
35 - http://longhorn-backend:9500/v1
36 env:
37 - name: POD_NAMESPACE
38 valueFrom:
39 fieldRef:
40 fieldPath: metadata.namespace
41 - name: NODE_NAME
42 valueFrom:
43 fieldRef:
44 fieldPath: spec.nodeName
45 - name: SERVICE_ACCOUNT
46 valueFrom:
47 fieldRef:
48 fieldPath: spec.serviceAccountName
49 {{- if .Values.csi.kubeletRootDir }}
50 - name: KUBELET_ROOT_DIR
51 value: {{ .Values.csi.kubeletRootDir }}
52 {{- end }}
gio3e1b96b2026-07-21 18:52:35 +040053 {{- if .Values.csi.podAntiAffinityPreset }}
54 - name: CSI_POD_ANTI_AFFINITY_PRESET
55 value: {{ .Values.csi.podAntiAffinityPreset }}
56 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040057 {{- if and .Values.image.csi.attacher.repository .Values.image.csi.attacher.tag }}
58 - name: CSI_ATTACHER_IMAGE
gio3e1b96b2026-07-21 18:52:35 +040059 value: "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.csi.attacher.registry) }}{{ . }}/{{ end }}{{ .Values.image.csi.attacher.repository }}:{{ .Values.image.csi.attacher.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040060 {{- end }}
61 {{- if and .Values.image.csi.provisioner.repository .Values.image.csi.provisioner.tag }}
62 - name: CSI_PROVISIONER_IMAGE
gio3e1b96b2026-07-21 18:52:35 +040063 value: "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.csi.provisioner.registry) }}{{ . }}/{{ end }}{{ .Values.image.csi.provisioner.repository }}:{{ .Values.image.csi.provisioner.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040064 {{- end }}
65 {{- if and .Values.image.csi.nodeDriverRegistrar.repository .Values.image.csi.nodeDriverRegistrar.tag }}
66 - name: CSI_NODE_DRIVER_REGISTRAR_IMAGE
gio3e1b96b2026-07-21 18:52:35 +040067 value: "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.csi.nodeDriverRegistrar.registry) }}{{ . }}/{{ end }}{{ .Values.image.csi.nodeDriverRegistrar.repository }}:{{ .Values.image.csi.nodeDriverRegistrar.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040068 {{- end }}
69 {{- if and .Values.image.csi.resizer.repository .Values.image.csi.resizer.tag }}
70 - name: CSI_RESIZER_IMAGE
gio3e1b96b2026-07-21 18:52:35 +040071 value: "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.csi.resizer.registry) }}{{ . }}/{{ end }}{{ .Values.image.csi.resizer.repository }}:{{ .Values.image.csi.resizer.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040072 {{- end }}
73 {{- if and .Values.image.csi.snapshotter.repository .Values.image.csi.snapshotter.tag }}
74 - name: CSI_SNAPSHOTTER_IMAGE
gio3e1b96b2026-07-21 18:52:35 +040075 value: "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.csi.snapshotter.registry) }}{{ . }}/{{ end }}{{ .Values.image.csi.snapshotter.repository }}:{{ .Values.image.csi.snapshotter.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040076 {{- end }}
77 {{- if and .Values.image.csi.livenessProbe.repository .Values.image.csi.livenessProbe.tag }}
78 - name: CSI_LIVENESS_PROBE_IMAGE
gio3e1b96b2026-07-21 18:52:35 +040079 value: "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.csi.livenessProbe.registry) }}{{ . }}/{{ end }}{{ .Values.image.csi.livenessProbe.repository }}:{{ .Values.image.csi.livenessProbe.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040080 {{- end }}
81 {{- if .Values.csi.attacherReplicaCount }}
82 - name: CSI_ATTACHER_REPLICA_COUNT
83 value: {{ .Values.csi.attacherReplicaCount | quote }}
84 {{- end }}
85 {{- if .Values.csi.provisionerReplicaCount }}
86 - name: CSI_PROVISIONER_REPLICA_COUNT
87 value: {{ .Values.csi.provisionerReplicaCount | quote }}
88 {{- end }}
89 {{- if .Values.csi.resizerReplicaCount }}
90 - name: CSI_RESIZER_REPLICA_COUNT
91 value: {{ .Values.csi.resizerReplicaCount | quote }}
92 {{- end }}
93 {{- if .Values.csi.snapshotterReplicaCount }}
94 - name: CSI_SNAPSHOTTER_REPLICA_COUNT
95 value: {{ .Values.csi.snapshotterReplicaCount | quote }}
96 {{- end }}
gio16bb6382025-05-21 18:42:40 +040097 {{- if .Values.enableGoCoverDir }}
98 - name: GOCOVERDIR
99 value: /go-cover-dir/
100 volumeMounts:
101 - name: go-cover-dir
102 mountPath: /go-cover-dir/
103 {{- end }}
gio3e1b96b2026-07-21 18:52:35 +0400104 {{- include "longhorn.timezoneEnv" . | nindent 10 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400105
gio3e1b96b2026-07-21 18:52:35 +0400106 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400107 imagePullSecrets:
gio3e1b96b2026-07-21 18:52:35 +0400108 {{- $imagePullSecrets := list }}
109 {{- if kindIs "string" . }}
110 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
111 {{- else }}
112 {{- range . }}
113 {{- if kindIs "string" . }}
114 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
115 {{- else }}
116 {{- $imagePullSecrets = append $imagePullSecrets . }}
117 {{- end }}
118 {{- end }}
119 {{- end }}
120 {{- toYaml $imagePullSecrets | nindent 8 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400121 {{- end }}
122 {{- if .Values.longhornDriver.priorityClass }}
123 priorityClassName: {{ .Values.longhornDriver.priorityClass | quote }}
124 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400125 {{- if or .Values.global.tolerations .Values.longhornDriver.tolerations .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400126 tolerations:
127 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }}
128{{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }}
129 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400130 {{- if or .Values.global.tolerations .Values.longhornDriver.tolerations }}
131{{ default .Values.global.tolerations .Values.longhornDriver.tolerations | toYaml | indent 6 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400132 {{- end }}
133 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400134 {{- if or .Values.global.nodeSelector .Values.longhornDriver.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400135 nodeSelector:
136 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }}
137{{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }}
138 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400139 {{- if or .Values.global.nodeSelector .Values.longhornDriver.nodeSelector }}
140{{ default .Values.global.nodeSelector .Values.longhornDriver.nodeSelector | toYaml | indent 8 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400141 {{- end }}
142 {{- end }}
143 serviceAccountName: longhorn-service-account
144 securityContext:
145 runAsUser: 0
gio16bb6382025-05-21 18:42:40 +0400146 {{- if .Values.enableGoCoverDir }}
147 volumes:
148 - name: go-cover-dir
149 hostPath:
150 path: /go-cover-dir/
151 type: DirectoryOrCreate
152 {{- end }}