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

ippool: gracefully exit with proper logs if ippool got exhausted #153

Merged
merged 1 commit into from
Jun 25, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/agent/manager/gatewayapi/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func (gm *GatewayManager) createGateway(gw *v1.Gateway) error {
newIP, identIPAM := ipPool.GetNewIPAddr(GenKey(gw.Namespace, gw.Name), 0, "")
if newIP == nil {
klog.Error("gateway ip pool failure")
klog.Exit("kube-loxilb cant run optimally anymore")
return fmt.Errorf("failed to generate gateway address")
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/agent/manager/loadbalancer/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,7 @@ func (m *Manager) getIngressSvcPairs(service *corev1.Service, addrType string, l
newIP, identIPAM = ipPool.GetNewIPAddr(cacheKey, uint32(portNum), proto)
if newIP == nil {
klog.Errorf("failed to generate external IP. IP Pool is full")
klog.Exit("kube-loxilb cant run optimally anymore")
return nil, errors.New("failed to generate external IP. IP Pool is full"), hasExtIPAllocated
}
sp = SvcPair{newIP.String(), portNum, proto, true, false, identIPAM, true, port}
Expand Down Expand Up @@ -1505,6 +1506,7 @@ func (m *Manager) getIngressSecSvcPairs(service *corev1.Service, numSecondary in
rpool.ReturnIPAddr(sPairs[j].IPString, sPairs[j].IdentIPAM)
}
klog.Errorf("failed to generate external secondary IP. IP Pool is full")
klog.Exit("kube-loxilb cant run optimally anymore")
return nil, errors.New("failed to generate external secondary IP. IP Pool is full")
}
sp := SvcPair{newIP.String(), portNum, proto, true, false, identIPAM, true, port}
Expand Down
Loading