blob: d9beeaa35f490896a5fa223dbb5d1e2cb3b75e9d [file] [log] [blame]
gio3e1b96b2026-07-21 18:52:35 +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: {{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.manager.registry) }}{{ . }}/{{ end }}{{ .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: {{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.manager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.manager.repository }}:{{ .Values.image.longhorn.manager.tag }}
24 imagePullPolicy: {{ .Values.image.pullPolicy }}
25 command:
26 - longhorn-manager
27 - -d
28 {{- if eq .Values.longhornDriver.log.format "json" }}
29 - -j
30 {{- end }}
31 - deploy-driver
32 - --manager-image
33 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.manager.registry) }}{{ . }}/{{ end }}{{ .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 .Values.csi.podAntiAffinityPreset }}
54 - name: CSI_POD_ANTI_AFFINITY_PRESET
55 value: {{ .Values.csi.podAntiAffinityPreset }}
56 {{- end }}
57 {{- if and .Values.image.csi.attacher.repository .Values.image.csi.attacher.tag }}
58 - name: CSI_ATTACHER_IMAGE
59 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 }}"
60 {{- end }}
61 {{- if and .Values.image.csi.provisioner.repository .Values.image.csi.provisioner.tag }}
62 - name: CSI_PROVISIONER_IMAGE
63 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 }}"
64 {{- end }}
65 {{- if and .Values.image.csi.nodeDriverRegistrar.repository .Values.image.csi.nodeDriverRegistrar.tag }}
66 - name: CSI_NODE_DRIVER_REGISTRAR_IMAGE
67 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 }}"
68 {{- end }}
69 {{- if and .Values.image.csi.resizer.repository .Values.image.csi.resizer.tag }}
70 - name: CSI_RESIZER_IMAGE
71 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 }}"
72 {{- end }}
73 {{- if and .Values.image.csi.snapshotter.repository .Values.image.csi.snapshotter.tag }}
74 - name: CSI_SNAPSHOTTER_IMAGE
75 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 }}"
76 {{- end }}
77 {{- if and .Values.image.csi.livenessProbe.repository .Values.image.csi.livenessProbe.tag }}
78 - name: CSI_LIVENESS_PROBE_IMAGE
79 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 }}"
80 {{- 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 }}
97 {{- 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 }}
104 {{- include "longhorn.timezoneEnv" . | nindent 10 }}
105
106 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
107 imagePullSecrets:
108 {{- $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 }}
121 {{- end }}
122 {{- if .Values.longhornDriver.priorityClass }}
123 priorityClassName: {{ .Values.longhornDriver.priorityClass | quote }}
124 {{- end }}
125 {{- if or .Values.global.tolerations .Values.longhornDriver.tolerations .Values.global.cattle.windowsCluster.enabled }}
126 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 }}
130 {{- if or .Values.global.tolerations .Values.longhornDriver.tolerations }}
131{{ default .Values.global.tolerations .Values.longhornDriver.tolerations | toYaml | indent 6 }}
132 {{- end }}
133 {{- end }}
134 {{- if or .Values.global.nodeSelector .Values.longhornDriver.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
135 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 }}
139 {{- if or .Values.global.nodeSelector .Values.longhornDriver.nodeSelector }}
140{{ default .Values.global.nodeSelector .Values.longhornDriver.nodeSelector | toYaml | indent 8 }}
141 {{- end }}
142 {{- end }}
143 serviceAccountName: longhorn-service-account
144 securityContext:
145 runAsUser: 0
146 {{- if .Values.enableGoCoverDir }}
147 volumes:
148 - name: go-cover-dir
149 hostPath:
150 path: /go-cover-dir/
151 type: DirectoryOrCreate
152 {{- end }}