Skip to content

Commit

Permalink
Merge pull request #1668 from AndrewSirenko/issue1492
Browse files Browse the repository at this point in the history
Allow customization of aws-secret name and keys in Helm Chart
  • Loading branch information
k8s-ci-robot authored Jul 3, 2023
2 parents 2bac0f8 + 88f6c17 commit 280ac42
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 6 additions & 4 deletions charts/aws-ebs-csi-driver/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,20 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- with .Values.awsAccessSecret }}
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: aws-secret
key: key_id
name: {{ .name }}
key: {{ .keyId }}
optional: true
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: aws-secret
key: access_key
name: {{ .name }}
key: {{ .accessKey }}
optional: true
{{- end }}
- name: AWS_EC2_ENDPOINT
valueFrom:
configMapKeyRef:
Expand Down
5 changes: 5 additions & 0 deletions charts/aws-ebs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ imagePullSecrets: []
nameOverride:
fullnameOverride:

awsAccessSecret:
name: aws-secret
keyId: key_id
accessKey: access_key

controller:
volumeModificationFeature:
enabled: false
Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ There are several methods to grant the driver IAM permissions:
* Using IAM [instance profile](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html) - attach the policy to the instance profile IAM role and turn on access to [instance metadata](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) for the instance(s) on which the driver Deployment will run
* EKS only: Using [IAM roles for ServiceAccounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) - create an IAM role, attach the policy to it, then follow the IRSA documentation to associate the IAM role with the driver Deployment service account, which if you are installing via Helm is determined by value `controller.serviceAccount.name`, `ebs-csi-controller-sa` by default. If you are using k8s 1.24 or higher, the ServiceAccountToken is not mounted because the `LegacyServiceAccountTokenNoAutoGeneration` feature gate is enabled.
Therefore, if you are using k8s 1.24 or higher, you need to set `true` to `controller.serviceAccount.autoMountServiceAccountToken`.
* Using secret object - create an IAM user, attach the policy to it, then create a generic secret called `aws-secret` in the `kube-system` namespace with the user's credentials
* Using secret object - create an IAM user, attach the policy to it, then create a generic secret in the `kube-system` namespace with the user's credentials. The snippet below creates the generic secret named `aws-secret` that the driver accepts by default. You can customize the default secret and key names via the Helm parameters `awsAccessSecret.name`, `awsAccessSecret.keyId`, and `awsAccessSecret.accessKey` in the chart's [values.yaml](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/blob/master/charts/aws-ebs-csi-driver/values.yaml).
```sh
kubectl create secret generic aws-secret \
--namespace kube-system \
Expand Down

0 comments on commit 280ac42

Please sign in to comment.