Skip to content

Commit

Permalink
Update Origin Server Naming in HAProxy (#105)
Browse files Browse the repository at this point in the history
* update origin server naming in haproxy

Signed-off-by: Stephen Hwang <[email protected]>

* update golancgi-lint

Signed-off-by: Stephen Hwang <[email protected]>

---------

Signed-off-by: Stephen Hwang <[email protected]>
  • Loading branch information
sthwang-metal authored May 8, 2024
1 parent 53adf7f commit 4d84fa6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ linters-settings:
linters:
enable:
# default linters
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck

# additional linters
- bodyclose
Expand Down
2 changes: 1 addition & 1 deletion internal/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func mergeConfig(cfg parser.Parser, lb *lbapi.LoadBalancer) (parser.Parser, erro
}

srvr := types.Server{
Name: origin.Node.ID,
Name: fmt.Sprintf("%s::%s", origin.Node.ID, origin.Node.Target),
Address: srvAddr,
}

Expand Down
1 change: 1 addition & 0 deletions internal/manager/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ func TestProcessMsg(t *testing.T) {
if tt.errMsg != "" {
require.Error(t, err)
assert.ErrorContains(t, err, tt.errMsg)

return
}

Expand Down
6 changes: 3 additions & 3 deletions internal/manager/testdata/lb-ex-1-exp.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ frontend stats
http-request use-service prometheus-exporter if { path /metrics }

backend loadprt-test
server loadogn-test1 1.2.3.4:2222 check port 2222 weight 20
server loadogn-test2 1.2.3.4:222 check port 222 weight 30
server loadogn-test3 4.3.2.1:2222 check port 2222 weight 50 disabled
server loadogn-test1::1.2.3.4 1.2.3.4:2222 check port 2222 weight 20
server loadogn-test2::1.2.3.4 1.2.3.4:222 check port 222 weight 30
server loadogn-test3::4.3.2.1 4.3.2.1:2222 check port 2222 weight 50 disabled

program dataplaneapi
command dataplaneapi -f /bitnami/haproxy/conf/dataplaneapi.yaml
Expand Down
8 changes: 4 additions & 4 deletions internal/manager/testdata/lb-ex-2-exp.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ frontend stats
http-request use-service prometheus-exporter if { path /metrics }

backend loadprt-test
server loadogn-test1 1.2.3.4:2222 check port 2222 weight 20
server loadogn-test2 1.2.3.4:222 check port 222 weight 30
server loadogn-test3 4.3.2.1:2222 check port 2222 weight 50 disabled
server loadogn-test4 7.8.9.0:2222 check port 2222 weight 100
server loadogn-test1::1.2.3.4 1.2.3.4:2222 check port 2222 weight 20
server loadogn-test2::1.2.3.4 1.2.3.4:222 check port 222 weight 30
server loadogn-test3::4.3.2.1 4.3.2.1:2222 check port 2222 weight 50 disabled
server loadogn-test4::7.8.9.0 7.8.9.0:2222 check port 2222 weight 100

program dataplaneapi
command dataplaneapi -f /bitnami/haproxy/conf/dataplaneapi.yaml
Expand Down
4 changes: 2 additions & 2 deletions internal/manager/testdata/lb-ex-3-exp.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ frontend stats
http-request use-service prometheus-exporter if { path /metrics }

backend loadprt-testhttp
server loadogn-test1 3.1.4.1:80 check port 80 weight 1
server loadogn-test1::3.1.4.1 3.1.4.1:80 check port 80 weight 1

backend loadprt-testhttps
server loadogn-test2 3.1.4.1:443 check port 443 weight 90
server loadogn-test2::3.1.4.1 3.1.4.1:443 check port 443 weight 90

program dataplaneapi
command dataplaneapi -f /bitnami/haproxy/conf/dataplaneapi.yaml
Expand Down

0 comments on commit 4d84fa6

Please sign in to comment.