-
Notifications
You must be signed in to change notification settings - Fork 427
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
base: main
Are you sure you want to change the base?
Conversation
Welcome @rpahli! |
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 Once the patch is verified, the new status will be reflected by the 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. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
c.setAPIServerLBDefaults() | ||
if c.Spec.ControlPlaneEnabled { | ||
c.setAPIServerLBDefaults() | ||
} | ||
c.SetNodeOutboundLBDefaults() | ||
c.SetControlPlaneOutboundLBDefaults() |
There was a problem hiding this comment.
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.
c.SetControlPlaneOutboundLBDefaults() | ||
} | ||
if !c.Spec.ControlPlaneEnabled { | ||
c.Spec.NetworkSpec.APIServerLB = nil | ||
} |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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?
requiredSubnetRoles := map[string]bool{ | ||
"control-plane": false, | ||
"control-plane": !controlPlaneEnabled, | ||
"node": false, | ||
} |
There was a problem hiding this comment.
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.
azure/scope/cluster.go
Outdated
for _, ip := range s.ControlPlaneOutboundLB().FrontendIPs { | ||
controlPlaneOutboundIPSpecs = append(controlPlaneOutboundIPSpecs, &publicips.PublicIPSpec{ | ||
Name: ip.PublicIP.Name, | ||
if s.ControlPlaneEnabled() { |
There was a problem hiding this comment.
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.
config/capz/manager_image_patch.yaml
Outdated
@@ -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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
}
}
/ok-to-test |
Hey @rpahli 👋🏼 , how is this PR coming along ? |
125c187
to
2556a3c
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
423e1ec
to
3ad59ca
Compare
Hey @nawazkh I'm currently trying to fix the e2e tests. But all other tests look ok to me. |
@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? |
/retest |
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. |
Ok now it looks only the API die is failing which is expected. |
3ad59ca
to
21d3915
Compare
21d3915
to
0571951
Compare
@rpahli: The following test failed, say
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. |
/assign @mboersma |
PR needs rebase. 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. |
There was a problem hiding this 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.
@@ -45,6 +45,11 @@ type AzureClusterSpec struct { | |||
// +optional | |||
BastionSpec BastionSpec `json:"bastionSpec,omitempty"` | |||
|
|||
// ControlPlaneEnabled enable control plane cluster components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ControlPlaneEnabled enable control plane cluster components. | |
// ControlPlaneEnabled enables control plane components in the cluster. |
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:
TODOs:
Release note: