diff --git a/mirantis/vsphere-csi-driver/.helmignore b/mirantis/vsphere-csi-driver/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/mirantis/vsphere-csi-driver/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/mirantis/vsphere-csi-driver/Chart.yaml b/mirantis/vsphere-csi-driver/Chart.yaml new file mode 100644 index 0000000..b613cca --- /dev/null +++ b/mirantis/vsphere-csi-driver/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: vsphere-csi-driver +description: A Helm chart for Container Storage Interface (CSI) driver for vSphere + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.0.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "3.3.1" diff --git a/mirantis/vsphere-csi-driver/README.md b/mirantis/vsphere-csi-driver/README.md new file mode 100644 index 0000000..2bfd938 --- /dev/null +++ b/mirantis/vsphere-csi-driver/README.md @@ -0,0 +1,53 @@ +# vSphere CSI Driver + +A Helm chart for Container Storage Interface (CSI) driver for vSphere + +This chart is based on the official [vsphere csi driver vanilla manifest](https://github.com/kubernetes-sigs/vsphere-csi-driver/blob/master/manifests/vanilla/vsphere-csi-driver.yaml). + +The default storage class can be created via `defaultStorageClass.enabled` +option. + +You can also create the +[configuration](https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/2.0/vmware-vsphere-csp-getting-started/GUID-BFF39F1D-F70A-4360-ABC9-85BDAFBE8864.html) +secret by setting `vcenterConfig.enabled` to true and passing all the rest +values under `vcenterConfig`. + + +## Values + +| Key | Type | Default | Description | +|------------------------------------------|--------|-----------------------------------------------------------|------------------------------------------------------------------------------------| +| controller.nodeAffinity | map | | Controller's node affinity | +| controller.replicas | int | `1` | Number of replicas for controller's deployment | +| controller.tolerations | map | | Controller's tolerations | +| defaultStorageClass.allowVolumeExpansion | bool | `true` | Allow volume expansion for a default storage class | +| defaultStorageClass.enabled | bool | `false` | Create default storage class | +| defaultStorageClass.name | string | `"vsphere-csi"` | Name of the default storage class | +| images.csiAttacher.repo | string | `"registry.k8s.io/sig-storage/csi-attacher"` | Repo for the CSI attacher | +| images.csiAttacher.tag | string | `"v4.5.1"` | Tag for the CSI attacher | +| images.csiProvisioner.repo | string | `"registry.k8s.io/sig-storage/csi-provisioner"` | Repo for the CSI provisioner | +| images.csiProvisioner.tag | string | `"v4.0.1"` | Tag for the CSI provisioner | +| images.csiResizer.repo | string | `"registry.k8s.io/sig-storage/csi-resizer"` | Repo for the CSI resizer | +| images.csiResizer.tag | string | `"v1.10.1"` | Tag for the CSI resizer | +| images.csiSnapshotter.repo | string | `"registry.k8s.io/sig-storage/csi-snapshotter"` | Repo for the CSI snapshotter | +| images.csiSnapshotter.tag | string | `"v7.0.2"` | Tag for the CSI snapshotter | +| images.driver.repo | string | `"gcr.io/cloud-provider-vsphere/csi/release/driver"` | Repo for the vcenter CSI provider driver | +| images.driver.tag | string | `"v3.3.1"` | Tag for the vcenter CSI provider driver | +| images.livenessProbe.repo | string | `"registry.k8s.io/sig-storage/livenessprobe"` | Repo for the livenessprobe | +| images.livenessProbe.tag | string | `"v2.12.0"` | Tag for the livenessprobe | +| images.nodeDriverRegistrar.repo | string | `"registry.k8s.io/sig-storage/csi-node-driver-registrar"` | Repo for the CSI driver registrar | +| images.nodeDriverRegistrar.tag | string | `"v2.10.1"` | Tag for the CSI driver registrar | +| images.syncer.repo | string | `"gcr.io/cloud-provider-vsphere/csi/release/syncer"` | Repo for the vcenter CSI provider syncer | +| images.syncer.tag | string | `"v3.3.1"` | Tag for the vcenter CSI provider syncer | +| node.kubeletPath | string | `"/var/lib/kubelet"` | Kubelet path on the node | +| node.tolerations | map | | Node provisioner tolerations | +| vcenterConfig.clusterID | string | `""` | The unique cluster identifier | +| vcenterConfig.datacenters | string | `""` | List of all comma separated datacenter paths where Kubernetes node VMs are present | +| vcenterConfig.enabled | bool | `false` | Create vcenter config secret | +| vcenterConfig.insecure | string | `"true"` | Set to true if you use self-signed certificate | +| vcenterConfig.password | string | `""` | Password for a vCenter Server user | +| vcenterConfig.port | string | `"443"` | vCenter Server port. | +| vcenterConfig.secretName | string | `"vcenter-config-secret"` | Name of the vcenter config secret | +| vcenterConfig.thumbprint | string | `""` | The certificate thumbprint (optional) | +| vcenterConfig.user | string | `""` | The vCenter Server username | +| vcenterConfig.vcenter | string | `""` | IP or FQDN of the vcenter instance | diff --git a/mirantis/vsphere-csi-driver/templates/_helpers.tpl b/mirantis/vsphere-csi-driver/templates/_helpers.tpl new file mode 100644 index 0000000..b6d6059 --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/_helpers.tpl @@ -0,0 +1,74 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "vsphere-csi-driver.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{- define "vsphere-csi-driver.controller.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}-controller +{{- end }} + +{{- define "vsphere-csi-driver.node.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}-node +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "vsphere-csi-driver.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} + +{{- define "vsphere-csi-driver.controller.fullname" -}} +{{ include "vsphere-csi-driver.fullname" . }}-controller +{{- end }} + +{{- define "vsphere-csi-driver.node.fullname" -}} +{{ include "vsphere-csi-driver.fullname" . }}-node +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "vsphere-csi-driver.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "vsphere-csi-driver.labels" -}} +helm.sh/chart: {{ include "vsphere-csi-driver.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + + +{{- define "vsphere-csi-driver.controller.selectorLabels" -}} +app.kubernetes.io/name: {{ include "vsphere-csi-driver.controller.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "vsphere-csi-driver.node.selectorLabels" -}} +app.kubernetes.io/name: {{ include "vsphere-csi-driver.node.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "vsphere-csi-driver.controller.serviceAccountName" -}} +{{ include "vsphere-csi-driver.controller.fullname" . }} +{{- end }} + +{{- define "vsphere-csi-driver.node.serviceAccountName" -}} +{{ include "vsphere-csi-driver.node.fullname" . }} +{{- end }} diff --git a/mirantis/vsphere-csi-driver/templates/config-secret.yaml b/mirantis/vsphere-csi-driver/templates/config-secret.yaml new file mode 100644 index 0000000..d34f799 --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/config-secret.yaml @@ -0,0 +1,22 @@ +{{- if .Values.vcenterConfig.enabled }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Values.vcenterConfig.secretName }} + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +stringData: + csi-vsphere.conf: | + [Global] + cluster-id = "{{ .Values.vcenterConfig.clusterID }}" + {{- if .Values.vcenterConfig.thumbprint }} + thumbprint = "{{ .Values.vcenterConfig.thumbprint }}" + {{- end }} + + [VirtualCenter "{{ .Values.vcenterConfig.vcenter }}"] + insecure-flag = "{{ .Values.vcenterConfig.insecure }}" + user = "{{ .Values.vcenterConfig.user }}" + password = "{{ .Values.vcenterConfig.password }}" + port = "{{ .Values.vcenterConfig.port }}" + datacenters = "{{ .Values.vcenterConfig.datacenters }}" +{{- end }} diff --git a/mirantis/vsphere-csi-driver/templates/controller-deploy.yaml b/mirantis/vsphere-csi-driver/templates/controller-deploy.yaml new file mode 100644 index 0000000..6171546 --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/controller-deploy.yaml @@ -0,0 +1,223 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ include "vsphere-csi-driver.controller.fullname" . }} + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.controller.replicas }} + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 + maxSurge: 0 + selector: + matchLabels: + {{- include "vsphere-csi-driver.controller.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "vsphere-csi-driver.controller.selectorLabels" . | nindent 8 }} + spec: + priorityClassName: system-cluster-critical # Guarantees scheduling for critical system pods + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - {{ include "vsphere-csi-driver.controller.name" . }} + topologyKey: "kubernetes.io/hostname" + {{- with .Values.controller.nodeAffinity }} + nodeAffinity: + {{- toYaml . | nindent 10 }} + {{- end }} + serviceAccountName: {{ include "vsphere-csi-driver.controller.serviceAccountName" . }} + {{- with .Values.controller.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + dnsPolicy: "Default" + containers: + - name: csi-attacher + image: "{{ .Values.images.csiAttacher.repo }}:{{ .Values.images.csiAttacher.tag }}" + args: + - "--v=4" + - "--timeout=300s" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-lease-duration=120s" + - "--leader-election-renew-deadline=60s" + - "--leader-election-retry-period=30s" + - "--kube-api-qps=100" + - "--kube-api-burst=100" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - name: csi-resizer + image: "{{ .Values.images.csiResizer.repo }}:{{ .Values.images.csiResizer.tag }}" + args: + - "--v=4" + - "--timeout=300s" + - "--handle-volume-inuse-error=false" + - "--csi-address=$(ADDRESS)" + - "--kube-api-qps=100" + - "--kube-api-burst=100" + - "--leader-election" + - "--leader-election-lease-duration=120s" + - "--leader-election-renew-deadline=60s" + - "--leader-election-retry-period=30s" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - name: vsphere-csi-controller + image: "{{ .Values.images.driver.repo }}:{{ .Values.images.driver.tag }}" + args: + - "--fss-name=internal-feature-states.csi.vsphere.vmware.com" + - "--fss-namespace=$(CSI_NAMESPACE)" + imagePullPolicy: "Always" + env: + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: X_CSI_MODE + value: "controller" + - name: X_CSI_SPEC_DISABLE_LEN_CHECK + value: "true" + - name: X_CSI_SERIAL_VOL_ACCESS_TIMEOUT + value: 3m + - name: VSPHERE_CSI_CONFIG + value: "/etc/cloud/csi-vsphere.conf" + - name: LOGGER_LEVEL + value: "PRODUCTION" # Options: DEVELOPMENT, PRODUCTION + - name: INCLUSTER_CLIENT_QPS + value: "100" + - name: INCLUSTER_CLIENT_BURST + value: "100" + - name: CSI_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + securityContext: + runAsNonRoot: true + runAsUser: 65532 + runAsGroup: 65532 + volumeMounts: + - mountPath: /etc/cloud + name: vsphere-config-volume + readOnly: true + - mountPath: /csi + name: socket-dir + ports: + - name: healthz + containerPort: 9808 + protocol: TCP + - name: prometheus + containerPort: 2112 + protocol: TCP + livenessProbe: + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 30 + timeoutSeconds: 10 + periodSeconds: 180 + failureThreshold: 3 + - name: liveness-probe + image: "{{ .Values.images.livenessProbe.repo }}:{{ .Values.images.livenessProbe.tag }}" + args: + - "--v=4" + - "--csi-address=/csi/csi.sock" + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: vsphere-syncer + image: "{{ .Values.images.syncer.repo }}:{{ .Values.images.syncer.tag }}" + args: + - "--leader-election" + - "--leader-election-lease-duration=30s" + - "--leader-election-renew-deadline=20s" + - "--leader-election-retry-period=10s" + - "--fss-name=internal-feature-states.csi.vsphere.vmware.com" + - "--fss-namespace=$(CSI_NAMESPACE)" + imagePullPolicy: "Always" + ports: + - containerPort: 2113 + name: prometheus + protocol: TCP + env: + - name: FULL_SYNC_INTERVAL_MINUTES + value: "30" + - name: VSPHERE_CSI_CONFIG + value: "/etc/cloud/csi-vsphere.conf" + - name: LOGGER_LEVEL + value: "PRODUCTION" # Options: DEVELOPMENT, PRODUCTION + - name: INCLUSTER_CLIENT_QPS + value: "100" + - name: INCLUSTER_CLIENT_BURST + value: "100" + - name: CSI_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + securityContext: + runAsNonRoot: true + runAsUser: 65532 + runAsGroup: 65532 + volumeMounts: + - mountPath: /etc/cloud + name: vsphere-config-volume + readOnly: true + - name: csi-provisioner + image: "{{ .Values.images.csiProvisioner.repo }}:{{ .Values.images.csiProvisioner.tag }}" + args: + - "--v=4" + - "--timeout=300s" + - "--csi-address=$(ADDRESS)" + - "--kube-api-qps=100" + - "--kube-api-burst=100" + - "--leader-election" + - "--leader-election-lease-duration=120s" + - "--leader-election-renew-deadline=60s" + - "--leader-election-retry-period=30s" + - "--default-fstype=ext4" + # needed only for topology aware setup + #- "--feature-gates=Topology=true" + #- "--strict-topology" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + - name: csi-snapshotter + image: "{{ .Values.images.csiSnapshotter.repo }}:{{ .Values.images.csiSnapshotter.tag }}" + args: + - "--v=4" + - "--kube-api-qps=100" + - "--kube-api-burst=100" + - "--timeout=300s" + - "--csi-address=$(ADDRESS)" + - "--leader-election" + - "--leader-election-lease-duration=120s" + - "--leader-election-renew-deadline=60s" + - "--leader-election-retry-period=30s" + env: + - name: ADDRESS + value: /csi/csi.sock + volumeMounts: + - mountPath: /csi + name: socket-dir + volumes: + - name: vsphere-config-volume + secret: + secretName: {{ .Values.vcenterConfig.secretName }} + - name: socket-dir + emptyDir: {} diff --git a/mirantis/vsphere-csi-driver/templates/controller-rbac.yaml b/mirantis/vsphere-csi-driver/templates/controller-rbac.yaml new file mode 100644 index 0000000..64a8088 --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/controller-rbac.yaml @@ -0,0 +1,84 @@ +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ include "vsphere-csi-driver.controller.fullname" . }}-controller-role + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["nodes", "pods"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["get", "list", "watch", "create"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["persistentvolumeclaims/status"] + verbs: ["patch"] + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "update", "delete", "patch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "watch", "list", "delete", "update", "create"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses", "csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["get", "list", "watch", "patch"] + - apiGroups: ["cns.vmware.com"] + resources: ["triggercsifullsyncs"] + verbs: ["create", "get", "update", "watch", "list"] + - apiGroups: ["cns.vmware.com"] + resources: ["cnsvspherevolumemigrations"] + verbs: ["create", "get", "list", "watch", "update", "delete"] + - apiGroups: ["cns.vmware.com"] + resources: ["cnsvolumeinfoes"] + verbs: ["create", "get", "list", "watch", "delete"] + - apiGroups: ["apiextensions.k8s.io"] + resources: ["customresourcedefinitions"] + verbs: ["get", "create", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments/status"] + verbs: ["patch"] + - apiGroups: ["cns.vmware.com"] + resources: ["cnsvolumeoperationrequests"] + verbs: ["create", "get", "list", "update", "delete"] + - apiGroups: [ "snapshot.storage.k8s.io" ] + resources: [ "volumesnapshots" ] + verbs: [ "get", "list" ] + - apiGroups: [ "snapshot.storage.k8s.io" ] + resources: [ "volumesnapshotclasses" ] + verbs: [ "watch", "get", "list" ] + - apiGroups: [ "snapshot.storage.k8s.io" ] + resources: [ "volumesnapshotcontents" ] + verbs: [ "create", "get", "list", "watch", "update", "delete", "patch"] + - apiGroups: [ "snapshot.storage.k8s.io" ] + resources: [ "volumesnapshotcontents/status" ] + verbs: [ "update", "patch" ] + - apiGroups: [ "cns.vmware.com" ] + resources: [ "csinodetopologies" ] + verbs: ["get", "update", "watch", "list"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ include "vsphere-csi-driver.controller.fullname" . }}-controller-rolebinding + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} + name: vsphere-csi-controller-binding +subjects: + - kind: ServiceAccount + name: {{ include "vsphere-csi-driver.controller.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ include "vsphere-csi-driver.controller.fullname" . }}-controller-role + apiGroup: rbac.authorization.k8s.io diff --git a/mirantis/vsphere-csi-driver/templates/controller-sa.yaml b/mirantis/vsphere-csi-driver/templates/controller-sa.yaml new file mode 100644 index 0000000..284e9c6 --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/controller-sa.yaml @@ -0,0 +1,6 @@ +kind: ServiceAccount +apiVersion: v1 +metadata: + name: {{ include "vsphere-csi-driver.controller.serviceAccountName" . }} + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} diff --git a/mirantis/vsphere-csi-driver/templates/controller-svc.yaml b/mirantis/vsphere-csi-driver/templates/controller-svc.yaml new file mode 100644 index 0000000..e596f4d --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/controller-svc.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "vsphere-csi-driver.controller.fullname" . }} + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +spec: + ports: + - name: ctlr + port: 2112 + targetPort: 2112 + protocol: TCP + - name: syncer + port: 2113 + targetPort: 2113 + protocol: TCP + selector: + {{- include "vsphere-csi-driver.controller.selectorLabels" . | nindent 4 }} diff --git a/mirantis/vsphere-csi-driver/templates/csi-driver.yaml b/mirantis/vsphere-csi-driver/templates/csi-driver.yaml new file mode 100644 index 0000000..afc5d11 --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/csi-driver.yaml @@ -0,0 +1,9 @@ +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: csi.vsphere.vmware.com + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +spec: + attachRequired: true + podInfoOnMount: false diff --git a/mirantis/vsphere-csi-driver/templates/feature-states-cm.yaml b/mirantis/vsphere-csi-driver/templates/feature-states-cm.yaml new file mode 100644 index 0000000..736d501 --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/feature-states-cm.yaml @@ -0,0 +1,9 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: internal-feature-states.csi.vsphere.vmware.com + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +data: + "trigger-csi-fullsync": "false" + "pv-to-backingdiskobjectid-mapping": "false" diff --git a/mirantis/vsphere-csi-driver/templates/node-ds.yaml b/mirantis/vsphere-csi-driver/templates/node-ds.yaml new file mode 100644 index 0000000..b98b758 --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/node-ds.yaml @@ -0,0 +1,145 @@ +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: {{ include "vsphere-csi-driver.node.fullname" . }} + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "vsphere-csi-driver.node.selectorLabels" . | nindent 6 }} + updateStrategy: + type: "RollingUpdate" + rollingUpdate: + maxUnavailable: 1 + template: + metadata: + labels: + {{- include "vsphere-csi-driver.node.selectorLabels" . | nindent 8 }} + spec: + priorityClassName: system-node-critical + nodeSelector: + kubernetes.io/os: linux + serviceAccountName: {{ include "vsphere-csi-driver.node.serviceAccountName" . }} + hostNetwork: true + dnsPolicy: "ClusterFirstWithHostNet" + containers: + - name: node-driver-registrar + image: "{{ .Values.images.nodeDriverRegistrar.repo }}:{{ .Values.images.nodeDriverRegistrar.tag }}" + args: + - "--v=5" + - "--csi-address=$(ADDRESS)" + - "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)" + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: {{ .Values.node.kubeletPath }}/plugins/csi.vsphere.vmware.com/csi.sock + volumeMounts: + - name: plugin-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + livenessProbe: + exec: + command: + - /csi-node-driver-registrar + - --kubelet-registration-path={{ .Values.node.kubeletPath }}/plugins/csi.vsphere.vmware.com/csi.sock + - --mode=kubelet-registration-probe + initialDelaySeconds: 3 + - name: vsphere-csi-node + image: "{{ .Values.images.driver.repo }}:{{ .Values.images.driver.tag }}" + args: + - "--fss-name=internal-feature-states.csi.vsphere.vmware.com" + - "--fss-namespace=$(CSI_NAMESPACE)" + imagePullPolicy: "Always" + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: MAX_VOLUMES_PER_NODE + value: "59" # Maximum number of volumes that controller can publish to the node. If value is not set or zero Kubernetes decide how many volumes can be published by the controller to the node. + - name: X_CSI_MODE + value: "node" + - name: X_CSI_SPEC_REQ_VALIDATION + value: "false" + - name: X_CSI_SPEC_DISABLE_LEN_CHECK + value: "true" + - name: LOGGER_LEVEL + value: "PRODUCTION" # Options: DEVELOPMENT, PRODUCTION + - name: CSI_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: NODEGETINFO_WATCH_TIMEOUT_MINUTES + value: "1" + securityContext: + privileged: true + capabilities: + add: ["SYS_ADMIN"] + allowPrivilegeEscalation: true + volumeMounts: + - name: plugin-dir + mountPath: /csi + - name: pods-mount-dir + mountPath: {{ .Values.node.kubeletPath }} + # needed so that any mounts setup inside this container are + # propagated back to the host machine. + mountPropagation: "Bidirectional" + - name: device-dir + mountPath: /dev + - name: blocks-dir + mountPath: /sys/block + - name: sys-devices-dir + mountPath: /sys/devices + ports: + - name: healthz + containerPort: 9808 + protocol: TCP + livenessProbe: + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 10 + timeoutSeconds: 5 + periodSeconds: 5 + failureThreshold: 3 + - name: liveness-probe + image: "{{ .Values.images.livenessProbe.repo }}:{{ .Values.images.livenessProbe.tag }}" + args: + - "--v=4" + - "--csi-address=/csi/csi.sock" + volumeMounts: + - name: plugin-dir + mountPath: /csi + volumes: + - name: registration-dir + hostPath: + path: {{ .Values.node.kubeletPath }}/plugins_registry + type: Directory + - name: plugin-dir + hostPath: + path: {{ .Values.node.kubeletPath }}/plugins/csi.vsphere.vmware.com + type: DirectoryOrCreate + - name: pods-mount-dir + hostPath: + path: {{ .Values.node.kubeletPath }} + type: Directory + - name: device-dir + hostPath: + path: /dev + - name: blocks-dir + hostPath: + path: /sys/block + type: Directory + - name: sys-devices-dir + hostPath: + path: /sys/devices + type: Directory + {{- with .Values.node.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/mirantis/vsphere-csi-driver/templates/node-rbac.yaml b/mirantis/vsphere-csi-driver/templates/node-rbac.yaml new file mode 100644 index 0000000..758d9bb --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/node-rbac.yaml @@ -0,0 +1,55 @@ +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ include "vsphere-csi-driver.node.fullname" . }}-node-cluster-role + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +rules: + - apiGroups: ["cns.vmware.com"] + resources: ["csinodetopologies"] + verbs: ["create", "watch", "get", "patch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ include "vsphere-csi-driver.node.fullname" . }}-cluster-role-binding + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ include "vsphere-csi-driver.node.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ include "vsphere-csi-driver.node.fullname" . }}-node-cluster-role + apiGroup: rbac.authorization.k8s.io +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ include "vsphere-csi-driver.node.fullname" . }}-node-role + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["get", "list", "watch"] +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ include "vsphere-csi-driver.node.fullname" . }}-node-binding + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} +subjects: + - kind: ServiceAccount + name: {{ include "vsphere-csi-driver.node.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: Role + name: {{ include "vsphere-csi-driver.node.fullname" . }}-node-role + apiGroup: rbac.authorization.k8s.io diff --git a/mirantis/vsphere-csi-driver/templates/node-sa.yaml b/mirantis/vsphere-csi-driver/templates/node-sa.yaml new file mode 100644 index 0000000..f0797aa --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/node-sa.yaml @@ -0,0 +1,6 @@ +kind: ServiceAccount +apiVersion: v1 +metadata: + name: {{ include "vsphere-csi-driver.node.serviceAccountName" . }} + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} diff --git a/mirantis/vsphere-csi-driver/templates/sc.yaml b/mirantis/vsphere-csi-driver/templates/sc.yaml new file mode 100644 index 0000000..bdda131 --- /dev/null +++ b/mirantis/vsphere-csi-driver/templates/sc.yaml @@ -0,0 +1,14 @@ +{{- if .Values.defaultStorageClass.enabled }} +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: {{ .Values.defaultStorageClass.name }} + labels: + {{- include "vsphere-csi-driver.labels" . | nindent 4 }} + annotations: + storageclass.kubernetes.io/is-default-class: "true" +provisioner: csi.vsphere.vmware.com +allowVolumeExpansion: {{ .Values.defaultStorageClass.allowVolumeExpansion }} +parameters: + csi.storage.k8s.io/fstype: "ext4" +{{- end }} diff --git a/mirantis/vsphere-csi-driver/values.yaml b/mirantis/vsphere-csi-driver/values.yaml new file mode 100644 index 0000000..9e967cc --- /dev/null +++ b/mirantis/vsphere-csi-driver/values.yaml @@ -0,0 +1,85 @@ +# Default values for vsphere-csi-driver. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +controller: + replicas: 1 + + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/control-plane + operator: Exists + effect: NoSchedule + # uncomment below toleration if you need an aggressive pod eviction in case when + # node becomes not-ready or unreachable. Default is 300 seconds if not specified. + # - key: node.kubernetes.io/not-ready + # operator: Exists + # effect: NoExecute + # tolerationSeconds: 30 + # - key: node.kubernetes.io/unreachable + # operator: Exists + # effect: NoExecute + # tolerationSeconds: 30 + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: node-role.kubernetes.io/control-plane + operator: Exists + - matchExpressions: + - key: node-role.kubernetes.io/controlplane + operator: Exists + - matchExpressions: + - key: node-role.kubernetes.io/master + operator: Exists +node: + kubeletPath: /var/lib/kubelet + tolerations: + - effect: NoExecute + operator: Exists + - effect: NoSchedule + operator: Exists + +vcenterConfig: + enabled: false + secretName: vcenter-config-secret + clusterID: "" + thumbprint: "" + vcenter: "" + insecure: "true" + user: "" + password: "" + port: "443" + datacenters: "" + +images: + driver: + repo: gcr.io/cloud-provider-vsphere/csi/release/driver + tag: v3.3.1 + syncer: + repo: gcr.io/cloud-provider-vsphere/csi/release/syncer + tag: v3.3.1 + nodeDriverRegistrar: + repo: registry.k8s.io/sig-storage/csi-node-driver-registrar + tag: v2.10.1 + csiAttacher: + repo: registry.k8s.io/sig-storage/csi-attacher + tag: v4.5.1 + csiResizer: + repo: registry.k8s.io/sig-storage/csi-resizer + tag: v1.10.1 + csiProvisioner: + repo: registry.k8s.io/sig-storage/csi-provisioner + tag: v4.0.1 + csiSnapshotter: + repo: registry.k8s.io/sig-storage/csi-snapshotter + tag: v7.0.2 + livenessProbe: + repo: registry.k8s.io/sig-storage/livenessprobe + tag: v2.12.0 + +defaultStorageClass: + enabled: false + name: vsphere-csi + allowVolumeExpansion: true