| Giorgi Lekveishvili | 285ab62 | 2023-11-22 13:50:45 +0400 | [diff] [blame] | 1 | apiVersion: apps/v1 |
| 2 | kind: DaemonSet |
| 3 | metadata: |
| 4 | labels: {{- include "longhorn.labels" . | nindent 4 }} |
| 5 | app: longhorn-manager |
| 6 | name: longhorn-manager |
| 7 | namespace: {{ include "release_namespace" . }} |
| 8 | spec: |
| 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 | initContainers: |
| 22 | - name: wait-longhorn-admission-webhook |
| 23 | image: {{ template "registry_url" . }}{{ .Values.image.longhorn.manager.repository }}:{{ .Values.image.longhorn.manager.tag }} |
| 24 | command: ['sh', '-c', 'while [ $(curl -m 1 -s -o /dev/null -w "%{http_code}" -k https://longhorn-admission-webhook:9443/v1/healthz) != "200" ]; do echo waiting; sleep 2; done'] |
| 25 | containers: |
| 26 | - name: longhorn-manager |
| 27 | image: {{ template "registry_url" . }}{{ .Values.image.longhorn.manager.repository }}:{{ .Values.image.longhorn.manager.tag }} |
| 28 | imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 29 | securityContext: |
| 30 | privileged: true |
| 31 | command: |
| 32 | - longhorn-manager |
| 33 | - -d |
| 34 | {{- if eq .Values.longhornManager.log.format "json" }} |
| 35 | - -j |
| 36 | {{- end }} |
| 37 | - daemon |
| 38 | - --engine-image |
| 39 | - "{{ template "registry_url" . }}{{ .Values.image.longhorn.engine.repository }}:{{ .Values.image.longhorn.engine.tag }}" |
| 40 | - --instance-manager-image |
| 41 | - "{{ template "registry_url" . }}{{ .Values.image.longhorn.instanceManager.repository }}:{{ .Values.image.longhorn.instanceManager.tag }}" |
| 42 | - --share-manager-image |
| 43 | - "{{ template "registry_url" . }}{{ .Values.image.longhorn.shareManager.repository }}:{{ .Values.image.longhorn.shareManager.tag }}" |
| 44 | - --backing-image-manager-image |
| 45 | - "{{ template "registry_url" . }}{{ .Values.image.longhorn.backingImageManager.repository }}:{{ .Values.image.longhorn.backingImageManager.tag }}" |
| 46 | - --support-bundle-manager-image |
| 47 | - "{{ template "registry_url" . }}{{ .Values.image.longhorn.supportBundleKit.repository }}:{{ .Values.image.longhorn.supportBundleKit.tag }}" |
| 48 | - --manager-image |
| 49 | - "{{ template "registry_url" . }}{{ .Values.image.longhorn.manager.repository }}:{{ .Values.image.longhorn.manager.tag }}" |
| 50 | - --service-account |
| 51 | - longhorn-service-account |
| 52 | ports: |
| 53 | - containerPort: 9500 |
| 54 | name: manager |
| 55 | readinessProbe: |
| 56 | tcpSocket: |
| 57 | port: 9500 |
| 58 | volumeMounts: |
| 59 | - name: dev |
| 60 | mountPath: /host/dev/ |
| 61 | - name: proc |
| 62 | mountPath: /host/proc/ |
| 63 | - name: longhorn |
| 64 | mountPath: /var/lib/longhorn/ |
| 65 | mountPropagation: Bidirectional |
| 66 | - name: longhorn-grpc-tls |
| 67 | mountPath: /tls-files/ |
| 68 | env: |
| 69 | - name: POD_NAMESPACE |
| 70 | valueFrom: |
| 71 | fieldRef: |
| 72 | fieldPath: metadata.namespace |
| 73 | - name: POD_IP |
| 74 | valueFrom: |
| 75 | fieldRef: |
| 76 | fieldPath: status.podIP |
| 77 | - name: NODE_NAME |
| 78 | valueFrom: |
| 79 | fieldRef: |
| 80 | fieldPath: spec.nodeName |
| 81 | volumes: |
| 82 | - name: dev |
| 83 | hostPath: |
| 84 | path: /dev/ |
| 85 | - name: proc |
| 86 | hostPath: |
| 87 | path: /proc/ |
| 88 | - name: longhorn |
| 89 | hostPath: |
| 90 | path: /var/lib/longhorn/ |
| 91 | - name: longhorn-grpc-tls |
| 92 | secret: |
| 93 | secretName: longhorn-grpc-tls |
| 94 | optional: true |
| 95 | {{- if .Values.privateRegistry.registrySecret }} |
| 96 | imagePullSecrets: |
| 97 | - name: {{ .Values.privateRegistry.registrySecret }} |
| 98 | {{- end }} |
| 99 | {{- if .Values.longhornManager.priorityClass }} |
| 100 | priorityClassName: {{ .Values.longhornManager.priorityClass | quote }} |
| 101 | {{- end }} |
| 102 | {{- if or .Values.longhornManager.tolerations .Values.global.cattle.windowsCluster.enabled }} |
| 103 | tolerations: |
| 104 | {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.tolerations }} |
| 105 | {{ toYaml .Values.global.cattle.windowsCluster.tolerations | indent 6 }} |
| 106 | {{- end }} |
| 107 | {{- if .Values.longhornManager.tolerations }} |
| 108 | {{ toYaml .Values.longhornManager.tolerations | indent 6 }} |
| 109 | {{- end }} |
| 110 | {{- end }} |
| 111 | {{- if or .Values.longhornManager.nodeSelector .Values.global.cattle.windowsCluster.enabled }} |
| 112 | nodeSelector: |
| 113 | {{- if and .Values.global.cattle.windowsCluster.enabled .Values.global.cattle.windowsCluster.nodeSelector }} |
| 114 | {{ toYaml .Values.global.cattle.windowsCluster.nodeSelector | indent 8 }} |
| 115 | {{- end }} |
| 116 | {{- if .Values.longhornManager.nodeSelector }} |
| 117 | {{ toYaml .Values.longhornManager.nodeSelector | indent 8 }} |
| 118 | {{- end }} |
| 119 | {{- end }} |
| 120 | serviceAccountName: longhorn-service-account |
| 121 | updateStrategy: |
| 122 | rollingUpdate: |
| 123 | maxUnavailable: "100%" |
| 124 | --- |
| 125 | apiVersion: v1 |
| 126 | kind: Service |
| 127 | metadata: |
| 128 | labels: {{- include "longhorn.labels" . | nindent 4 }} |
| 129 | app: longhorn-manager |
| 130 | name: longhorn-backend |
| 131 | namespace: {{ include "release_namespace" . }} |
| 132 | {{- if .Values.longhornManager.serviceAnnotations }} |
| 133 | annotations: |
| 134 | {{ toYaml .Values.longhornManager.serviceAnnotations | indent 4 }} |
| 135 | {{- end }} |
| 136 | spec: |
| 137 | type: {{ .Values.service.manager.type }} |
| 138 | sessionAffinity: ClientIP |
| 139 | selector: |
| 140 | app: longhorn-manager |
| 141 | ports: |
| 142 | - name: manager |
| 143 | port: 9500 |
| 144 | targetPort: manager |
| 145 | {{- if .Values.service.manager.nodePort }} |
| 146 | nodePort: {{ .Values.service.manager.nodePort }} |
| 147 | {{- end }} |