From 3565ca03dfcae3619234625524fd3a68c7b6aab5 Mon Sep 17 00:00:00 2001 From: Drew Sirenko <68304519+AndrewSirenko@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:53:48 -0400 Subject: [PATCH] Add disableController parameter to helm chart --- charts/aws-ebs-csi-driver/templates/clusterrole-attacher.yaml | 2 ++ .../aws-ebs-csi-driver/templates/clusterrole-provisioner.yaml | 2 ++ charts/aws-ebs-csi-driver/templates/clusterrole-resizer.yaml | 2 ++ .../aws-ebs-csi-driver/templates/clusterrole-snapshotter.yaml | 2 ++ .../templates/clusterrolebinding-attacher.yaml | 2 ++ .../templates/clusterrolebinding-provisioner.yaml | 2 ++ .../templates/clusterrolebinding-resizer.yaml | 2 ++ .../templates/clusterrolebinding-snapshotter.yaml | 2 ++ charts/aws-ebs-csi-driver/templates/controller.yaml | 2 ++ charts/aws-ebs-csi-driver/templates/csidriver.yaml | 2 ++ charts/aws-ebs-csi-driver/templates/ebs-csi-default-sc.yaml | 2 ++ charts/aws-ebs-csi-driver/templates/metrics.yaml | 2 +- .../templates/poddisruptionbudget-controller.yaml | 2 ++ charts/aws-ebs-csi-driver/templates/role-leases.yaml | 2 ++ charts/aws-ebs-csi-driver/templates/rolebinding-leases.yaml | 2 ++ .../templates/serviceaccount-csi-controller.yaml | 2 +- charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml | 2 +- charts/aws-ebs-csi-driver/values.yaml | 2 ++ 18 files changed, 33 insertions(+), 3 deletions(-) diff --git a/charts/aws-ebs-csi-driver/templates/clusterrole-attacher.yaml b/charts/aws-ebs-csi-driver/templates/clusterrole-attacher.yaml index bff6577b34..7602222871 100644 --- a/charts/aws-ebs-csi-driver/templates/clusterrole-attacher.yaml +++ b/charts/aws-ebs-csi-driver/templates/clusterrole-attacher.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 @@ -24,3 +25,4 @@ rules: {{- with .Values.sidecars.attacher.additionalClusterRoleRules }} {{- . | toYaml | nindent 2 }} {{- end }} +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/clusterrole-provisioner.yaml b/charts/aws-ebs-csi-driver/templates/clusterrole-provisioner.yaml index cb69cc8d3e..74337903b5 100644 --- a/charts/aws-ebs-csi-driver/templates/clusterrole-provisioner.yaml +++ b/charts/aws-ebs-csi-driver/templates/clusterrole-provisioner.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 @@ -39,3 +40,4 @@ rules: {{- with .Values.sidecars.provisioner.additionalClusterRoleRules }} {{- . | toYaml | nindent 2 }} {{- end }} +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/clusterrole-resizer.yaml b/charts/aws-ebs-csi-driver/templates/clusterrole-resizer.yaml index 81858af34f..48b5421ab9 100644 --- a/charts/aws-ebs-csi-driver/templates/clusterrole-resizer.yaml +++ b/charts/aws-ebs-csi-driver/templates/clusterrole-resizer.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 @@ -35,3 +36,4 @@ rules: {{- with .Values.sidecars.resizer.additionalClusterRoleRules }} {{- . | toYaml | nindent 2 }} {{- end }} +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/clusterrole-snapshotter.yaml b/charts/aws-ebs-csi-driver/templates/clusterrole-snapshotter.yaml index 697e818d98..8af9d993d4 100644 --- a/charts/aws-ebs-csi-driver/templates/clusterrole-snapshotter.yaml +++ b/charts/aws-ebs-csi-driver/templates/clusterrole-snapshotter.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 @@ -28,3 +29,4 @@ rules: {{- with .Values.sidecars.snapshotter.additionalClusterRoleRules }} {{- . | toYaml | nindent 2 }} {{- end }} +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/clusterrolebinding-attacher.yaml b/charts/aws-ebs-csi-driver/templates/clusterrolebinding-attacher.yaml index bb23044b20..32c41961f4 100644 --- a/charts/aws-ebs-csi-driver/templates/clusterrolebinding-attacher.yaml +++ b/charts/aws-ebs-csi-driver/templates/clusterrolebinding-attacher.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 @@ -13,3 +14,4 @@ roleRef: kind: ClusterRole name: ebs-external-attacher-role apiGroup: rbac.authorization.k8s.io +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/clusterrolebinding-provisioner.yaml b/charts/aws-ebs-csi-driver/templates/clusterrolebinding-provisioner.yaml index 9d2749ac3a..32008486ca 100644 --- a/charts/aws-ebs-csi-driver/templates/clusterrolebinding-provisioner.yaml +++ b/charts/aws-ebs-csi-driver/templates/clusterrolebinding-provisioner.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 @@ -13,3 +14,4 @@ roleRef: kind: ClusterRole name: ebs-external-provisioner-role apiGroup: rbac.authorization.k8s.io +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/clusterrolebinding-resizer.yaml b/charts/aws-ebs-csi-driver/templates/clusterrolebinding-resizer.yaml index 88cb47de11..f0c694fe1e 100644 --- a/charts/aws-ebs-csi-driver/templates/clusterrolebinding-resizer.yaml +++ b/charts/aws-ebs-csi-driver/templates/clusterrolebinding-resizer.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 @@ -13,3 +14,4 @@ roleRef: kind: ClusterRole name: ebs-external-resizer-role apiGroup: rbac.authorization.k8s.io +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/clusterrolebinding-snapshotter.yaml b/charts/aws-ebs-csi-driver/templates/clusterrolebinding-snapshotter.yaml index 2d4290546e..4c349efb56 100644 --- a/charts/aws-ebs-csi-driver/templates/clusterrolebinding-snapshotter.yaml +++ b/charts/aws-ebs-csi-driver/templates/clusterrolebinding-snapshotter.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 @@ -13,3 +14,4 @@ roleRef: kind: ClusterRole name: ebs-external-snapshotter-role apiGroup: rbac.authorization.k8s.io +{{- end -}} diff --git a/charts/aws-ebs-csi-driver/templates/controller.yaml b/charts/aws-ebs-csi-driver/templates/controller.yaml index 738d927be2..4053ee1807 100644 --- a/charts/aws-ebs-csi-driver/templates/controller.yaml +++ b/charts/aws-ebs-csi-driver/templates/controller.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} # Controller Service kind: Deployment apiVersion: apps/v1 @@ -518,3 +519,4 @@ spec: dnsConfig: {{- toYaml .Values.controller.dnsConfig | nindent 8 }} {{- end }} +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/csidriver.yaml b/charts/aws-ebs-csi-driver/templates/csidriver.yaml index a46d4b50fc..a78eb58d9c 100644 --- a/charts/aws-ebs-csi-driver/templates/csidriver.yaml +++ b/charts/aws-ebs-csi-driver/templates/csidriver.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} apiVersion: {{ ternary "storage.k8s.io/v1" "storage.k8s.io/v1beta1" (semverCompare ">=1.18.0-0" .Capabilities.KubeVersion.Version) }} kind: CSIDriver metadata: @@ -10,3 +11,4 @@ spec: {{- if not .Values.useOldCSIDriver }} fsGroupPolicy: File {{- end }} +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/ebs-csi-default-sc.yaml b/charts/aws-ebs-csi-driver/templates/ebs-csi-default-sc.yaml index a58595726a..95d743875a 100644 --- a/charts/aws-ebs-csi-driver/templates/ebs-csi-default-sc.yaml +++ b/charts/aws-ebs-csi-driver/templates/ebs-csi-default-sc.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} {{- if .Values.defaultStorageClass.enabled }} apiVersion: storage.k8s.io/v1 kind: StorageClass @@ -9,3 +10,4 @@ provisioner: ebs.csi.aws.com volumeBindingMode: WaitForFirstConsumer allowVolumeExpansion: true {{- end }} +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/metrics.yaml b/charts/aws-ebs-csi-driver/templates/metrics.yaml index d68bd7ab97..9792af4e60 100644 --- a/charts/aws-ebs-csi-driver/templates/metrics.yaml +++ b/charts/aws-ebs-csi-driver/templates/metrics.yaml @@ -1,4 +1,4 @@ -{{- if .Values.controller.enableMetrics -}} +{{- if and .Values.controller.enableMetrics (not .Values.nodeComponentOnly) -}} --- apiVersion: v1 kind: Service diff --git a/charts/aws-ebs-csi-driver/templates/poddisruptionbudget-controller.yaml b/charts/aws-ebs-csi-driver/templates/poddisruptionbudget-controller.yaml index 0a1e97cc0b..36fed9bc39 100644 --- a/charts/aws-ebs-csi-driver/templates/poddisruptionbudget-controller.yaml +++ b/charts/aws-ebs-csi-driver/templates/poddisruptionbudget-controller.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} apiVersion: policy/v1 kind: PodDisruptionBudget metadata: @@ -15,3 +16,4 @@ spec: {{- else }} minAvailable: 2 {{- end }} +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/role-leases.yaml b/charts/aws-ebs-csi-driver/templates/role-leases.yaml index 1ec62bb499..f1260c0aed 100644 --- a/charts/aws-ebs-csi-driver/templates/role-leases.yaml +++ b/charts/aws-ebs-csi-driver/templates/role-leases.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: @@ -9,3 +10,4 @@ rules: - apiGroups: ["coordination.k8s.io"] resources: ["leases"] verbs: ["get", "watch", "list", "delete", "update", "create"] +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/rolebinding-leases.yaml b/charts/aws-ebs-csi-driver/templates/rolebinding-leases.yaml index 88fded8a39..f2826cbce8 100644 --- a/charts/aws-ebs-csi-driver/templates/rolebinding-leases.yaml +++ b/charts/aws-ebs-csi-driver/templates/rolebinding-leases.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.nodeComponentOnly -}} kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: @@ -13,3 +14,4 @@ roleRef: kind: Role name: ebs-csi-leases-role apiGroup: rbac.authorization.k8s.io +{{- end }} diff --git a/charts/aws-ebs-csi-driver/templates/serviceaccount-csi-controller.yaml b/charts/aws-ebs-csi-driver/templates/serviceaccount-csi-controller.yaml index d819f54937..bfb8c4bc1a 100644 --- a/charts/aws-ebs-csi-driver/templates/serviceaccount-csi-controller.yaml +++ b/charts/aws-ebs-csi-driver/templates/serviceaccount-csi-controller.yaml @@ -1,4 +1,4 @@ -{{- if .Values.controller.serviceAccount.create -}} +{{- if and .Values.controller.serviceAccount.create (not .Values.nodeComponentOnly) -}} apiVersion: v1 kind: ServiceAccount metadata: diff --git a/charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml b/charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml index 08113b7c6f..6c618b0add 100644 --- a/charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml +++ b/charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml @@ -1,4 +1,4 @@ -{{- if .Values.helmTester.enabled -}} +{{- if and .Values.helmTester.enabled (not .Values.nodeComponentOnly) -}} --- apiVersion: v1 kind: ServiceAccount diff --git a/charts/aws-ebs-csi-driver/values.yaml b/charts/aws-ebs-csi-driver/values.yaml index 75a445742e..6089d83518 100644 --- a/charts/aws-ebs-csi-driver/values.yaml +++ b/charts/aws-ebs-csi-driver/values.yaml @@ -476,6 +476,8 @@ volumeSnapshotClasses: [] # Intended for use with older clusters that cannot easily replace the CSIDriver object # This parameter should always be false for new installations useOldCSIDriver: false +# Deploy EBS CSI Driver without controller and associated resources +nodeComponentOnly: false helmTester: enabled: true # Supply a custom image to the ebs-csi-driver-test pod in helm-tester.yaml