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

enable the use of an external control plane #4611

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

rpahli
Copy link
Contributor

@rpahli rpahli commented Mar 1, 2024

What type of PR is this?

/kind feature

This PR enables the use off an external control plane (e.g. https://github.com/clastix/cluster-api-control-plane-provider-kamaji)

What this PR does / why we need it:

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 #

Special notes for your reviewer:

  • cherry-pick candidate

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Enable the use of an external control plane

Sorry, something went wrong.

@k8s-ci-robot k8s-ci-robot added 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. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 1, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @rpahli!

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 requested review from Jont828 and mboersma March 1, 2024 10:05
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 1, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @rpahli. 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 size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 8, 2024
@rpahli rpahli marked this pull request as ready for review April 9, 2024 07:12
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 9, 2024
@k8s-ci-robot k8s-ci-robot requested a review from marosset April 9, 2024 07:12
@rpahli
Copy link
Contributor Author

rpahli commented Apr 16, 2024

@marosset @mboersma any updates on this? Can I get a first review?

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 15, 2024
@rpahli
Copy link
Contributor Author

rpahli commented Jul 15, 2024

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 15, 2024
Comment on lines -61 to -63
c.setAPIServerLBDefaults()
if c.Spec.ControlPlaneEnabled {
c.setAPIServerLBDefaults()
}
c.SetNodeOutboundLBDefaults()
c.SetControlPlaneOutboundLBDefaults()
Copy link
Contributor

Choose a reason for hiding this comment

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

Does order here matter?

It would be cool if we could group these functions together to reduce cyclomatic complexity.

Comment on lines +66 to +70
c.SetControlPlaneOutboundLBDefaults()
}
if !c.Spec.ControlPlaneEnabled {
c.Spec.NetworkSpec.APIServerLB = nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than nulling values, it would be interesting to have a validation webhook complaining about the disparity of values: if the CP is disabled no values are allowed for the APIServerLB, if provided.

@@ -249,7 +266,7 @@ func (c *AzureCluster) setAPIServerLBDefaults() {
// SetNodeOutboundLBDefaults sets the default values for the NodeOutboundLB.
func (c *AzureCluster) SetNodeOutboundLBDefaults() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do worker nodes use the node outbound LB too?

Comment on lines 226 to 232
requiredSubnetRoles := map[string]bool{
"control-plane": false,
"control-plane": !controlPlaneEnabled,
"node": false,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be refactored this way:

requiredSubnetRoles := map[string]bool{
		"node": false,
	}
	
	if controlPlaneEnabled {
		requiredSubnetRoles["control-plane"] = false
	}

The key control-plane must not be present when the Control Plane is externally managed.

for _, ip := range s.ControlPlaneOutboundLB().FrontendIPs {
controlPlaneOutboundIPSpecs = append(controlPlaneOutboundIPSpecs, &publicips.PublicIPSpec{
Name: ip.PublicIP.Name,
if s.ControlPlaneEnabled() {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could avoid the multiple if nesting here, just having the IsAPIServerPrivate block, and put the ControlPlaneEnabled function in the else clause, since we need outbound LB only if the CP Load Balancer is enabled.

@@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: gcr.io/k8s-staging-cluster-api-azure/cluster-api-azure-controller:main
- image: localhost:5000/cluster-api-azure-controller-amd64:dev
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a reminder, amend the changes here.

}
if azureCluster.Spec.ControlPlaneEndpoint.Port == 0 {
azureCluster.Spec.ControlPlaneEndpoint.Port = clusterScope.APIServerPort()
if azureCluster.Spec.ControlPlaneEnabled {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to check the values also when the Control Plane is externally managed, something like this:

if !azureCluster.Spec.ControlPlaneEnabled {
		if azureCluster.Spec.ControlPlaneEndpoint.Host == "" {
			conditions.MarkFalse(azureCluster, infrav1.NetworkInfrastructureReadyCondition, "ExternallyManagedControlPlane", clusterv1.ConditionSeverityInfo, "Waiting for the Control Plane host")

			return reconcile.Result{}, nil
		} else if azureCluster.Spec.ControlPlaneEndpoint.Port == 0 {
			conditions.MarkFalse(azureCluster, infrav1.NetworkInfrastructureReadyCondition, "ExternallyManagedControlPlane", clusterv1.ConditionSeverityInfo, "Waiting for the Control Plane port")

			return reconcile.Result{}, nil
		}
	}

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 25, 2024
@mboersma
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 Jul 25, 2024
@mboersma mboersma added this to the v1.17 milestone Jul 25, 2024
@rpahli
Copy link
Contributor Author

rpahli commented Nov 13, 2024

Hey @nawazkh I'm currently trying to fix the e2e tests. But all other tests look ok to me.

@rpahli
Copy link
Contributor Author

rpahli commented Nov 14, 2024

@nawazkh can someone maybe support me with the e2e tests? Is it possible to debug the tests locally? Or do I need a azure account for that?

@nawazkh
Copy link
Member

nawazkh commented Nov 14, 2024

/retest

@nawazkh
Copy link
Member

nawazkh commented Nov 14, 2024

@nawazkh can someone maybe support me with the e2e tests? Is it possible to debug the tests locally? Or do I need a azure account for that?

I have triggered a retest since on the first look it looked like a timeout errors. Will dig deeper once it fails.

The best way to debug this would be to run the tests locally with an Azure account.

@rpahli
Copy link
Contributor Author

rpahli commented Nov 14, 2024

Ok now it looks only the API die is failing which is expected.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 15, 2024
@rpahli rpahli force-pushed the external-control-plane branch from 3ad59ca to 21d3915 Compare November 18, 2024 09:00
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 18, 2024
@rpahli rpahli force-pushed the external-control-plane branch from 21d3915 to 0571951 Compare November 18, 2024 10:22
@willie-yao
Copy link
Contributor

/assign @mboersma

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 22, 2024
Copy link
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

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

This looks good. Could you update the comment in the new field and do make generate? Sorry for the nitpick, but I see this needs to be rebased anyway.

@rpahli rpahli force-pushed the external-control-plane branch from 0571951 to 59e54a4 Compare November 25, 2024 10:50
@rpahli rpahli force-pushed the external-control-plane branch from 59e54a4 to 9698685 Compare November 25, 2024 11:00
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 25, 2024
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Nov 25, 2024

@rpahli: 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-apidiff 9698685 link false /test pull-cluster-api-provider-azure-apidiff

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.

Copy link
Contributor

@willie-yao willie-yao 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 Nov 25, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 10c3c7622804a9040dad3fff5b252caa398566f0

@willie-yao
Copy link
Contributor

/test pull-cluster-api-provider-azure-apiversion-upgrade

Copy link
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Thanks for your perseverance @rpahli!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mboersma

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 Nov 25, 2024
@k8s-ci-robot k8s-ci-robot merged commit d54979f into kubernetes-sigs:main Nov 25, 2024
19 of 20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Nov 25, 2024
@rpahli rpahli deleted the external-control-plane branch November 26, 2024 08:12
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. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

8 participants