rancher-partner-charts/charts/dell/csi-powermax/2.10.1/templates/controller.yaml

510 lines
20 KiB
YAML

apiVersion: v1
kind: ServiceAccount
metadata:
name: {{.Release.Name}}-controller
namespace: {{ .Release.Namespace }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
{{- if eq .Values.customDriverName.enabled true}}
name: {{printf "%s-%s-controller" .Release.Namespace .Values.customDriverName.value}}
{{- else }}
name: {{ .Release.Name }}-controller
{{- end }}
rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete", "update", "patch" ]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["create", "delete", "get", "list", "watch", "update", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims/status"]
verbs: ["update", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update", "patch" ]
- apiGroups: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments/status"]
verbs: ["patch"]
- apiGroups: ["csi.storage.k8s.io"]
resources: ["csinodeinfos"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
# below for snapshotter
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["get", "list", "watch", "update", "create", "delete", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents/status"]
verbs: ["update", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots", "volumesnapshots/status"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["create", "list", "watch", "delete"]
# below for dell-csi-replicator
{{- if eq .Values.replication.enabled true}}
- apiGroups: ["replication.storage.dell.com"]
resources: ["dellcsireplicationgroups"]
verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
- apiGroups: ["replication.storage.dell.com"]
resources: ["dellcsireplicationgroups/status"]
verbs: ["get", "patch", "update"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["create", "delete", "get", "list", "watch", "update", "patch"]
{{- end}}
# below for dell-csi-migrator
{{- if eq .Values.migration.enabled true}}
- apiGroups: [ "replication.storage.dell.com" ]
resources: [ "dellcsimigrationgroups" ]
verbs: [ "create", "delete", "get", "list", "patch", "update", "watch" ]
- apiGroups: [ "replication.storage.dell.com" ]
resources: [ "dellcsimigrationgroups/status" ]
verbs: [ "get", "patch", "update" ]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["create", "delete", "get", "list", "watch", "update", "patch"]
{{- end}}
# Permissions for Storage Capacity
{{- if eq (include "csi-powermax.isStorageCapacitySupported" .) "true" }}
- apiGroups: ["storage.k8s.io"]
resources: ["csistoragecapacities"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get"]
{{- end }}
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
{{- if eq .Values.customDriverName.enabled true}}
name: {{ printf "%s-%s-controller" .Release.Namespace .Values.customDriverName.value }}
{{- else }}
name: {{ .Release.Name }}-controller
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-controller
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
{{- if eq .Values.customDriverName.enabled true}}
name: {{ printf "%s-%s-controller" .Release.Namespace .Values.customDriverName.value }}
{{- else }}
name: {{ .Release.Name }}-controller
{{- end }}
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-controller
namespace: {{ .Release.Namespace }}
{{- if hasKey .Values "authorization" }}
{{- if eq .Values.authorization.enabled true }}
annotations:
com.dell.karavi-authorization-proxy: "true"
{{ end }}
{{ end }}
spec:
replicas: {{ required "Must provide the number of controller instances to create." .Values.controller.controllerCount }}
selector:
matchLabels:
name: {{ .Release.Name }}-controller
template:
metadata:
labels:
name: {{ .Release.Name }}-controller
spec:
{{ if .Values.controller.nodeSelector }}
nodeSelector:
{{- toYaml .Values.controller.nodeSelector | nindent 8 }}
{{ end }}
{{ if .Values.controller.tolerations }}
tolerations:
{{- toYaml .Values.controller.tolerations | nindent 6 }}
{{ end }}
serviceAccountName: {{ .Release.Name }}-controller
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: name
operator: In
values:
- {{ .Release.Name }}-controller
topologyKey: kubernetes.io/hostname
containers:
- name: attacher
image: {{ required "Must provide the CSI attacher container image." .Values.images.attacher }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- "--csi-address=$(ADDRESS)"
- "--v=5"
- "--timeout=180s"
- "--worker-threads=6"
- "--leader-election"
env:
- name: ADDRESS
value: /var/run/csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
- name: provisioner
image: {{ required "Must provide the CSI provisioner container image." .Values.images.provisioner }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- "--csi-address=$(ADDRESS)"
- "--volume-name-prefix={{ required "Must provide a Volume Name Prefix." .Values.controller.volumeNamePrefix }}"
- "--volume-name-uuid-length=10"
- "--timeout=180s"
- "--worker-threads=6"
- "--v=5"
- "--default-fstype={{ .Values.defaultFsType | default "ext4" }}"
- "--leader-election"
- "--extra-create-metadata"
- "--feature-gates=Topology=true"
- "--enable-capacity={{ (include "csi-powermax.isStorageCapacitySupported" .) | default false }}"
- "--capacity-ownerref-level=2"
- "--capacity-poll-interval={{ .Values.storageCapacity.pollInterval | default "5m" }}"
env:
- name: ADDRESS
value: /var/run/csi/csi.sock
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
{{- if hasKey .Values.controller "snapshot" }}
{{- if eq .Values.controller.snapshot.enabled true }}
- name: snapshotter
image: {{ required "Must provide the CSI snapshotter container image." .Values.images.snapshotter }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- "--csi-address=$(ADDRESS)"
- "--v=5"
- "--snapshot-name-prefix={{ required "Must provide a Snapshot Name Prefix" .Values.controller.snapshot.snapNamePrefix }}"
- "--snapshot-name-uuid-length=10"
- "--timeout=180s"
- "--leader-election"
env:
- name: ADDRESS
value: /var/run/csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
{{- end }}
{{- end }}
{{- if eq .Values.replication.enabled true}}
- name: dell-csi-replicator
image: {{ required "Must provide the Dell CSI Replicator Resizer image." .Values.images.replication }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- "--csi-address=$(ADDRESS)"
- "--leader-election=true"
- "--worker-threads=2"
- "--retry-interval-start=1s"
- "--retry-interval-max=300s"
- "--timeout=300s"
- "--context-prefix={{ .Values.replication.replicationContextPrefix}}"
- "--prefix={{ .Values.replication.replicationPrefix}}"
env:
- name: ADDRESS
value: /var/run/csi/csi.sock
- name: X_CSI_REPLICATION_CONFIG_DIR
value: /powermax-config-params
- name: X_CSI_REPLICATION_CONFIG_FILE_NAME
value: driver-config-params.yaml
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
- name: powermax-config-params
mountPath: /powermax-config-params
{{- end }}
{{- if eq .Values.migration.enabled true}}
- name: dell-csi-migrator
image: {{ required "Must provide the Dell CSI Migrator Resizer image." .Values.images.migration }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- "--csi-address=$(ADDRESS)"
- "--leader-election=true"
- "--worker-threads=2"
- "--retry-interval-start=1s"
- "--retry-interval-max=300s"
- "--timeout=300s"
- "--prefix={{ .Values.migration.migrationPrefix}}"
env:
- name: ADDRESS
value: /var/run/csi/csi.sock
- name: X_CSI_REPLICATION_CONFIG_DIR
value: /powermax-config-params
- name: X_CSI_REPLICATION_CONFIG_FILE_NAME
value: driver-config-params.yaml
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
- name: powermax-config-params
mountPath: /powermax-config-params
{{- end }}
{{- if hasKey .Values.controller "resizer" }}
{{- if eq .Values.controller.resizer.enabled true }}
- name: resizer
image: {{ required "Must provide the CSI resizer container image." .Values.images.resizer }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- "--csi-address=$(ADDRESS)"
- "--timeout=180s"
- "--v=5"
- "--leader-election"
env:
- name: ADDRESS
value: /var/run/csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
{{- end }}
{{- end }}
{{- if hasKey .Values "authorization" }}
{{- if eq .Values.authorization.enabled true }}
- name: karavi-authorization-proxy
imagePullPolicy: {{ .Values.imagePullPolicy }}
image: {{ required "Must provide the authorization sidecar container image." .Values.images.authorization }}
env:
- name: PROXY_HOST
value: "{{ .Values.authorization.proxyHost }}"
- name: SKIP_CERTIFICATE_VALIDATION
value: "{{ .Values.authorization.skipCertificateValidation }}"
- name: PLUGIN_IDENTIFIER
value: powermax
- name: ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: proxy-authz-tokens
key: access
- name: REFRESH_TOKEN
valueFrom:
secretKeyRef:
name: proxy-authz-tokens
key: refresh
volumeMounts:
- name: karavi-authorization-config
mountPath: /etc/karavi-authorization/config
- name: proxy-server-root-certificate
mountPath: /etc/karavi-authorization/root-certificates
- name: powermax-config-params
mountPath: /etc/karavi-authorization
{{- end }}
{{- end }}
{{- if hasKey .Values.controller "healthMonitor" }}
{{- if eq .Values.controller.healthMonitor.enabled true }}
- name: csi-external-health-monitor-controller
imagePullPolicy: {{ .Values.imagePullPolicy }}
image: {{ required "Must provide the CSI external health monitor controller image." .Values.images.healthmonitor }}
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
- "--leader-election"
- "--http-endpoint=:8080"
- "--enable-node-watcher=true"
- "--monitor-interval={{ .Values.controller.healthMonitor.interval | default "60s" }}"
- "--timeout=180s"
env:
- name: ADDRESS
value: /var/run/csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
{{- end }}
{{- end }}
- name: driver
image: {{ required "Must provide the PowerMax driver image repository." .Values.images.driver }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
command: [ "/csi-powermax.sh" ]
env:
{{- $_ := first .Values.global.storageArrays }}
{{- $arraysStr := "" }}
{{- range $i, $array := .Values.global.storageArrays }}
{{- $arraysStr = trim (cat $arraysStr $array.storageArrayId) }}
{{- end }}
- name: X_CSI_POWERMAX_DRIVER_NAME
{{- if eq .Values.customDriverName.enabled true}}
value: {{ required "Must provide a driver name" (printf "%s.%s.dellemc.com" .Release.Namespace .Values.customDriverName.value) }}
{{- else }}
value: csi-powermax.dellemc.com
{{- end }}
- name: CSI_ENDPOINT
value: /var/run/csi/csi.sock
- name: X_CSI_MODE
value: controller
- name: X_CSI_MANAGED_ARRAYS
value: {{ $arraysStr | replace " " "," | quote }}
- name: X_CSI_POWERMAX_USER
valueFrom:
secretKeyRef:
name: {{ .Values.global.defaultCredentialsSecret }}
key: username
- name: X_CSI_POWERMAX_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.global.defaultCredentialsSecret }}
key: password
- name: X_CSI_POWERMAX_CONFIG_PATH
value: /powermax-config-params/driver-config-params.yaml
- name: X_CSI_POWERMAX_DEBUG
value: {{ .Values.powerMaxDebug | default "false" | lower | quote }}
- name: X_CSI_POWERMAX_SKIP_CERTIFICATE_VALIDATION
value: {{ .Values.skipCertificateValidation | default "true" | lower | quote }}
{{- if eq .Values.csireverseproxy.deployAsSidecar true }}
- name: X_CSI_POWERMAX_SIDECAR_PROXY_PORT
value: {{ .Values.csireverseproxy.port | quote }}
{{- else }}
- name: X_CSI_POWERMAX_PROXY_SERVICE_NAME
value: {{ .Release.Name }}-reverseproxy
{{- end }}
- name: X_CSI_POWERMAX_PORTGROUPS
value: {{ .Values.portGroups | toJson }}
- name: X_CSI_K8S_CLUSTER_PREFIX
value: {{ required "Must provide a Cluster Prefix." .Values.clusterPrefix }}
- name: X_CSI_GRPC_MAX_THREADS
value: "50"
- name: X_CSI_TRANSPORT_PROTOCOL
value: {{ .Values.transportProtocol | default "" }}
- name: SSL_CERT_DIR
value: /certs
- name: X_CSI_IG_NODENAME_TEMPLATE
value: {{ .Values.nodeNameTemplate | default "" }}
- name: X_CSI_IG_MODIFY_HOSTNAME
value: {{ .Values.modifyHostName | default "false" | lower | quote }}
- name: X_CSI_REPLICATION_CONTEXT_PREFIX
value: {{ .Values.replication.replicationContextPrefix | default "powermax"}}
- name: X_CSI_REPLICATION_PREFIX
value: {{ .Values.replication.replicationPrefix | default "replication.storage.dell.com"}}
- name: X_CSI_MIGRATION_PREFIX
value: {{ .Values.migration.migrationPrefix | default "migration.storage.dell.com"}}
- name: X_CSI_UNISPHERE_TIMEOUT
value: {{.Values.unisphereTimeout | default "5m"}}
{{- if hasKey .Values.controller "healthMonitor" }}
{{- if eq .Values.controller.healthMonitor.enabled true }}
- name: X_CSI_HEALTH_MONITOR_ENABLED
value: "{{ .Values.controller.healthMonitor.enabled }}"
{{- end }}
{{- end }}
- name: X_CSI_VSPHERE_ENABLED
value: "{{ .Values.vSphere.enabled }}"
{{- if eq .Values.vSphere.enabled true }}
- name: X_CSI_VSPHERE_PORTGROUP
value: {{ required "Must provide portgroup for vsphere" .Values.vSphere.fcPortGroup }}
- name: X_CSI_VSPHERE_HOSTNAME
value: {{ required "Must provide host group for vsphere" .Values.vSphere.fcHostName }}
- name: X_CSI_VCENTER_HOST
value: {{ required "Must provide host url for vsphere" .Values.vSphere.vCenterHost }}
- name: X_CSI_VCENTER_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.vSphere.vCenterCredSecret }}
key: username
- name: X_CSI_VCENTER_PWD
valueFrom:
secretKeyRef:
name: {{ .Values.vSphere.vCenterCredSecret }}
key: password
{{- end }}
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
- name: certs
mountPath: /certs
readOnly: true
- name: powermax-config-params
mountPath: /powermax-config-params
{{- if eq .Values.csireverseproxy.deployAsSidecar true }}
- name: reverseproxy
image: {{ required "Must provided an image for reverseproxy container." .Values.images.csireverseproxy }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
env:
- name: X_CSI_REVPROXY_CONFIG_DIR
value: /etc/config/configmap
- name: X_CSI_REVPROXY_CONFIG_FILE_NAME
value: config.yaml
- name: X_CSI_REVRPOXY_IN_CLUSTER
value: "true"
- name: X_CSI_REVPROXY_TLS_CERT_DIR
value: /app/tls
- name: X_CSI_REVPROXY_WATCH_NAMESPACE
value: {{ .Release.Namespace }}
volumeMounts:
- name: configmap-volume
mountPath: /etc/config/configmap
- name: tls-secret
mountPath: /app/tls
- name: cert-dir
mountPath: /app/certs
{{- end }}
volumes:
- name: socket-dir
emptyDir:
- name: certs
secret:
secretName: {{ .Release.Name }}-certs
optional: true
- name: configmap-volume
configMap:
name: {{ .Release.Name }}-reverseproxy-config
optional: true
- name: tls-secret
secret:
secretName: {{ .Values.csireverseproxy.tlsSecret }}
- name: cert-dir
emptyDir:
- name: powermax-config-params
configMap:
name: {{ .Release.Name }}-config-params
{{- if hasKey .Values "authorization" }}
{{- if eq .Values.authorization.enabled true }}
- name: karavi-authorization-config
secret:
secretName: karavi-authorization-config
- name: proxy-server-root-certificate
secret:
secretName: proxy-server-root-certificate
{{ end }}
{{ end }}