|
| 1 | +kind: Deployment |
| 2 | +apiVersion: apps/v1 |
| 3 | +metadata: |
| 4 | + name: {{ .Values.controller.name }} |
| 5 | + namespace: {{ .Release.Namespace }} |
| 6 | + labels: |
| 7 | + app: {{ .Values.controller.name }} |
| 8 | + {{- include "azurefile.labels" . | nindent 4 }} |
| 9 | +{{- with .Values.controller.labels }} |
| 10 | +{{ . | toYaml | indent 4 }} |
| 11 | +{{- end }} |
| 12 | +{{- with .Values.controller.annotations }} |
| 13 | + annotations: |
| 14 | +{{ . | toYaml | indent 4 }} |
| 15 | +{{- end }} |
| 16 | +spec: |
| 17 | + replicas: {{ .Values.controller.replicas }} |
| 18 | + selector: |
| 19 | + matchLabels: |
| 20 | + {{- include "azurefile.selectorLabels" . | nindent 6 }} |
| 21 | + app: {{ .Values.controller.name }} |
| 22 | + strategy: |
| 23 | + type: {{ .Values.controller.strategyType }} |
| 24 | + template: |
| 25 | + metadata: |
| 26 | + labels: |
| 27 | + {{- include "azurefile.labels" . | nindent 8 }} |
| 28 | + app: {{ .Values.controller.name }} |
| 29 | + {{- if .Values.workloadIdentity.clientID }} |
| 30 | + azure.workload.identity/use: "true" |
| 31 | + {{- end }} |
| 32 | +{{- with .Values.controller.podLabels }} |
| 33 | +{{ toYaml . | indent 8 }} |
| 34 | +{{- end }} |
| 35 | +{{- with .Values.controller.podAnnotations }} |
| 36 | + annotations: |
| 37 | +{{ toYaml . | indent 8 }} |
| 38 | +{{- end }} |
| 39 | + spec: |
| 40 | + hostNetwork: {{ .Values.controller.hostNetwork }} |
| 41 | + serviceAccountName: {{ .Values.serviceAccount.controller }} |
| 42 | + nodeSelector: |
| 43 | + kubernetes.io/os: linux |
| 44 | +{{- with .Values.controller.nodeSelector }} |
| 45 | +{{ toYaml . | indent 8 }} |
| 46 | +{{- end }} |
| 47 | + # runOnControlPlane=true or runOnMaster=true only takes effect if affinity is not set |
| 48 | + {{- if tpl "{{ .Values.controller.affinity }}" . | contains "nodeSelectorTerms" }} |
| 49 | + {{- with .Values.controller.affinity }} |
| 50 | + affinity: |
| 51 | +{{ toYaml . | indent 8 }} |
| 52 | + {{- end }} |
| 53 | + {{- else if or .Values.controller.runOnControlPlane .Values.controller.runOnMaster}} |
| 54 | + affinity: |
| 55 | + nodeAffinity: |
| 56 | + requiredDuringSchedulingIgnoredDuringExecution: |
| 57 | + nodeSelectorTerms: |
| 58 | + - matchExpressions: |
| 59 | + {{- if .Values.controller.runOnControlPlane}} |
| 60 | + - key: node-role.kubernetes.io/control-plane |
| 61 | + operator: Exists |
| 62 | + {{- end}} |
| 63 | + {{- if .Values.controller.runOnMaster}} |
| 64 | + - key: node-role.kubernetes.io/master |
| 65 | + operator: Exists |
| 66 | + {{- end}} |
| 67 | + {{- end }} |
| 68 | + priorityClassName: system-cluster-critical |
| 69 | +{{- with .Values.controller.tolerations }} |
| 70 | + tolerations: |
| 71 | +{{ toYaml . | indent 8 }} |
| 72 | +{{- end }} |
| 73 | + {{- if .Values.imagePullSecrets }} |
| 74 | + imagePullSecrets: |
| 75 | +{{ toYaml .Values.imagePullSecrets | indent 8 }} |
| 76 | + {{- end }} |
| 77 | + containers: |
| 78 | + - name: csi-provisioner |
| 79 | +{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }} |
| 80 | + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" |
| 81 | +{{- else }} |
| 82 | + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" |
| 83 | +{{- end }} |
| 84 | + args: |
| 85 | + - "-v=2" |
| 86 | + - "--csi-address=$(ADDRESS)" |
| 87 | + - "--leader-election" |
| 88 | + - "--leader-election-namespace={{ .Release.Namespace }}" |
| 89 | + - "--timeout=1200s" |
| 90 | + - "--extra-create-metadata=true" |
| 91 | + - "--kube-api-qps=50" |
| 92 | + - "--kube-api-burst=100" |
| 93 | + - "--feature-gates=HonorPVReclaimPolicy=true" |
| 94 | + - "--retry-interval-max=30m" |
| 95 | + env: |
| 96 | + - name: ADDRESS |
| 97 | + value: /csi/csi.sock |
| 98 | + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} |
| 99 | + volumeMounts: |
| 100 | + - mountPath: /csi |
| 101 | + name: socket-dir |
| 102 | + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} |
| 103 | + - name: csi-snapshotter |
| 104 | +{{- if hasPrefix "/" .Values.snapshot.image.csiSnapshotter.repository }} |
| 105 | + image: "{{ .Values.image.baseRepo }}{{ .Values.snapshot.image.csiSnapshotter.repository }}:{{ .Values.snapshot.image.csiSnapshotter.tag }}" |
| 106 | +{{- else }} |
| 107 | + image: "{{ .Values.snapshot.image.csiSnapshotter.repository }}:{{ .Values.snapshot.image.csiSnapshotter.tag }}" |
| 108 | +{{- end }} |
| 109 | + args: |
| 110 | + - "-csi-address=$(ADDRESS)" |
| 111 | + - "-leader-election" |
| 112 | + - "--leader-election-namespace={{ .Release.Namespace }}" |
| 113 | + - "-v=2" |
| 114 | + - "--retry-interval-max=30m" |
| 115 | + env: |
| 116 | + - name: ADDRESS |
| 117 | + value: /csi/csi.sock |
| 118 | + volumeMounts: |
| 119 | + - name: socket-dir |
| 120 | + mountPath: /csi |
| 121 | + resources: {{- toYaml .Values.controller.resources.csiSnapshotter | nindent 12 }} |
| 122 | + securityContext: |
| 123 | + capabilities: |
| 124 | + drop: |
| 125 | + - ALL |
| 126 | + - name: csi-resizer |
| 127 | +{{- if hasPrefix "/" .Values.image.csiResizer.repository }} |
| 128 | + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" |
| 129 | +{{- else }} |
| 130 | + image: "{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" |
| 131 | +{{- end }} |
| 132 | + args: |
| 133 | + - "-csi-address=$(ADDRESS)" |
| 134 | + - "-v=2" |
| 135 | + - "-leader-election" |
| 136 | + - "--leader-election-namespace={{ .Release.Namespace }}" |
| 137 | + - '-handle-volume-inuse-error=false' |
| 138 | + - '-timeout=120s' |
| 139 | + - '-feature-gates=RecoverVolumeExpansionFailure=true' |
| 140 | + - "--retry-interval-max=30m" |
| 141 | + env: |
| 142 | + - name: ADDRESS |
| 143 | + value: /csi/csi.sock |
| 144 | + imagePullPolicy: {{ .Values.image.csiResizer.pullPolicy }} |
| 145 | + volumeMounts: |
| 146 | + - name: socket-dir |
| 147 | + mountPath: /csi |
| 148 | + resources: {{- toYaml .Values.controller.resources.csiResizer | nindent 12 }} |
| 149 | + securityContext: |
| 150 | + capabilities: |
| 151 | + drop: |
| 152 | + - ALL |
| 153 | + - name: liveness-probe |
| 154 | +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} |
| 155 | + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" |
| 156 | +{{- else }} |
| 157 | + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" |
| 158 | +{{- end }} |
| 159 | + args: |
| 160 | + - --csi-address=/csi/csi.sock |
| 161 | + - --probe-timeout=3s |
| 162 | +{{- if eq .Values.controller.hostNetwork true }} |
| 163 | + - --http-endpoint=localhost:{{ .Values.controller.livenessProbe.healthPort }} |
| 164 | +{{- else }} |
| 165 | + - --health-port={{ .Values.controller.livenessProbe.healthPort }} |
| 166 | +{{- end }} |
| 167 | + - --v=2 |
| 168 | + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} |
| 169 | + volumeMounts: |
| 170 | + - name: socket-dir |
| 171 | + mountPath: /csi |
| 172 | + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} |
| 173 | + securityContext: |
| 174 | + capabilities: |
| 175 | + drop: |
| 176 | + - ALL |
| 177 | + - name: azurefile |
| 178 | +{{- if hasPrefix "/" .Values.image.azurefile.repository }} |
| 179 | + image: "{{ .Values.image.baseRepo }}{{ .Values.image.azurefile.repository }}:{{ .Values.image.azurefile.tag }}" |
| 180 | +{{- else }} |
| 181 | + image: "{{ .Values.image.azurefile.repository }}:{{ .Values.image.azurefile.tag }}" |
| 182 | +{{- end }} |
| 183 | + args: |
| 184 | + - "--v={{ .Values.controller.logLevel }}" |
| 185 | + - "--endpoint=$(CSI_ENDPOINT)" |
| 186 | + - "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}" |
| 187 | + - "--kubeconfig={{ .Values.controller.kubeconfig }}" |
| 188 | + - "--drivername={{ .Values.driver.name }}" |
| 189 | + - "--cloud-config-secret-name={{ .Values.controller.cloudConfigSecretName }}" |
| 190 | + - "--cloud-config-secret-namespace={{ .Values.controller.cloudConfigSecretNamespace }}" |
| 191 | + - "--custom-user-agent={{ .Values.driver.customUserAgent }}" |
| 192 | + - "--user-agent-suffix={{ .Values.driver.userAgentSuffix }}" |
| 193 | + - "--allow-empty-cloud-config={{ .Values.controller.allowEmptyCloudConfig }}" |
| 194 | + ports: |
| 195 | + - containerPort: {{ .Values.controller.metricsPort }} |
| 196 | + name: metrics |
| 197 | + protocol: TCP |
| 198 | +{{- if ne .Values.controller.hostNetwork true }} |
| 199 | + - containerPort: {{ .Values.controller.livenessProbe.healthPort }} |
| 200 | + name: healthz |
| 201 | + protocol: TCP |
| 202 | +{{- end }} |
| 203 | + livenessProbe: |
| 204 | + failureThreshold: 5 |
| 205 | + httpGet: |
| 206 | + path: /healthz |
| 207 | +{{- if eq .Values.controller.hostNetwork true }} |
| 208 | + host: localhost |
| 209 | + port: {{ .Values.controller.livenessProbe.healthPort }} |
| 210 | +{{- else }} |
| 211 | + port: healthz |
| 212 | +{{- end }} |
| 213 | + initialDelaySeconds: 30 |
| 214 | + timeoutSeconds: 10 |
| 215 | + periodSeconds: 30 |
| 216 | + env: |
| 217 | + - name: AZURE_CREDENTIAL_FILE |
| 218 | + valueFrom: |
| 219 | + configMapKeyRef: |
| 220 | + name: {{ .Values.azureCredentialFileConfigMap }} |
| 221 | + key: path |
| 222 | + optional: true |
| 223 | + - name: CSI_ENDPOINT |
| 224 | + value: unix:///csi/csi.sock |
| 225 | + {{- if ne .Values.driver.httpsProxy "" }} |
| 226 | + - name: HTTPS_PROXY |
| 227 | + value: {{ .Values.driver.httpsProxy }} |
| 228 | + {{- end }} |
| 229 | + {{- if ne .Values.driver.httpProxy "" }} |
| 230 | + - name: HTTP_PROXY |
| 231 | + value: {{ .Values.driver.httpProxy }} |
| 232 | + {{- end }} |
| 233 | + - name: AZURE_GO_SDK_LOG_LEVEL |
| 234 | + value: {{ .Values.driver.azureGoSDKLogLevel }} |
| 235 | + - name: AZCOPY_CONCURRENCY_VALUE |
| 236 | + value: "10" |
| 237 | + - name: AZCOPY_CONCURRENT_FILES |
| 238 | + value: "20" |
| 239 | + - name: AZCOPY_BUFFER_GB |
| 240 | + value: "1" |
| 241 | + imagePullPolicy: {{ .Values.image.azurefile.pullPolicy }} |
| 242 | + volumeMounts: |
| 243 | + - mountPath: /csi |
| 244 | + name: socket-dir |
| 245 | + - mountPath: /root/.azcopy |
| 246 | + name: azcopy-dir |
| 247 | + - mountPath: /etc/kubernetes/ |
| 248 | + name: azure-cred |
| 249 | + {{- if eq .Values.linux.distro "fedora" }} |
| 250 | + - name: ssl |
| 251 | + mountPath: /etc/ssl/certs |
| 252 | + readOnly: true |
| 253 | + - name: ssl-pki |
| 254 | + mountPath: /etc/pki/ca-trust/extracted |
| 255 | + readOnly: true |
| 256 | + {{- end }} |
| 257 | + resources: {{- toYaml .Values.controller.resources.azurefile | nindent 12 }} |
| 258 | + securityContext: |
| 259 | + capabilities: |
| 260 | + drop: |
| 261 | + - ALL |
| 262 | + volumes: |
| 263 | + - name: socket-dir |
| 264 | + emptyDir: {} |
| 265 | + - name: azcopy-dir |
| 266 | + emptyDir: {} |
| 267 | + - name: azure-cred |
| 268 | + hostPath: |
| 269 | + path: /etc/kubernetes/ |
| 270 | + type: DirectoryOrCreate |
| 271 | + {{- if eq .Values.linux.distro "fedora" }} |
| 272 | + - name: ssl |
| 273 | + hostPath: |
| 274 | + path: /etc/ssl/certs |
| 275 | + - name: ssl-pki |
| 276 | + hostPath: |
| 277 | + path: /etc/pki/ca-trust/extracted |
| 278 | + {{- end }} |
0 commit comments