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

gh-546: probetimeo/retry count configuration on LB creation #548

Merged
merged 2 commits into from
Feb 23, 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
6 changes: 6 additions & 0 deletions api/models/loadbalance_entry.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions api/restapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions api/restapi/handler/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func ConfigPostLoadbalancer(params operations.PostConfigLoadbalancerParams) midd
lbRules.Serv.ProbePort = params.Attr.ServiceArguments.Probeport
lbRules.Serv.ProbeReq = params.Attr.ServiceArguments.Probereq
lbRules.Serv.ProbeResp = params.Attr.ServiceArguments.Proberesp
lbRules.Serv.ProbeTimeout = params.Attr.ServiceArguments.ProbeTimeout
lbRules.Serv.ProbeRetries = int(params.Attr.ServiceArguments.ProbeRetries)
lbRules.Serv.Name = params.Attr.ServiceArguments.Name

if lbRules.Serv.Proto == "sctp" {
Expand Down
8 changes: 8 additions & 0 deletions api/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2445,6 +2445,14 @@ definitions:
type: integer
format: int32
description: value for inactivity timeout (in seconds)
probeTimeout:
type: integer
format: uint32
description: value for probe timer (in seconds)
probeRetries:
type: integer
format: int32
description: value for probe retries
name:
type: string
description: service name
Expand Down
4 changes: 4 additions & 0 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,10 @@ type LbServiceArg struct {
ProbeReq string `json:"probereq"`
// ProbeResp - Response string for liveness check
ProbeResp string `json:"proberesp"`
// ProbeTimeout - Probe Timeout
ProbeTimeout uint32 `json:"probeTimeout"`
// ProbeRetries - Probe Retries
ProbeRetries int `json:"probeRetries"`
// Name - Service name
Name string `json:"name"`
}
Expand Down
28 changes: 21 additions & 7 deletions loxinet/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,13 @@ type ruleStat struct {
}

type ruleProbe struct {
actChk bool
prbType string
prbPort uint16
prbReq string
prbResp string
actChk bool
prbType string
prbPort uint16
prbReq string
prbResp string
prbTimeo uint32
prbRetries int
}

type ruleEnt struct {
Expand Down Expand Up @@ -820,8 +822,16 @@ func (R *RuleH) modNatEpHost(r *ruleEnt, endpoints []ruleNatEp, doAddOp bool, li
var hopts epHostOpts
pType := ""
pPort := uint16(0)
hopts.inActTryThr = DflLbaInactiveTries
hopts.probeDuration = DflHostProbeTimeout
if r.hChk.prbRetries == 0 {
hopts.inActTryThr = DflLbaInactiveTries
} else {
hopts.inActTryThr = r.hChk.prbRetries
}
if r.hChk.prbTimeo == 0 {
hopts.probeDuration = DflHostProbeTimeout
} else {
hopts.probeDuration = r.hChk.prbTimeo
}
for _, nep := range endpoints {
if r.tuples.l4Prot.val == 6 {
pType = HostProbeConnectTCP
Expand Down Expand Up @@ -1373,6 +1383,8 @@ func (R *RuleH) AddNatLbRule(serv cmn.LbServiceArg, servSecIPs []cmn.LbSecIPArg,
eRule.hChk.prbPort = serv.ProbePort
eRule.hChk.prbReq = serv.ProbeReq
eRule.hChk.prbResp = serv.ProbeResp
eRule.hChk.prbRetries = serv.ProbeRetries
eRule.hChk.prbTimeo = serv.ProbeTimeout
eRule.act.action.(*ruleNatActs).sel = natActs.sel
eRule.act.action.(*ruleNatActs).endPoints = eEps
eRule.act.action.(*ruleNatActs).mode = natActs.mode
Expand Down Expand Up @@ -1408,6 +1420,8 @@ func (R *RuleH) AddNatLbRule(serv cmn.LbServiceArg, servSecIPs []cmn.LbSecIPArg,
r.hChk.prbPort = serv.ProbePort
r.hChk.prbReq = serv.ProbeReq
r.hChk.prbResp = serv.ProbeResp
r.hChk.prbRetries = serv.ProbeRetries
r.hChk.prbTimeo = serv.ProbeTimeout
r.hChk.actChk = serv.Monitor
r.act.action = &natActs
r.ruleNum, err = R.tables[RtLB].Mark.GetCounter()
Expand Down
Loading