blob: 09d5f6fce4a4e0dc65d474e86c42de5d51a6dce1 [file] [log] [blame]
gio3e1b96b2026-07-21 18:52:35 +04001apiVersion: apps/v1
2kind: DaemonSet
3metadata:
4 labels: {{- include "longhorn.labels" . | nindent 4 }}
5 app: longhorn-manager
6 name: longhorn-manager
7 namespace: {{ include "release_namespace" . }}
8spec:
9 selector:
10 matchLabels:
11 app: longhorn-manager
12 template:
13 metadata:
14 labels: {{- include "longhorn.labels" . | nindent 8 }}
15 app: longhorn-manager
16 {{- with .Values.annotations }}
17 annotations:
18 {{- toYaml . | nindent 8 }}
19 {{- end }}
20 spec:
21 containers:
22 - name: longhorn-manager
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 securityContext:
26 privileged: true
27 command:
28 - longhorn-manager
29 - -d
30 {{- if eq .Values.longhornManager.log.format "json" }}
31 - -j
32 {{- end }}
33 - daemon
34 - --engine-image
35 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.engine.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.engine.repository }}:{{ .Values.image.longhorn.engine.tag }}"
36 - --instance-manager-image
37 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.instanceManager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.instanceManager.repository }}:{{ .Values.image.longhorn.instanceManager.tag }}"
38 - --share-manager-image
39 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.shareManager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.shareManager.repository }}:{{ .Values.image.longhorn.shareManager.tag }}"
40 - --backing-image-manager-image
41 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.backingImageManager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.backingImageManager.repository }}:{{ .Values.image.longhorn.backingImageManager.tag }}"
42 - --support-bundle-manager-image
43 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.supportBundleKit.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.supportBundleKit.repository }}:{{ .Values.image.longhorn.supportBundleKit.tag }}"
44 - --manager-image
45 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.manager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.manager.repository }}:{{ .Values.image.longhorn.manager.tag }}"
46 - --service-account
47 - longhorn-service-account
48 {{- if .Values.preUpgradeChecker.upgradeVersionCheck}}
49 - --upgrade-version-check
50 {{- end }}
51 ports:
52 - containerPort: 9500
53 name: manager
54 - containerPort: 9502
55 name: admission-wh
56 - containerPort: 9503
57 name: recov-backend
58 readinessProbe:
59 httpGet:
60 path: /v1/healthz
61 port: 9502
62 scheme: HTTPS
63 volumeMounts:
64 - name: boot
65 mountPath: /host/boot/
66 readOnly: true
67 - name: dev
68 mountPath: /host/dev/
69 - name: proc
70 mountPath: /host/proc/
71 readOnly: true
72 - name: etc
73 mountPath: /host/etc/
74 readOnly: true
75 - name: longhorn
76 mountPath: /var/lib/longhorn/
77 mountPropagation: Bidirectional
78 - name: longhorn-grpc-tls
79 mountPath: /tls-files/
80 {{- if .Values.enableGoCoverDir }}
81 - name: go-cover-dir
82 mountPath: /go-cover-dir/
83 {{- end }}
84 env:
85 - name: POD_NAME
86 valueFrom:
87 fieldRef:
88 fieldPath: metadata.name
89 - name: POD_NAMESPACE
90 valueFrom:
91 fieldRef:
92 fieldPath: metadata.namespace
93 - name: POD_IP
94 valueFrom:
95 fieldRef:
96 fieldPath: status.podIP
97 - name: NODE_NAME
98 valueFrom:
99 fieldRef:
100 fieldPath: spec.nodeName
101 {{- if .Values.enableGoCoverDir }}
102 - name: GOCOVERDIR
103 value: /go-cover-dir/
104 {{- end }}
105 {{- include "longhorn.timezoneEnv" . | nindent 8 }}
106 {{- with .Values.longhornManager.resources }}
107 resources:
108 {{- toYaml . | nindent 10 }}
109 {{- end }}
110 - name: pre-pull-share-manager-image
111 imagePullPolicy: {{ .Values.image.pullPolicy }}
112 image: {{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.shareManager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.shareManager.repository }}:{{ .Values.image.longhorn.shareManager.tag }}
113 command: ["sh", "-c", "echo share-manager image pulled && sleep infinity"]
114 volumes:
115 - name: boot
116 hostPath:
117 path: /boot/
118 - name: dev
119 hostPath:
120 path: /dev/
121 - name: proc
122 hostPath:
123 path: /proc/
124 - name: etc
125 hostPath:
126 path: /etc/
127 - name: longhorn
128 hostPath:
129 path: /var/lib/longhorn/
130 {{- if .Values.enableGoCoverDir }}
131 - name: go-cover-dir
132 hostPath:
133 path: /go-cover-dir/
134 type: DirectoryOrCreate
135 {{- end }}
136 - name: longhorn-grpc-tls
137 secret:
138 secretName: longhorn-grpc-tls
139 optional: true
140 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
141 imagePullSecrets:
142 {{- $imagePullSecrets := list }}
143 {{- if kindIs "string" . }}
144 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
145 {{- else }}
146 {{- range . }}
147 {{- if kindIs "string" . }}
148 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
149 {{- else }}
150 {{- $imagePullSecrets = append $imagePullSecrets . }}
151 {{- end }}
152 {{- end }}
153 {{- end }}
154 {{- toYaml $imagePullSecrets | nindent 8 }}
155 {{- end }}
156 {{- if .Values.longhornManager.priorityClass }}
157 priorityClassName: {{ .Values.longhornManager.priorityClass | quote }}
158 {{- end }}
159 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations .Values.global.cattle.windowsCluster.enabled }}
160 tolerations:
161 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }}
162{{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }}
163 {{- end }}
164 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations }}
165{{ default .Values.global.tolerations .Values.longhornManager.tolerations | toYaml | indent 6 }}
166 {{- end }}
167 {{- end }}
168 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
169 nodeSelector:
170 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }}
171{{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }}
172 {{- end }}
173 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector }}
174{{ default .Values.global.nodeSelector .Values.longhornManager.nodeSelector | toYaml | indent 8 }}
175 {{- end }}
176 {{- end }}
177 serviceAccountName: longhorn-service-account
178 updateStrategy:
179{{ toYaml .Values.longhornManager.updateStrategy | indent 4 }}
180---
181apiVersion: v1
182kind: Service
183metadata:
184 labels: {{- include "longhorn.labels" . | nindent 4 }}
185 app: longhorn-manager
186 {{- with .Values.longhornManager.serviceLabels }}
187 {{- toYaml . | nindent 4 }}
188 {{- end }}
189 name: longhorn-backend
190 namespace: {{ include "release_namespace" . }}
191 {{- if .Values.longhornManager.serviceAnnotations }}
192 annotations:
193{{ toYaml .Values.longhornManager.serviceAnnotations | indent 4 }}
194 {{- end }}
195spec:
196 type: {{ .Values.service.manager.type }}
197 selector:
198 app: longhorn-manager
199 ports:
200 - name: manager
201 port: 9500
202 targetPort: manager
203 {{- if .Values.service.manager.nodePort }}
204 nodePort: {{ .Values.service.manager.nodePort }}
205 {{- end }}