Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Prevents setting LoadBalancerIP when AWS-specific annotations are present #707

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 4 additions & 1 deletion internal/resources/k8s_service_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ func (r *KubernetesServiceResource) mutate(ctx context.Context, tenantControlPla
if len(tenantControlPlane.Spec.NetworkProfile.LoadBalancerSourceRanges) > 0 {
r.resource.Spec.LoadBalancerSourceRanges = tenantControlPlane.Spec.NetworkProfile.LoadBalancerSourceRanges
}
if len(address) > 0 {

// hack: Load Balancer IP should not be added to avoid the AWS Load Balancer get stuck
_, hasLbAwsEipAllocations := r.resource.Annotations["service.beta.kubernetes.io/aws-load-balancer-eip-allocations"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a better option, here:

The.spec.loadBalancerIP field for a Service was deprecated in Kubernetes v1.24.

source: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer

Let's remove at all the r.resource.Spec.LoadBalancerIP assignment and we'll be safe.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wow, good to know!
I think it might make more sense to close this then and open a new PR

if len(address) > 0 && !hasLbAwsEipAllocations {
r.resource.Spec.LoadBalancerIP = address
}
case kamajiv1alpha1.ServiceTypeNodePort:
Expand Down