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

Remove projected service account volume for workload identity #4682

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JRBANCEL
Copy link

@JRBANCEL JRBANCEL commented Mar 28, 2024

What type of PR is this?

/kind bug
/kind cleanup

What this PR does / why we need it:
See #4681.

Currently, in the manager spec, the projected volume for the service account token is manually specified.

The Workload Identity webhook takes care of this (and more) as seen here.

It is better to rely on the webhook because it is more future proof and removes YAML lines. Not only this, but as explained in #4681, not relying on the webhook makes it impossible to use cluster-api-provider-azure inside a vCluster on AKS with Workload Identity.

With this change, the resulting Pod spec in a vanilla case (i.e. not inside vCluster) is completely identical (webhook sets the volume), and it also works in vCluster because the Workload Identity webhook (on the host cluster) will do what is needed.

Which issue(s) this PR fixes:
Fixes #4681

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 28, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign timothysc for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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
Copy link
Contributor

Welcome @JRBANCEL!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-azure 🎉. 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/cluster-api-provider-azure 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 28, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @JRBANCEL. 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.

@dtzar
Copy link
Contributor

dtzar commented Mar 28, 2024

/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. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 28, 2024
@nojnhuh
Copy link
Contributor

nojnhuh commented Mar 28, 2024

Since we don't currently install the webhooks in our e2e tests, I'd expect the existing Workload Identity test to fail:

/test pull-cluster-api-provider-azure-e2e-optional

Introducing a requirement to install the webhooks would be a breaking change. Is there a way we could instead annotate the CAPZ pod so that the webhook ignores it? That kind of change I'd feel okay about backporting now and would at least buy us some time to solicit feedback on requiring the WorkloadIdentity webhooks and planning a transition if we find that's a better long-term solution.

@JRBANCEL
Copy link
Author

JRBANCEL commented Mar 28, 2024

Introducing a requirement to install the webhooks would be a breaking change.

Is using Workload Identity on AKS without the WI webhook even supported?
Official documentation requires to specify --enable-workload-identity which installs the WI webhook, no?

Is there a way we could instead annotate the CAPZ pod so that the webhook ignores it?

For #4681, no. Because we need the WI magic to be done on the host cluster (via webhook) and not at the source (inside vCluster).

Copy link

codecov bot commented Mar 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.73%. Comparing base (d0f78e0) to head (51f03e4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4682      +/-   ##
==========================================
+ Coverage   62.71%   62.73%   +0.01%     
==========================================
  Files         192      192              
  Lines       15641    15641              
==========================================
+ Hits         9810     9812       +2     
+ Misses       5148     5146       -2     
  Partials      683      683              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@k8s-ci-robot
Copy link
Contributor

@JRBANCEL: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-azure-e2e-optional 51f03e4 link false /test pull-cluster-api-provider-azure-e2e-optional
pull-cluster-api-provider-azure-e2e-aks 51f03e4 link true /test pull-cluster-api-provider-azure-e2e-aks

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@mjnovice
Copy link
Contributor

@sonasingh46 do share your thoughts 🙏

@jackfrancis
Copy link
Contributor

@JRBANCEL @mjnovice This change may work for vcluster scenarios, but it will break existing WI use cases in non-vcluster scenarios.

What are you doing right now to make this work? Are you manually updating the capz-controller-manager Deployment resource after you bootstrap your mgmt cluster on your vcluster?

@mjnovice
Copy link
Contributor

@jackfrancis we are currently using kyverno to do tylhe patching on the host cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

CAPZ isn't compatible within a vcluster, with workload identity enabled on AKS.
6 participants