blob: 2119d3bc52e689fa3acccc43094dbf7c6d4a0e6c [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 - name: pre-pull-share-manager-image
106 imagePullPolicy: {{ .Values.image.pullPolicy }}
107 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 }}
108 command: ["sh", "-c", "echo share-manager image pulled && sleep infinity"]
109 volumes:
110 - name: boot
111 hostPath:
112 path: /boot/
113 - name: dev
114 hostPath:
115 path: /dev/
116 - name: proc
117 hostPath:
118 path: /proc/
119 - name: etc
120 hostPath:
121 path: /etc/
122 - name: longhorn
123 hostPath:
124 path: /var/lib/longhorn/
125 {{- if .Values.enableGoCoverDir }}
126 - name: go-cover-dir
127 hostPath:
128 path: /go-cover-dir/
129 type: DirectoryOrCreate
130 {{- end }}
131 - name: longhorn-grpc-tls
132 secret:
133 secretName: longhorn-grpc-tls
134 optional: true
135 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
136 imagePullSecrets:
137 {{- $imagePullSecrets := list }}
138 {{- if kindIs "string" . }}
139 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
140 {{- else }}
141 {{- range . }}
142 {{- if kindIs "string" . }}
143 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
144 {{- else }}
145 {{- $imagePullSecrets = append $imagePullSecrets . }}
146 {{- end }}
147 {{- end }}
148 {{- end }}
149 {{- toYaml $imagePullSecrets | nindent 8 }}
150 {{- end }}
151 {{- if .Values.longhornManager.priorityClass }}
152 priorityClassName: {{ .Values.longhornManager.priorityClass | quote }}
153 {{- end }}
154 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations .Values.global.cattle.windowsCluster.enabled }}
155 tolerations:
156 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }}
157{{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }}
158 {{- end }}
159 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations }}
160{{ default .Values.global.tolerations .Values.longhornManager.tolerations | toYaml | indent 6 }}
161 {{- end }}
162 {{- end }}
163 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
164 nodeSelector:
165 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }}
166{{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }}
167 {{- end }}
168 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector }}
169{{ default .Values.global.nodeSelector .Values.longhornManager.nodeSelector | toYaml | indent 8 }}
170 {{- end }}
171 {{- end }}
172 serviceAccountName: longhorn-service-account
173 updateStrategy:
174 rollingUpdate:
175 maxUnavailable: "100%"
176---
177apiVersion: v1
178kind: Service
179metadata:
180 labels: {{- include "longhorn.labels" . | nindent 4 }}
181 app: longhorn-manager
182 name: longhorn-backend
183 namespace: {{ include "release_namespace" . }}
184 {{- if .Values.longhornManager.serviceAnnotations }}
185 annotations:
186{{ toYaml .Values.longhornManager.serviceAnnotations | indent 4 }}
187 {{- end }}
188spec:
189 type: {{ .Values.service.manager.type }}
190 selector:
191 app: longhorn-manager
192 ports:
193 - name: manager
194 port: 9500
195 targetPort: manager
196 {{- if .Values.service.manager.nodePort }}
197 nodePort: {{ .Values.service.manager.nodePort }}
198 {{- end }}