Skip to content

Allow configuring the API server load balancer rule name and health probe name in AzureCluster #5726

@cPu1

Description

@cPu1

/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 two new fields loadBalancingRule and healthProbe to spec.networkSpec.apiServerLB that allow configuring the load balancer rule name and health probe name for the API server via a name field, as in

type LoadBalancerSpec struct {
	// LoadBalancingRule defines the load balancer rule configuration.
	// +optional
	LoadBalancingRule LoadBalancingRule `json:"loadBalancingRule,omitempty"`
	// HealthProbe defines the health probe configuration.
	// +optional
	HealthProbe HealthProbe `json:"healthProbe,omitempty"`
}

// LoadBalancingRule defines the load balancer rule configuration.
type LoadBalancingRule struct {
	// Name specifies the name of the load balancer rule.
	// +optional
	Name string `json:"name,omitempty"`
}

// HealthProbe defines the health probe configuration.
type HealthProbe struct {
	// Name specifies the name of the health probe.
	// +optional
	Name string `json:"name,omitempty"`
}

When these name fields are empty, they'll default to the existing hardcoded values.

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

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions