-
Notifications
You must be signed in to change notification settings - Fork 450
Description
/kind feature
Describe the solution you'd like
Currently, CAPZ uses hardcoded names for the API server load balancer rule (LBRuleHTTPS
), health probe (HTTPSProbe
) and outbound rule for NAT (OutboundNATAllProtocols
), making it impossible to reuse existing networking resources. The use case is to adopt existing kubeadm-based clusters into CAPZ where these resources already exist with different names. Cluster adoption works if the LB rule and health probe are named exactly as CAPZ expects, but renaming these resources requires destroying and recreating the resource, which is not desirable as it will result in some downtime. We can also minimize downtime by leveraging additionalAPIServerLBPorts
but it'd be much cleaner to have this support added to CAPZ.
CAPZ already supports customizing the API server load balancer name and backend pool name via spec.networkSpec.apiServerLB.name
and spec.networkSpec.apiServerLB.backendPool.name
, respectively. While I'm aware that this is not a BYO load balancer feature, as the API server load balancer is always managed by CAPZ and it may end up updating these resources, it works for our use case as it allows CAPZ to reuse the existing networking resources.
I propose adding three new fields apiServerLoadBalancerRule
, apiServerHealthProbe
and apiServerOutboundRule
to spec.networkSpec.apiServerLB
that allow configuring the load balancer rule name, health probe name and outbound rule name for the API server via a name
field, as in
type LoadBalancerSpec struct {
// APIServerHealthProbe defines the API server health probe configuration
// +optional
APIServerHealthProbe APIServerHealthProbe `json:"apiServerHealthProbe,omitempty"`
// APIServerLoadBalancerRule defines the API server load balancer rule configuration
// +optional
APIServerLoadBalancerRule APIServerLoadBalancerRule `json:"apiServerLoadBalancerRule,omitempty"`
// APIServerOutboundRule defines the API server outbound rule configuration
// +optional
APIServerOutboundRule APIServerOutboundRule `json:"apiServerOutboundRule,omitempty"`
}
type APIServerLoadBalancerRule struct {
// Name specifies the name of the API server load balancer rule.
// +optional
Name string `json:"name,omitempty"`
}
type APIServerHealthProbe struct {
// Name specifies the name of the API server health probe.
// +optional
Name string `json:"name,omitempty"`
}
type APIServerOutboundRule struct {
// Name specifies the name of the API server outbound rule.
// +optional
Name string `json:"name,omitempty"`
}
When these name
fields are empty, they'll default to the existing hardcoded values. The prefix apiServer
can be dropped from the field names if it's too verbose.
This is in a similar vein to how support for custom backend pool names was added.
I'm happy to contribute a PR for this enhancement if it aligns with CAPZ's roadmap and goals.
Environment:
- cluster-api-provider-azure version: v1.20.0
- Kubernetes version: (use
kubectl version
): v1.32 - OS (e.g. from
/etc/os-release
):
Metadata
Metadata
Assignees
Labels
Type
Projects
Status