Skip to content

Commit 52843a3

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 de16a94 commit 52843a3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/asset/manifests/aws/cluster.go

Lines changed: 20 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,25 @@ 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+
for i := range spec.ControlPlaneLoadBalancer.AdditionalListeners {
252+
listener := &spec.ControlPlaneLoadBalancer.AdditionalListeners[i]
253+
listener.TargetGroupIPType = &capa.TargetGroupIPTypeIPv4
254+
}
255+
256+
if spec.SecondaryControlPlaneLoadBalancer != nil {
257+
spec.SecondaryControlPlaneLoadBalancer.TargetGroupIPType = &capa.TargetGroupIPTypeIPv4
258+
for i := range spec.SecondaryControlPlaneLoadBalancer.AdditionalListeners {
259+
listener := &spec.SecondaryControlPlaneLoadBalancer.AdditionalListeners[i]
260+
listener.TargetGroupIPType = &capa.TargetGroupIPTypeIPv4
261+
}
262+
}
263+
}
264+
245265
// Set the NetworkSpec.Subnets from VPC and zones (managed) or subnets (BYO VPC) based in the install-config.yaml.
246266
// If subnet roles are assigned, set subnets for the ControlPlane LBs.
247267
err = setSubnets(context.TODO(), &networkInput{

0 commit comments

Comments
 (0)