Skip to content

Commit 6a1f0fd

Browse files
committed
capi/aws: workaround CAPA ingress rules bug/behavior
CAPA does not apply rules specified only in the secondary load balancer. Add the rule to the primary LB instead, since both share the same security group.
1 parent 8ca65d9 commit 6a1f0fd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pkg/asset/manifests/aws/cluster.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,23 @@ func GenerateClusterAssets(installConfig *installconfig.InstallConfig, clusterID
175175
}
176176

177177
if installConfig.Config.Publish == types.ExternalPublishingStrategy {
178+
// FIXME: CAPA bug. Remove when fixed upstream
179+
// The primary and secondary load balancers in CAPA share the same
180+
// security group. However, specifying an ingress rule only in the
181+
// second LB does not seem to take effect, forcing us to add it to the
182+
// primary LB instead.
183+
// https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4865
184+
awsCluster.Spec.ControlPlaneLoadBalancer.IngressRules = append(
185+
awsCluster.Spec.ControlPlaneLoadBalancer.IngressRules,
186+
capa.IngressRule{
187+
Description: "Kubernetes API Server traffic for public access",
188+
Protocol: capa.SecurityGroupProtocolTCP,
189+
FromPort: 6443,
190+
ToPort: 6443,
191+
CidrBlocks: []string{"0.0.0.0/0"},
192+
},
193+
)
194+
178195
awsCluster.Spec.SecondaryControlPlaneLoadBalancer = &capa.AWSLoadBalancerSpec{
179196
Name: ptr.To(clusterID.InfraID + "-ext"),
180197
LoadBalancerType: capa.LoadBalancerTypeNLB,

0 commit comments

Comments
 (0)