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

Support any bootstrap provider with MachinePools #5403

Conversation

anmazzotti
Copy link

What type of PR is this?

/kind feature

What this PR does / why we need it:

This patch makes the AzureMachinePool controller (Bootstrap)Config agnostic.

Instead watching KubeadmConfigs (or any other custom config added via bootstrap-config-gvk argument), the controller is now watching any bootstrap secret directly, bypassing the config layer.
As per bootstrap contract, the watch logic works in the following way:

  1. Only watch cluster.x-k8s.io/cluster-name labeled Secrets
  2. Retrieve the (Bootstrap)Config name and kind from the first controller owner reference on the bootstrap Secret
  3. (This step was not changed by this PR) Assume the (Bootstrap)Config name has the same name of its related MachinePool to enqueue an also related AzureMachinePool reconcile.

Note that since we are not watching KubeadmConfigs directly, the related RBAC permission was also cleaned up.
Since we don't actually trying to fetch any (Bootstrap)Config, there is no need for further RBAC settings when using other Bootstrap providers.

This should now also work in case of users providing their bootstrap Secret manually, assigning a custom DataSecretName in their (Bootstrap)Config. Still assuming they respect the contract linked above when creating the custom Secret.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes rancher/highlander#100

Special notes for your reviewer:

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • cherry-pick candidate

Release note:

action required
The `bootstrap-config-gvk` controller argument has been deprecated. The controller is now able to work with all [bootstrap providers](https://cluster-api.sigs.k8s.io/reference/providers#bootstrap).  
Users managing their own bootstrap Secrets, by configuring the `Machine.spec.bootstrap.dataSecretName` manually, are expected to respect the [bootstrap secret contract](https://cluster-api.sigs.k8s.io/developer/providers/contracts/bootstrap-config#bootstrapconfig-data-secret).

@k8s-ci-robot k8s-ci-robot added release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. kind/feature Categorizes issue or PR as related to a new feature. labels Feb 3, 2025
Copy link

linux-foundation-easycla bot commented Feb 3, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: anmazzotti / name: Andrea Mazzotti (1660865)

@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 nawazkh for approval. For more information see the 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 @anmazzotti!

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. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 3, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @anmazzotti. 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 3, 2025
@alexander-demicev
Copy link
Contributor

/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 Feb 3, 2025
@@ -258,12 +257,6 @@ func InitFlags(fs *pflag.FlagSet) {
"Enable tracing to the opentelemetry-collector service in the same namespace.",
)

fs.StringVar(&azureBootrapConfigGVK,
Copy link
Contributor

Choose a reason for hiding this comment

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

is flag removal considered a breaking change?

Copy link
Author

Choose a reason for hiding this comment

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

Good question. I think it is, but on the other hand this is still experimental and I doubt anyone is using it at the moment.

If we want to be extra safe I can simply keep it and just print an error(?) message informing the user it's deprecated.

@anmazzotti
Copy link
Author

/retest

@k8s-ci-robot
Copy link
Contributor

@anmazzotti: The following test 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-aks 1660865 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-sigs/prow repository. I understand the commands that are listed here.

@anmazzotti anmazzotti marked this pull request as draft February 5, 2025 18:32
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 5, 2025
@anmazzotti
Copy link
Author

Switching the PR back to Draft as we just discussed in the CAPI community meeting a cleaner approach with dynamic watches.

@anmazzotti
Copy link
Author

Closing this PR in favor of a better approach: #5416

@anmazzotti anmazzotti closed this Feb 6, 2025
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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Enable creating kubeadm and RKE2 cluster in CAPZ
3 participants