Skip to content

Commit

Permalink
graceful handling when max endpoint limit is reached
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Sep 28, 2024
1 parent a462122 commit be57f53
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 be57f53

Please sign in to comment.