Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add helm support for existing Service Accounts #877

Merged

Conversation

kassarl
Copy link
Contributor

@kassarl kassarl commented Jun 8, 2021

What type of PR is this?
/kind feature

What this PR does / why we need it:
Allows a user to define an pre-created Service Account in the Helm chart, a feature offered offered by other CSI drivers
Which issue(s) this PR fixes:

Fixes #709

Requirements:

Special notes for your reviewer:

Release note:

none

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 8, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @kassarl. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 8, 2021
@@ -25,11 +25,20 @@ image:
pullPolicy: IfNotPresent

serviceAccount:
create: true
controller:
create: true # When true, a service account will be created for you. Set to false if you want to use your own.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's redundant, could just use serviceAccount.controller.name instead since it would always be provided either by default value or user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using this "create" value in each of the templates for creating the SA (e.g. serviceaccount-csi-azuredisk-controller.yaml), since that was how it was previously structured. Should I instead do a check, if the name != default then create the service account?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since there is already serviceAccount.create and rbac.create, only need to specify controller.name, node.name, snapshotcontroller.name, if user wants to bring their own serviceAccount, they need to --set serviceAccount.create=false --set rbac.create=false --set serviceAccount.controller.name=x --set serviceAccount.node.name=x --set serviceAccount.snapshotcontroller.name=x

@kassarl kassarl force-pushed the support-existing-service-accounts branch 3 times, most recently from 42a176b to 765ca8a Compare June 10, 2021 14:46
@@ -25,11 +25,17 @@ image:
pullPolicy: IfNotPresent

serviceAccount:
create: true
create: true # When true, a service account will be created for you. Set to false if you want to use your own.
controller:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about set serviceAccount.controller: csi-azuredisk-controller-sa, serviceAccount.node: csi-azuredisk-node-sa, etc. ? That would make logic more clear.

@kassarl kassarl force-pushed the support-existing-service-accounts branch from 765ca8a to 90973b5 Compare June 10, 2021 17:03
create: true # When true, a service account will be created for you. Set to false if you want to use your own.
controller: csi-azuredisk-controller-sa # Name of Service Account to be created or used
node: csi-azuredisk-node-sa # Name of Service Account to be created or used
snapshotcontroller: csi-snapshot-controller-sa # Name of Service Account to be created or used
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since service account creation for the snapshot controller is enabled through snapshot.snapshotController.serviceAccount, it would be better to group this value with that setting, e.g. snapshot.snapshotController.serviceAccountName

Copy link
Member

@andyzhangx andyzhangx Jun 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, I think we could remove following settings

  snapshotController:
    serviceAccount: true
    rbac: true

should all depend on

serviceAccount:
  create: true

rbac:
  create: true

That would make the logic more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I have updated it to reflect the snapshot, controller, and node all depending on serviceAccount.create, and the snapshot rbac depending on rbac.create, and removed these fields from snapshot.snapshotController. I think this is a bit clearer, otherwise I can move the snapshot sa name to snapshot.snasphotController

@kassarl kassarl force-pushed the support-existing-service-accounts branch 3 times, most recently from 102f337 to affca89 Compare June 11, 2021 16:43
@edreed
Copy link
Collaborator

edreed commented Jun 11, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 11, 2021
@kassarl
Copy link
Contributor Author

kassarl commented Jun 11, 2021

/retest

@k8s-ci-robot
Copy link
Contributor

@kassarl: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jun 12, 2021
@andyzhangx andyzhangx force-pushed the support-existing-service-accounts branch from 5bea008 to 5686939 Compare June 13, 2021 08:30
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 13, 2021
Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, kassarl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 13, 2021
@k8s-ci-robot k8s-ci-robot merged commit d24456c into kubernetes-sigs:master Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support pre-created Service Accounts in the Helm chart
4 participants