|
| 1 | +--- |
| 2 | +kind: Deployment |
| 3 | +apiVersion: apps/v1 |
| 4 | +metadata: |
| 5 | + name: {{ .Values.controller.name }} |
| 6 | + namespace: {{ .Release.Namespace }} |
| 7 | +{{ include "nfs.labels" . | indent 2 }} |
| 8 | +spec: |
| 9 | + replicas: {{ .Values.controller.replicas }} |
| 10 | + selector: |
| 11 | + matchLabels: |
| 12 | + app: {{ .Values.controller.name }} |
| 13 | + template: |
| 14 | + metadata: |
| 15 | +{{ include "nfs.labels" . | indent 6 }} |
| 16 | + app: {{ .Values.controller.name }} |
| 17 | + spec: |
| 18 | + {{- if .Values.imagePullSecrets }} |
| 19 | + imagePullSecrets: |
| 20 | +{{ toYaml .Values.imagePullSecrets | indent 8 }} |
| 21 | + {{- end }} |
| 22 | + hostNetwork: true # controller also needs to mount nfs to create dir |
| 23 | + dnsPolicy: ClusterFirstWithHostNet |
| 24 | + serviceAccountName: {{ .Values.serviceAccount.controller }} |
| 25 | + nodeSelector: |
| 26 | + kubernetes.io/os: linux |
| 27 | + {{- if .Values.controller.runOnMaster}} |
| 28 | + kubernetes.io/role: master |
| 29 | + {{- end}} |
| 30 | + priorityClassName: system-cluster-critical |
| 31 | +{{- with .Values.controller.tolerations }} |
| 32 | + tolerations: |
| 33 | +{{ toYaml . | indent 8 }} |
| 34 | +{{- end }} |
| 35 | + containers: |
| 36 | + - name: csi-provisioner |
| 37 | + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" |
| 38 | + args: |
| 39 | + - "-v=2" |
| 40 | + - "--csi-address=$(ADDRESS)" |
| 41 | + - "--leader-election" |
| 42 | + env: |
| 43 | + - name: ADDRESS |
| 44 | + value: /csi/csi.sock |
| 45 | + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} |
| 46 | + volumeMounts: |
| 47 | + - mountPath: /csi |
| 48 | + name: socket-dir |
| 49 | + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} |
| 50 | + - name: liveness-probe |
| 51 | + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" |
| 52 | + args: |
| 53 | + - --csi-address=/csi/csi.sock |
| 54 | + - --probe-timeout=3s |
| 55 | + - --health-port={{ .Values.controller.livenessProbe.healthPort }} |
| 56 | + - --v=2 |
| 57 | + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} |
| 58 | + volumeMounts: |
| 59 | + - name: socket-dir |
| 60 | + mountPath: /csi |
| 61 | + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} |
| 62 | + - name: nfs |
| 63 | + image: "{{ .Values.image.nfs.repository }}:{{ .Values.image.nfs.tag }}" |
| 64 | + securityContext: |
| 65 | + privileged: true |
| 66 | + capabilities: |
| 67 | + add: ["SYS_ADMIN"] |
| 68 | + allowPrivilegeEscalation: true |
| 69 | + imagePullPolicy: {{ .Values.image.nfs.pullPolicy }} |
| 70 | + args: |
| 71 | + - "--v={{ .Values.controller.logLevel }}" |
| 72 | + - "--nodeid=$(NODE_ID)" |
| 73 | + - "--endpoint=$(CSI_ENDPOINT)" |
| 74 | + - "--drivername={{ .Values.driver.name }}" |
| 75 | + env: |
| 76 | + - name: NODE_ID |
| 77 | + valueFrom: |
| 78 | + fieldRef: |
| 79 | + fieldPath: spec.nodeName |
| 80 | + - name: CSI_ENDPOINT |
| 81 | + value: unix:///csi/csi.sock |
| 82 | + ports: |
| 83 | + - containerPort: {{ .Values.controller.livenessProbe.healthPort }} |
| 84 | + name: healthz |
| 85 | + protocol: TCP |
| 86 | + livenessProbe: |
| 87 | + failureThreshold: 5 |
| 88 | + httpGet: |
| 89 | + path: /healthz |
| 90 | + port: healthz |
| 91 | + initialDelaySeconds: 30 |
| 92 | + timeoutSeconds: 10 |
| 93 | + periodSeconds: 30 |
| 94 | + volumeMounts: |
| 95 | + - name: pods-mount-dir |
| 96 | + mountPath: /var/lib/kubelet/pods |
| 97 | + mountPropagation: "Bidirectional" |
| 98 | + - mountPath: /csi |
| 99 | + name: socket-dir |
| 100 | + resources: {{- toYaml .Values.controller.resources.nfs | nindent 12 }} |
| 101 | + volumes: |
| 102 | + - name: pods-mount-dir |
| 103 | + hostPath: |
| 104 | + path: /var/lib/kubelet/pods |
| 105 | + type: Directory |
| 106 | + - name: socket-dir |
| 107 | + emptyDir: {} |
0 commit comments