Skip to content

Commit d5cef48

Browse files
committed
api-lb: configure IP family for API LB target group
This applies to dualstack installation only. IPv4-primary: IPv4 Target Group IPv6-primary: Ipv6 Target Group
1 parent a5cfd5f commit d5cef48

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/asset/manifests/aws/cluster.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"k8s.io/utils/ptr"
1111
capa "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
1212

13+
v1 "github.com/openshift/api/machineconfiguration/v1"
1314
"github.com/openshift/installer/pkg/asset"
1415
"github.com/openshift/installer/pkg/asset/installconfig"
1516
"github.com/openshift/installer/pkg/asset/machines/aws"
@@ -242,6 +243,16 @@ func GenerateClusterAssets(ic *installconfig.InstallConfig, clusterID *installco
242243
)
243244
}
244245

246+
// If dualstack with IPv4 primary, we should use IPv4 target group.
247+
if ipFamily := ic.Config.InfraStack(); ipFamily == v1.IPFamiliesDualStack {
248+
spec := &awsCluster.Spec
249+
250+
spec.ControlPlaneLoadBalancer.TargetGroupIPType = &capa.TargetGroupIPTypeIPv4
251+
if spec.SecondaryControlPlaneLoadBalancer != nil {
252+
spec.SecondaryControlPlaneLoadBalancer.TargetGroupIPType = &capa.TargetGroupIPTypeIPv4
253+
}
254+
}
255+
245256
// Set the NetworkSpec.Subnets from VPC and zones (managed) or subnets (BYO VPC) based in the install-config.yaml.
246257
// If subnet roles are assigned, set subnets for the ControlPlane LBs.
247258
err = setSubnets(context.TODO(), &networkInput{

0 commit comments

Comments
 (0)