Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ingress

import (
hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1"
"github.com/openshift/hypershift/support/azureutil"
"github.com/openshift/hypershift/support/globalconfig"

configv1 "github.com/openshift/api/config/v1"
Expand Down Expand Up @@ -47,7 +48,12 @@ func NewIngressParams(hcp *hyperv1.HostedControlPlane) *IngressParams {
loadBalancerScope = v1.InternalLoadBalancer
}
}
// For self-managed Azure clusters, set internal LB scope when topology
// requires private connectivity. ARO HCP clusters are excluded because
// they use shared ingress — the guest cluster's ingress operator should
// not create a per-cluster internal LB that bypasses the shared router.
if hcp.Spec.Platform.Type == hyperv1.AzurePlatform && hcp.Spec.Platform.Azure != nil &&
!azureutil.IsAroHCPByHCP(hcp) &&
(hcp.Spec.Platform.Azure.Topology == hyperv1.AzureTopologyPrivate ||
hcp.Spec.Platform.Azure.Topology == hyperv1.AzureTopologyPublicAndPrivate) {
loadBalancerScope = v1.InternalLoadBalancer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,92 @@ func TestNewIngressParams(t *testing.T) {
LoadBalancerScope: v1.InternalLoadBalancer,
},
},
{
name: "When ARO HCP Azure topology is PublicAndPrivate it should set external load balancer scope",
args: args{
hcp: &hyperv1.HostedControlPlane{
Spec: hyperv1.HostedControlPlaneSpec{
Platform: hyperv1.PlatformSpec{
Type: hyperv1.AzurePlatform,
Azure: &hyperv1.AzurePlatformSpec{
Topology: hyperv1.AzureTopologyPublicAndPrivate,
AzureAuthenticationConfig: hyperv1.AzureAuthenticationConfiguration{
AzureAuthenticationConfigType: hyperv1.AzureAuthenticationTypeManagedIdentities,
},
},
},
},
},
},
want: &IngressParams{
IngressSubdomain: "apps.",
Replicas: 1,
PlatformType: hyperv1.AzurePlatform,
IsPrivate: false,
IBMCloudUPI: false,
AWSNLB: false,
LoadBalancerScope: v1.ExternalLoadBalancer,
},
},
{
name: "When ARO HCP Azure topology is Private it should set external load balancer scope",
args: args{
hcp: &hyperv1.HostedControlPlane{
Spec: hyperv1.HostedControlPlaneSpec{
Platform: hyperv1.PlatformSpec{
Type: hyperv1.AzurePlatform,
Azure: &hyperv1.AzurePlatformSpec{
Topology: hyperv1.AzureTopologyPrivate,
AzureAuthenticationConfig: hyperv1.AzureAuthenticationConfiguration{
AzureAuthenticationConfigType: hyperv1.AzureAuthenticationTypeManagedIdentities,
},
},
},
},
},
},
want: &IngressParams{
IngressSubdomain: "apps.",
Replicas: 1,
PlatformType: hyperv1.AzurePlatform,
IsPrivate: false,
IBMCloudUPI: false,
AWSNLB: false,
LoadBalancerScope: v1.ExternalLoadBalancer,
},
},
{
name: "When ARO HCP has IngressControllerLoadBalancerScope annotation set to Internal it should respect it",
args: args{
hcp: &hyperv1.HostedControlPlane{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
hyperv1.IngressControllerLoadBalancerScope: string(v1.InternalLoadBalancer),
},
},
Spec: hyperv1.HostedControlPlaneSpec{
Platform: hyperv1.PlatformSpec{
Type: hyperv1.AzurePlatform,
Azure: &hyperv1.AzurePlatformSpec{
Topology: hyperv1.AzureTopologyPublicAndPrivate,
AzureAuthenticationConfig: hyperv1.AzureAuthenticationConfiguration{
AzureAuthenticationConfigType: hyperv1.AzureAuthenticationTypeManagedIdentities,
},
},
},
},
},
},
want: &IngressParams{
IngressSubdomain: "apps.",
Replicas: 1,
PlatformType: hyperv1.AzurePlatform,
IsPrivate: false,
IBMCloudUPI: false,
AWSNLB: false,
LoadBalancerScope: v1.InternalLoadBalancer,
},
},
{
name: "When Azure endpoint access is Public it should set external load balancer scope",
args: args{
Expand Down