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: graceful handling when max endpoint limit is reached #815

Merged
merged 1 commit into from
Sep 28, 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
9 changes: 7 additions & 2 deletions pkg/loxinet/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ func (R *RuleH) AddLbRule(serv cmn.LbServiceArg, servSecIPs []cmn.LbSecIPArg, se
return RuleArgsErr, errors.New("malformed-service-pport error")
}

// Currently support a maximum of MAX_NAT_EPS
// Currently support a maximum of MaxLBEndPoints
if len(servEndPoints) <= 0 || len(servEndPoints) > MaxLBEndPoints {
return RuleEpCountErr, errors.New("endpoints-range error")
}
Expand Down Expand Up @@ -1573,8 +1573,13 @@ func (R *RuleH) AddLbRule(serv cmn.LbServiceArg, servSecIPs []cmn.LbSecIPArg, se
return RuleExistsErr, errors.New("lbrule-exist error: cant modify fullproxy rule mode")
}

if eRule.act.action.(*ruleLBActs).mode == cmn.LBModeFullProxy {
if eRule.act.action.(*ruleLBActs).mode == cmn.LBModeFullProxy || len(retEps) > MaxLBEndPoints {
eRule.DP(DpRemove)
if len(retEps) > MaxLBEndPoints {
tk.LogIt(tk.LogInfo, "lb-rule %s-%v-%s reset all end-points (too many)\n", serv.ServIP, serv.ServPort, serv.Proto)
delEps = eRule.act.action.(*ruleLBActs).endPoints
retEps = lBActs.endPoints
}
}

// Update the rule
Expand Down
Loading