blob: 5683c759e75422083b326fa681e8f3654728931c [file] [log] [blame]
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +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
19 image: {{ template "registry_url" . }}{{ .Values.image.longhorn.manager.repository }}:{{ .Values.image.longhorn.manager.tag }}
20 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
23 image: {{ template "registry_url" . }}{{ .Values.image.longhorn.manager.repository }}:{{ .Values.image.longhorn.manager.tag }}
24 imagePullPolicy: {{ .Values.image.pullPolicy }}
25 command:
26 - longhorn-manager
27 - -d
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +040028 {{- if eq .Values.longhornDriver.log.format "json" }}
29 - -j
30 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040031 - deploy-driver
32 - --manager-image
33 - "{{ template "registry_url" . }}{{ .Values.image.longhorn.manager.repository }}:{{ .Values.image.longhorn.manager.tag }}"
34 - --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 }}
53 {{- if and .Values.image.csi.attacher.repository .Values.image.csi.attacher.tag }}
54 - name: CSI_ATTACHER_IMAGE
55 value: "{{ template "registry_url" . }}{{ .Values.image.csi.attacher.repository }}:{{ .Values.image.csi.attacher.tag }}"
56 {{- end }}
57 {{- if and .Values.image.csi.provisioner.repository .Values.image.csi.provisioner.tag }}
58 - name: CSI_PROVISIONER_IMAGE
59 value: "{{ template "registry_url" . }}{{ .Values.image.csi.provisioner.repository }}:{{ .Values.image.csi.provisioner.tag }}"
60 {{- end }}
61 {{- if and .Values.image.csi.nodeDriverRegistrar.repository .Values.image.csi.nodeDriverRegistrar.tag }}
62 - name: CSI_NODE_DRIVER_REGISTRAR_IMAGE
63 value: "{{ template "registry_url" . }}{{ .Values.image.csi.nodeDriverRegistrar.repository }}:{{ .Values.image.csi.nodeDriverRegistrar.tag }}"
64 {{- end }}
65 {{- if and .Values.image.csi.resizer.repository .Values.image.csi.resizer.tag }}
66 - name: CSI_RESIZER_IMAGE
67 value: "{{ template "registry_url" . }}{{ .Values.image.csi.resizer.repository }}:{{ .Values.image.csi.resizer.tag }}"
68 {{- end }}
69 {{- if and .Values.image.csi.snapshotter.repository .Values.image.csi.snapshotter.tag }}
70 - name: CSI_SNAPSHOTTER_IMAGE
71 value: "{{ template "registry_url" . }}{{ .Values.image.csi.snapshotter.repository }}:{{ .Values.image.csi.snapshotter.tag }}"
72 {{- end }}
73 {{- if and .Values.image.csi.livenessProbe.repository .Values.image.csi.livenessProbe.tag }}
74 - name: CSI_LIVENESS_PROBE_IMAGE
75 value: "{{ template "registry_url" . }}{{ .Values.image.csi.livenessProbe.repository }}:{{ .Values.image.csi.livenessProbe.tag }}"
76 {{- end }}
77 {{- if .Values.csi.attacherReplicaCount }}
78 - name: CSI_ATTACHER_REPLICA_COUNT
79 value: {{ .Values.csi.attacherReplicaCount | quote }}
80 {{- end }}
81 {{- if .Values.csi.provisionerReplicaCount }}
82 - name: CSI_PROVISIONER_REPLICA_COUNT
83 value: {{ .Values.csi.provisionerReplicaCount | quote }}
84 {{- end }}
85 {{- if .Values.csi.resizerReplicaCount }}
86 - name: CSI_RESIZER_REPLICA_COUNT
87 value: {{ .Values.csi.resizerReplicaCount | quote }}
88 {{- end }}
89 {{- if .Values.csi.snapshotterReplicaCount }}
90 - name: CSI_SNAPSHOTTER_REPLICA_COUNT
91 value: {{ .Values.csi.snapshotterReplicaCount | quote }}
92 {{- end }}
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +040093 {{- if .Values.enableGoCoverDir }}
94 - name: GOCOVERDIR
95 value: /go-cover-dir/
96 volumeMounts:
97 - name: go-cover-dir
98 mountPath: /go-cover-dir/
99 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400100
101 {{- if .Values.privateRegistry.registrySecret }}
102 imagePullSecrets:
103 - name: {{ .Values.privateRegistry.registrySecret }}
104 {{- end }}
105 {{- if .Values.longhornDriver.priorityClass }}
106 priorityClassName: {{ .Values.longhornDriver.priorityClass | quote }}
107 {{- end }}
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +0400108 {{- if or .Values.global.tolerations .Values.longhornDriver.tolerations .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400109 tolerations:
110 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }}
111{{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }}
112 {{- end }}
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +0400113 {{- if or .Values.global.tolerations .Values.longhornDriver.tolerations }}
114{{ default .Values.global.tolerations .Values.longhornDriver.tolerations | toYaml | indent 6 }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400115 {{- end }}
116 {{- end }}
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +0400117 {{- if or .Values.global.nodeSelector .Values.longhornDriver.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400118 nodeSelector:
119 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }}
120{{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }}
121 {{- end }}
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +0400122 {{- if or .Values.global.nodeSelector .Values.longhornDriver.nodeSelector }}
123{{ default .Values.global.nodeSelector .Values.longhornDriver.nodeSelector | toYaml | indent 8 }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400124 {{- end }}
125 {{- end }}
126 serviceAccountName: longhorn-service-account
127 securityContext:
128 runAsUser: 0
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +0400129 {{- if .Values.enableGoCoverDir }}
130 volumes:
131 - name: go-cover-dir
132 hostPath:
133 path: /go-cover-dir/
134 type: DirectoryOrCreate
135 {{- end }}