Skip to content

Commit 4edb136

Browse files
committed
Add opt-in parameter to disable node mutation permissions
1 parent aefe2fe commit 4edb136

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

charts/aws-efs-csi-driver/templates/node-daemonset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ spec:
9696
- name: AWS_USE_FIPS_ENDPOINT
9797
value: "true"
9898
{{- end }}
99+
{{- if .Values.node.serviceAccount.disableMutation }}
100+
- name: DISABLE_TAINT_WATCHER
101+
value: "true"
102+
{{- end }}
99103
- name: PORT_RANGE_UPPER_BOUND
100104
value: "{{ .Values.portRangeUpperBound }}"
101105
{{- with .Values.node.env }}

charts/aws-efs-csi-driver/templates/node-serviceaccount.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ metadata:
2121
rules:
2222
- apiGroups: [""]
2323
resources: ["nodes"]
24-
verbs: ["get", "list", "watch", "patch"]
24+
verbs: ["get", "list", "watch"]
25+
{{- if not .Values.node.serviceAccount.disableMutation }}
26+
- apiGroups: [""]
27+
resources: ["nodes"]
28+
verbs: ["patch"]
29+
{{- end }}
2530
---
2631
kind: ClusterRoleBinding
2732
apiVersion: rbac.authorization.k8s.io/v1

charts/aws-efs-csi-driver/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ node:
204204
annotations: {}
205205
## Enable if EKS IAM for SA is used
206206
# eks.amazonaws.com/role-arn: arn:aws:iam::111122223333:role/efs-csi-role
207+
# Disable mutating permissions for the node service account.
208+
# When disableMutation is true, some features of the EFS CSI Driver node pods will not function, such as taint removal.
209+
# Primarily useful in particularly security-sensitive environments, or on multi-tenant clusters that isolate tenants by node.
210+
disableMutation: false
207211
healthPort: 9809
208212
# securityContext on the node pod
209213
securityContext:

deploy/kubernetes/base/node-serviceaccount.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ metadata:
1616
rules:
1717
- apiGroups: [""]
1818
resources: ["nodes"]
19-
verbs: ["get", "list", "watch", "patch"]
19+
verbs: ["get", "list", "watch"]
20+
- apiGroups: [""]
21+
resources: ["nodes"]
22+
verbs: ["patch"]
2023
---
2124
kind: ClusterRoleBinding
2225
apiVersion: rbac.authorization.k8s.io/v1

pkg/driver/node.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,11 @@ type JSONPatch struct {
488488
// This taint can be optionally applied by users to prevent startup race conditions such as
489489
// https://github.com/kubernetes/kubernetes/issues/95911
490490
func removeNotReadyTaint(k8sClient cloud.KubernetesAPIClient) error {
491+
if os.Getenv("DISABLE_TAINT_WATCHER") != "" {
492+
klog.V(4).InfoS("DISABLE_TAINT_WATCHER set, skipping taint removal")
493+
return nil
494+
}
495+
491496
nodeName := os.Getenv("CSI_NODE_NAME")
492497
if nodeName == "" {
493498
klog.V(4).InfoS("CSI_NODE_NAME missing, skipping taint removal")

0 commit comments

Comments
 (0)