Skip to content

Commit

Permalink
Merge pull request #815 from TrekkieCoder/main
Browse files Browse the repository at this point in the history
PR: graceful handling when max endpoint limit is reached
  • Loading branch information
UltraInstinct14 authored Sep 28, 2024
2 parents a462122 + be57f53 commit 8cd0d32
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit 8cd0d32

Please sign in to comment.