Skip to content

Commit

Permalink
gh-48 Add support for url-path in LB args
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Jul 15, 2024
1 parent 2affddb commit cee717f
Show file tree
Hide file tree
Showing 12 changed files with 916 additions and 90 deletions.
3 changes: 3 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.

2 changes: 1 addition & 1 deletion api/restapi/configure_loxilb_rest_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func configureAPI(api *operations.LoxilbRestAPIAPI) http.Handler {

// Load balancer add and delete and get
api.PostConfigLoadbalancerHandler = operations.PostConfigLoadbalancerHandlerFunc(handler.ConfigPostLoadbalancer)
api.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandler = operations.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(handler.ConfigDeleteLoadbalancer)
api.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandler = operations.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoHandlerFunc(handler.ConfigDeleteLoadbalancer)
api.GetConfigLoadbalancerAllHandler = operations.GetConfigLoadbalancerAllHandlerFunc(handler.ConfigGetLoadbalancer)
api.DeleteConfigLoadbalancerAllHandler = operations.DeleteConfigLoadbalancerAllHandlerFunc(handler.ConfigDeleteAllLoadbalancer)
api.DeleteConfigLoadbalancerNameLbNameHandler = operations.DeleteConfigLoadbalancerNameLbNameHandlerFunc(handler.ConfigDeleteLoadbalancerByName)
Expand Down
162 changes: 94 additions & 68 deletions api/restapi/embedded_spec.go

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

5 changes: 4 additions & 1 deletion api/restapi/handler/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func ConfigPostLoadbalancer(params operations.PostConfigLoadbalancerParams) midd
lbRules.Serv.ProbeRetries = int(params.Attr.ServiceArguments.ProbeRetries)
lbRules.Serv.Name = params.Attr.ServiceArguments.Name
lbRules.Serv.Oper = cmn.LBOp(params.Attr.ServiceArguments.Oper)
lbRules.Serv.Path = params.Attr.ServiceArguments.Path

if lbRules.Serv.Proto == "sctp" {
for _, data := range params.Attr.SecondaryIPs {
Expand Down Expand Up @@ -77,14 +78,15 @@ func ConfigPostLoadbalancer(params operations.PostConfigLoadbalancerParams) midd
return &ResultResponse{Result: "Success"}
}

func ConfigDeleteLoadbalancer(params operations.DeleteConfigLoadbalancerExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder {
func ConfigDeleteLoadbalancer(params operations.DeleteConfigLoadbalancerUrlpathUrlpathExternalipaddressIPAddressPortPortProtocolProtoParams) middleware.Responder {
tk.LogIt(tk.LogDebug, "[API] Load balancer %s API called. url : %s\n", params.HTTPRequest.Method, params.HTTPRequest.URL)

var lbServ cmn.LbServiceArg
var lbRules cmn.LbRuleMod
lbServ.ServIP = params.IPAddress
lbServ.ServPort = uint16(params.Port)
lbServ.Proto = params.Proto
lbServ.Path = params.Urlpath
if params.Block != nil {
lbServ.BlockNum = uint16(*params.Block)
}
Expand Down Expand Up @@ -133,6 +135,7 @@ func ConfigGetLoadbalancer(params operations.GetConfigLoadbalancerAllParams) mid
tmpSvc.Probeport = lb.Serv.ProbePort
tmpSvc.Name = lb.Serv.Name
tmpSvc.Snat = lb.Serv.Snat
tmpSvc.Path = lb.Serv.Path

tmpLB.ServiceArguments = &tmpSvc

Expand Down

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

Loading

0 comments on commit cee717f

Please sign in to comment.