Skip to content

Commit

Permalink
Add support for existing service accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
ayberk committed Jan 12, 2021
1 parent ddaa68b commit c46b29d
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
{{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: ebs-csi-controller-sa
name: {{ .Values.serviceAccount.controller.name }}
namespace: kube-system
roleRef:
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
{{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: ebs-csi-controller-sa
name: {{ .Values.serviceAccount.controller.name }}
namespace: kube-system
roleRef:
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
{{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: ebs-csi-controller-sa
name: {{ .Values.serviceAccount.controller.name }}
namespace: kube-system
roleRef:
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
{{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: ebs-snapshot-controller
name: {{ .Values.serviceAccount.snapshot.name }}
namespace: kube-system
roleRef:
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
{{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: ebs-csi-controller-sa
name: {{ .Values.serviceAccount.controller.name }}
namespace: kube-system
roleRef:
kind: ClusterRole
Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ebs-csi-driver/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
{{- with .Values.nodeSelector }}
{{ toYaml . | indent 8 }}
{{- end }}
serviceAccountName: ebs-csi-controller-sa
serviceAccountName: {{ .Values.serviceAccount.controller.name }}
priorityClassName: system-cluster-critical
{{- with .Values.affinity }}
affinity: {{ toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
{{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: ebs-snapshot-controller
name: {{ .Values.serviceAccount.snapshot.name }}
namespace: kube-system
roleRef:
kind: Role
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- if .Values.serviceAccount.controller.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: ebs-csi-controller-sa
name: {{ .Values.serviceAccount.controller.name }}
namespace: kube-system
labels:
{{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
Expand All @@ -13,3 +14,4 @@ metadata:
#annotations:
# eks.amazonaws.com/role-arn: arn:aws:iam::586565787010:role/ebs-csi-role
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{{- if .Values.enableVolumeSnapshot }}
{{- if .Values.serviceAccount.snapshot.create }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: ebs-snapshot-controller
name: {{ .Values.serviceAccount.snapshot.name }}
namespace: kube-system
labels:
{{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.snapshot.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/aws-ebs-csi-driver/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
app: ebs-snapshot-controller
{{- include "aws-ebs-csi-driver.labels" . | nindent 8 }}
spec:
serviceAccountName: ebs-snapshot-controller
serviceAccountName: {{ .Values.serviceAccount.snapshot.name }}
containers:
- name: snapshot-controller
image: quay.io/k8scsi/snapshot-controller:v2.1.1
Expand Down
4 changes: 4 additions & 0 deletions charts/aws-ebs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ node:

serviceAccount:
controller:
create: true # A service account will be created for you if set to true. Set to false if you want to use your own.
name: ebs-csi-controller-sa # Name of the service-account to be used/created.
annotations: {}
snapshot:
create: true
name: ebs-snapshot-controller
annotations: {}

0 comments on commit c46b29d

Please sign in to comment.