Skip to content

Commit 9d67f40

Browse files
committed
fix: Prevens setting LoadBalancerIP when AWS-specific annotations are present
Addresses #688, this commit adds a check to the ControlPlane service's annotations. If the `spec.loadBalancerIP` property is set in the service, the AWS cloud controller will complain and causes issues. The controller now checks for the presence of these specific annotations and avoids setting the LoadBalancerIP to ensure that the service is correctly configured according to AWS requirements.
1 parent 899da1a commit 9d67f40

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/resources/k8s_service_resource.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ func (r *KubernetesServiceResource) mutate(ctx context.Context, tenantControlPla
106106
if len(tenantControlPlane.Spec.NetworkProfile.LoadBalancerSourceRanges) > 0 {
107107
r.resource.Spec.LoadBalancerSourceRanges = tenantControlPlane.Spec.NetworkProfile.LoadBalancerSourceRanges
108108
}
109-
if len(address) > 0 {
109+
110+
// hack: Load Balancer IP should not be added to avoid the AWS Load Balancer get stuck
111+
_, hasLbAwsEipAllocations := r.resource.Annotations["service.beta.kubernetes.io/aws-load-balancer-eip-allocations"]
112+
if len(address) > 0 && !hasLbAwsEipAllocations {
110113
r.resource.Spec.LoadBalancerIP = address
111114
}
112115
case kamajiv1alpha1.ServiceTypeNodePort:

0 commit comments

Comments
 (0)