Skip to content

Commit acc5141

Browse files
hdurand0710oktalz
authored andcommitted
MINOR: set port to 1 for disabled servers at startup
and in config Co-authored-by: Zlatko Bratkovic<[email protected]>
1 parent 8d241e4 commit acc5141

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/service/endpoints.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/api"
2626
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/instance"
2727
"github.com/haproxytech/kubernetes-ingress/pkg/store"
28+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
2829
)
2930

3031
// HandleHAProxySrvs handles the haproxy backend servers of the corresponding IngressPath (service + port)
@@ -60,7 +61,7 @@ func (s *Service) HandleHAProxySrvs(k8s store.K8s, client api.HAProxyClient) {
6061
func (s *Service) updateHAProxySrv(client api.HAProxyClient, srvSlot store.HAProxySrv, port int64) {
6162
srv := models.Server{
6263
Name: srvSlot.Name,
63-
Port: &port,
64+
Port: utils.PtrInt64(1),
6465
Address: "127.0.0.1",
6566
ServerParams: models.ServerParams{Maintenance: "enabled"},
6667
}
@@ -70,6 +71,7 @@ func (s *Service) updateHAProxySrv(client api.HAProxyClient, srvSlot store.HAPro
7071
// Enable Server
7172
if srvSlot.Address != "" {
7273
srv.Address = srvSlot.Address
74+
srv.Port = &port
7375
srv.Maintenance = "disabled"
7476
}
7577
logger.Tracef("[CONFIG] [BACKEND] [SERVER] backend %s: about to update server in configuration file : models.Server { Name: %s, Port: %d, Address: %s, Maintenance: %s }", s.backend.Name, srv.Name, *srv.Port, srv.Address, srv.Maintenance)

0 commit comments

Comments
 (0)