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

[release-4.15] OCPBUGS-32246: Remove enforcement of IPv6 LB as internal #277

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/openstack/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ const (
eventLBExternalNetworkSearchFailed = "LoadBalancerExternalNetworkSearchFailed"
eventLBSourceRangesIgnored = "LoadBalancerSourceRangesIgnored"
eventLBAZIgnored = "LoadBalancerAvailabilityZonesIgnored"
eventLBFloatingIPSkipped = "LoadBalancerFloatingIPSkipped"
)
24 changes: 15 additions & 9 deletions pkg/openstack/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,10 @@ func (lbaas *LbaasV2) createOctaviaLoadBalancer(name, clusterName string, servic

// For external load balancer, the LoadBalancerIP is a public IP address.
loadBalancerIP := service.Spec.LoadBalancerIP
if loadBalancerIP != "" && svcConf.internal {
createOpts.VipAddress = loadBalancerIP
if loadBalancerIP != "" {
if svcConf.internal || (svcConf.preferredIPFamily == corev1.IPv6Protocol) {
createOpts.VipAddress = loadBalancerIP
}
}

if !lbaas.opts.ProviderRequiresSerialAPICalls {
Expand Down Expand Up @@ -1651,9 +1653,6 @@ func (lbaas *LbaasV2) checkService(service *corev1.Service, nodes []*corev1.Node
klog.V(3).InfoS("Enforcing internal LB", "annotation", true, "config", false)
}
svcConf.internal = true
} else if svcConf.preferredIPFamily == corev1.IPv6Protocol {
// floating IPs are not supported in IPv6 networks
svcConf.internal = true
} else {
svcConf.internal = getBoolFromServiceAnnotation(service, ServiceAnnotationLoadBalancerInternal, lbaas.opts.InternalLB)
}
Expand Down Expand Up @@ -2066,11 +2065,18 @@ func (lbaas *LbaasV2) ensureOctaviaLoadBalancer(ctx context.Context, clusterName
}
}

addr, err := lbaas.ensureFloatingIP(clusterName, service, loadbalancer, svcConf, isLBOwner)
if err != nil {
return nil, err
addr := loadbalancer.VipAddress
// IPv6 Load Balancers have no support for Floating IP.
if netutils.IsIPv6String(addr) {
msg := "Floating IP not supported for IPv6 Service %s. Using IPv6 address instead %s."
lbaas.eventRecorder.Eventf(service, corev1.EventTypeWarning, eventLBFloatingIPSkipped, msg, serviceName, addr)
klog.Infof(msg, serviceName, addr)
} else {
addr, err = lbaas.ensureFloatingIP(clusterName, service, loadbalancer, svcConf, isLBOwner)
if err != nil {
return nil, err
}
}

// Add annotation to Service and add LB name to load balancer tags.
annotationUpdate := map[string]string{
ServiceAnnotationLoadBalancerID: loadbalancer.ID,
Expand Down