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

chart: fix service account name #570

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

kd7lxl
Copy link
Contributor

@kd7lxl kd7lxl commented Apr 4, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

The scheduler name, and subsequently the scheduler service account name can be configured by a value, but the deployment still referenced a hardcoded service account name. This resulted in the deployment failing whenever the scheduler name was overridden.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 4, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @kd7lxl!

It looks like this is your first PR to kubernetes-sigs/scheduler-plugins 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/scheduler-plugins has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 4, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @kd7lxl. 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 the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 4, 2023
@zwpaper
Copy link
Member

zwpaper commented Apr 5, 2023

/area helm
/assign
/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. area/helm and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 5, 2023
@@ -38,7 +38,7 @@ spec:
labels:
component: scheduler
spec:
serviceAccountName: scheduler-plugins-scheduler
serviceAccountName: {{ .Values.scheduler.name }}
Copy link
Contributor

Choose a reason for hiding this comment

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

could you also update L18 to make controller's SA name parametrizable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@Huang-Wei
Copy link
Contributor

Huang-Wei commented Apr 5, 2023

Strictly speaking, it's not a bug :)

/remove-kind bug
/kind feature

Could you also update the release-note section to:

Helm: tie controller/scheduler's service account name to their variable name.

@k8s-ci-robot k8s-ci-robot removed the kind/bug Categorizes issue or PR as related to a bug. label Apr 5, 2023
@k8s-ci-robot
Copy link
Contributor

@Huang-Wei: The label(s) kind/enhancement cannot be applied, because the repository doesn't have them.

In response to this:

Strictly speaking, it's not a bug :)

/remove-kind bug
/kind enhancement

Could you also update the release-note section to:

Helm: tie controller/scheduler's service account name to their variable name.

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.

@zwpaper
Copy link
Member

zwpaper commented Apr 6, 2023

hi @kd7lxl, I have found some time to look into the PR, and I found that you use the scheduler.name to ack as the serviceAccountName for the scheduler, but it seems that having a rbac related configuration would be better.

could you please add a scheduler.serviceAccount.name to specify the serviceAccountName, like

scheduler:
  serviceAccount:
    name:

and later, we can raise another PR, or keep it in the one that would also be great, to implement the RBAC related in our chart.

ref: https://helm.sh/docs/chart_best_practices/rbac/

WDYT @Huang-Wei

Copy link
Member

@zwpaper zwpaper left a comment

Choose a reason for hiding this comment

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

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 6, 2023
@kd7lxl
Copy link
Contributor Author

kd7lxl commented Apr 6, 2023

hi @kd7lxl, I have found some time to look into the PR, and I found that you use the scheduler.name to ack as the serviceAccountName for the scheduler, but it seems that having a rbac related configuration would be better.

could you please add a scheduler.serviceAccount.name to specify the serviceAccountName, like

scheduler:
  serviceAccount:
    name:

and later, we can raise another PR, or keep it in the one that would also be great, to implement the RBAC related in our chart.

ref: https://helm.sh/docs/chart_best_practices/rbac/

WDYT @Huang-Wei

Sorry, I'm not sure what you're requesting. The chart already has RBAC, and already uses the parameterized name. That's why this was marked /kind bug. The names need to match everywhere for it to work.

I would prefer to keep any enhancements, like the ability to customize the service account name separate from the deployment name, in a separate PR so that this one is limited to the bug fix.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 6, 2023
@zwpaper
Copy link
Member

zwpaper commented Apr 6, 2023

Oops, sorry for the mistake...

what I say is that we should expose the rbac related in values.yaml like it mentioned here https://helm.sh/docs/chart_best_practices/rbac/.

it's ok for this PR to go with the enhancement with this serviceAccountName

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
Copy link
Member

Choose a reason for hiding this comment

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

we may need to specify the --chart-dirs

Copy link
Contributor Author

@kd7lxl kd7lxl Apr 6, 2023

Choose a reason for hiding this comment

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

I set the default working-directory to achieve this. Need to run it to know if it works this way. (The checkout docs say it checks out to $GITHUB_WORKSPACE by default, not current working directory, so I expect it to work as-is as long as those docs are accurate.) Not sure how to trigger a test run in this project.

Copy link
Member

Choose a reason for hiding this comment

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

why is there 2 empty default yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, fixed.

@kd7lxl
Copy link
Contributor Author

kd7lxl commented Apr 6, 2023

I added a chart test with a test case for the name override feature that is currently broken in the default branch. If the test passes, we will know this PR fixes the problem.

The test was implemented in Github Actions, and I'm not sure how to run it in this project. It appears the project does not yet utilize Github Actions, but from past experience, that's the easiest tool for implementing chart testing. Can someone help?

@Huang-Wei
Copy link
Contributor

Can someone help?

Now it's running. Let's wait and see.

Copy link
Contributor

Choose a reason for hiding this comment

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

this file is empty, is it intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it tells ct to run a test case with the default values (no overrides).

@@ -0,0 +1,48 @@
name: Lint and Test Chart
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe adding "helm" to it? like "Helm Chart Lint and Test"

@Huang-Wei
Copy link
Contributor

Thanks @kd7lxl for the Helm testing bits. It runs successfully.

To keep a linear git history, would you mind squashing the commits into two: one is core changes, the other for helm CI?

@kd7lxl
Copy link
Contributor Author

kd7lxl commented Apr 6, 2023

Can someone help?

Now it's running. Let's wait and see.

Hmm, it looks like it ran, but skipped the test cases. Need to figure that out.

@zwpaper
Copy link
Member

zwpaper commented Apr 7, 2023

Hmm, it looks like it ran, but skipped the test cases. Need to figure that out.

maybe you need to define the output, and need dependency first?
https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs

@Huang-Wei
Copy link
Contributor

@kd7lxl if it's too much work, I'm fine with only focus on parameterize the service account in this PR, and follow up the CI bits in another PR. But it's up to you :)

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 11, 2023
@kd7lxl kd7lxl changed the title chart: fix scheduler service account name chart: fix service account name Apr 11, 2023
@kd7lxl
Copy link
Contributor Author

kd7lxl commented Apr 11, 2023

To keep a linear git history, would you mind squashing the commits into two: one is core changes, the other for helm CI?

@kd7lxl if it's too much work, I'm fine with only focus on parameterize the service account in this PR, and follow up the CI bits in another PR. But it's up to you :)

Sorry, was away from the computer for a few days. Squashed and rebased now to just the service account name fix. I'll open another PR to add chart tests.

@Huang-Wei
Copy link
Contributor

/retest

@Huang-Wei
Copy link
Contributor

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Huang-Wei, kd7lxl

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 Apr 11, 2023
@k8s-ci-robot k8s-ci-robot merged commit 9701eb8 into kubernetes-sigs:master Apr 11, 2023
@kd7lxl kd7lxl deleted the scheduler-name branch April 11, 2023 18:09
@kd7lxl kd7lxl mentioned this pull request Apr 13, 2023
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. area/helm 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. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants