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

PR - Fixed IPAM full issue in certain cases #89

Merged
merged 1 commit into from
Jan 19, 2024
Merged
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
19 changes: 18 additions & 1 deletion pkg/agent/manager/loadbalancer/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,20 @@ func (m *Manager) addLoadBalancer(svc *corev1.Service) error {
if delete {
m.deleteLoadBalancer(svc.Namespace, svc.Name)
}
if added {
for _, lb := range m.lbCache[cacheKey].LbModelList {
for idx := range ingSvcPairs {
ingSvcPair := &ingSvcPairs[idx]
if ingSvcPair.IPString == lb.LbModel.Service.ExternalIP &&
ingSvcPair.Port == int32(lb.LbModel.Service.Port) &&
ingSvcPair.Protocol == lb.LbModel.Service.Protocol {
ingSvcPair.InRange = lb.inRange
ingSvcPair.StaticIP = lb.staticIP
ingSvcPair.IdentIPAM = lb.IdentIPAM
}
}
}
}
m.lbCache[cacheKey].LbModelList = nil
if !hasExistingEIP {
svc.Status.LoadBalancer.Ingress = nil
Expand Down Expand Up @@ -1249,11 +1263,14 @@ func (m *Manager) DiscoverLoxiLBServices(loxiLBAliveCh chan *api.LoxiClient, lox
// DNS lookup (not used now)
// ips, err := net.LookupIP("loxilb-lb-service")
ips, err := k8s.GetServiceEndPoints(m.kubeClient, "loxilb-lb-service", "kube-system")
klog.Infof("loxilb-service end-points: %v", ips)
if err != nil {
ips = []net.IP{}
}

if len(ips) != len(m.LoxiClients) {
klog.Infof("loxilb-service end-points: %v", ips)
}

for _, v := range m.LoxiClients {
v.Purge = true
for _, ip := range ips {
Expand Down
Loading