blob: c1c0ae975028db4e50915698b317182d31ad6765 [file] [log] [blame]
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +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:
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040021 containers:
22 - name: longhorn-manager
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 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
gio3e1b96b2026-07-21 18:52:35 +040035 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.engine.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.engine.repository }}:{{ .Values.image.longhorn.engine.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040036 - --instance-manager-image
gio3e1b96b2026-07-21 18:52:35 +040037 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.instanceManager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.instanceManager.repository }}:{{ .Values.image.longhorn.instanceManager.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040038 - --share-manager-image
gio3e1b96b2026-07-21 18:52:35 +040039 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.shareManager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.shareManager.repository }}:{{ .Values.image.longhorn.shareManager.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040040 - --backing-image-manager-image
gio3e1b96b2026-07-21 18:52:35 +040041 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.backingImageManager.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.backingImageManager.repository }}:{{ .Values.image.longhorn.backingImageManager.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040042 - --support-bundle-manager-image
gio3e1b96b2026-07-21 18:52:35 +040043 - "{{ with (coalesce .Values.global.imageRegistry (include "registry_url" .) .Values.image.longhorn.supportBundleKit.registry) }}{{ . }}/{{ end }}{{ .Values.image.longhorn.supportBundleKit.repository }}:{{ .Values.image.longhorn.supportBundleKit.tag }}"
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040044 - --manager-image
gio3e1b96b2026-07-21 18:52:35 +040045 - "{{ 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 +040046 - --service-account
47 - longhorn-service-account
gio16bb6382025-05-21 18:42:40 +040048 {{- if .Values.preUpgradeChecker.upgradeVersionCheck}}
49 - --upgrade-version-check
50 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040051 ports:
52 - containerPort: 9500
53 name: manager
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040054 - containerPort: 9502
55 name: admission-wh
56 - containerPort: 9503
57 name: recov-backend
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040058 readinessProbe:
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040059 httpGet:
60 path: /v1/healthz
gio3e1b96b2026-07-21 18:52:35 +040061 port: 9502
Giorgi Lekveishvili285ab622023-11-22 13:50:45 +040062 scheme: HTTPS
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040063 volumeMounts:
gioc9b92b12025-05-22 08:57:18 +040064 - name: boot
65 mountPath: /host/boot/
66 readOnly: true
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040067 - name: dev
68 mountPath: /host/dev/
69 - name: proc
70 mountPath: /host/proc/
gioc9b92b12025-05-22 08:57:18 +040071 readOnly: true
72 - name: etc
73 mountPath: /host/etc/
74 readOnly: true
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040075 - name: longhorn
76 mountPath: /var/lib/longhorn/
77 mountPropagation: Bidirectional
78 - name: longhorn-grpc-tls
79 mountPath: /tls-files/
gio16bb6382025-05-21 18:42:40 +040080 {{- if .Values.enableGoCoverDir }}
81 - name: go-cover-dir
82 mountPath: /go-cover-dir/
83 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040084 env:
gioc9b92b12025-05-22 08:57:18 +040085 - name: POD_NAME
86 valueFrom:
87 fieldRef:
88 fieldPath: metadata.name
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040089 - 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
gio3e1b96b2026-07-21 18:52:35 +0400101 {{- if .Values.longhornManager.distro }}
102 - name: LONGHORN_DISTRO
103 value: {{ .Values.longhornManager.distro | quote }}
104 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400105 {{- if .Values.enableGoCoverDir }}
106 - name: GOCOVERDIR
107 value: /go-cover-dir/
108 {{- end }}
gio3e1b96b2026-07-21 18:52:35 +0400109 {{- include "longhorn.timezoneEnv" . | nindent 8 }}
110 {{- with .Values.longhornManager.resources }}
111 resources:
112 {{- toYaml . | nindent 10 }}
113 {{- end }}
gioc9b92b12025-05-22 08:57:18 +0400114 - name: pre-pull-share-manager-image
115 imagePullPolicy: {{ .Values.image.pullPolicy }}
gio3e1b96b2026-07-21 18:52:35 +0400116 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 }}
gioc9b92b12025-05-22 08:57:18 +0400117 command: ["sh", "-c", "echo share-manager image pulled && sleep infinity"]
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400118 volumes:
gioc9b92b12025-05-22 08:57:18 +0400119 - name: boot
120 hostPath:
121 path: /boot/
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400122 - name: dev
123 hostPath:
124 path: /dev/
125 - name: proc
126 hostPath:
127 path: /proc/
gioc9b92b12025-05-22 08:57:18 +0400128 - name: etc
129 hostPath:
130 path: /etc/
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400131 - name: longhorn
132 hostPath:
133 path: /var/lib/longhorn/
gio16bb6382025-05-21 18:42:40 +0400134 {{- if .Values.enableGoCoverDir }}
135 - name: go-cover-dir
136 hostPath:
137 path: /go-cover-dir/
138 type: DirectoryOrCreate
139 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400140 - name: longhorn-grpc-tls
141 secret:
142 secretName: longhorn-grpc-tls
143 optional: true
gio3e1b96b2026-07-21 18:52:35 +0400144 {{- with (coalesce .Values.global.imagePullSecrets .Values.privateRegistry.registrySecret) }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400145 imagePullSecrets:
gio3e1b96b2026-07-21 18:52:35 +0400146 {{- $imagePullSecrets := list }}
147 {{- if kindIs "string" . }}
148 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
149 {{- else }}
150 {{- range . }}
151 {{- if kindIs "string" . }}
152 {{- $imagePullSecrets = append $imagePullSecrets (dict "name" .) }}
153 {{- else }}
154 {{- $imagePullSecrets = append $imagePullSecrets . }}
155 {{- end }}
156 {{- end }}
157 {{- end }}
158 {{- toYaml $imagePullSecrets | nindent 8 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400159 {{- end }}
160 {{- if .Values.longhornManager.priorityClass }}
161 priorityClassName: {{ .Values.longhornManager.priorityClass | quote }}
162 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400163 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400164 tolerations:
165 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }}
166{{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }}
167 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400168 {{- if or .Values.global.tolerations .Values.longhornManager.tolerations }}
169{{ default .Values.global.tolerations .Values.longhornManager.tolerations | toYaml | indent 6 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400170 {{- end }}
171 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400172 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector .Values.global.cattle.windowsCluster.enabled }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400173 nodeSelector:
174 {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }}
175{{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }}
176 {{- end }}
gio16bb6382025-05-21 18:42:40 +0400177 {{- if or .Values.global.nodeSelector .Values.longhornManager.nodeSelector }}
178{{ default .Values.global.nodeSelector .Values.longhornManager.nodeSelector | toYaml | indent 8 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400179 {{- end }}
180 {{- end }}
181 serviceAccountName: longhorn-service-account
182 updateStrategy:
gio3e1b96b2026-07-21 18:52:35 +0400183{{ toYaml .Values.longhornManager.updateStrategy | indent 4 }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400184---
185apiVersion: v1
186kind: Service
187metadata:
188 labels: {{- include "longhorn.labels" . | nindent 4 }}
189 app: longhorn-manager
gio3e1b96b2026-07-21 18:52:35 +0400190 {{- with .Values.longhornManager.serviceLabels }}
191 {{- toYaml . | nindent 4 }}
192 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400193 name: longhorn-backend
194 namespace: {{ include "release_namespace" . }}
195 {{- if .Values.longhornManager.serviceAnnotations }}
196 annotations:
197{{ toYaml .Values.longhornManager.serviceAnnotations | indent 4 }}
198 {{- end }}
199spec:
200 type: {{ .Values.service.manager.type }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +0400201 selector:
202 app: longhorn-manager
203 ports:
204 - name: manager
205 port: 9500
206 targetPort: manager
207 {{- if .Values.service.manager.nodePort }}
208 nodePort: {{ .Values.service.manager.nodePort }}
209 {{- end }}