Skip to content

Commit 06c3ea9

Browse files
hdurand0710oktalz
authored andcommitted
MINOR: set port to 1 for disabled servers at startup
and in config Co-authored-by: Zlatko Bratkovic<zbratkovic@haproxy.com>
1 parent c5da801 commit 06c3ea9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/service/endpoints.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/api"
2727
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/instance"
2828
"github.com/haproxytech/kubernetes-ingress/pkg/store"
29+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
2930
)
3031

3132
// HandleHAProxySrvs handles the haproxy backend servers of the corresponding IngressPath (service + port)
@@ -62,7 +63,7 @@ func (s *Service) HandleHAProxySrvs(k8s store.K8s, client api.HAProxyClient) {
6263
func (s *Service) updateHAProxySrv(client api.HAProxyClient, srvSlot store.HAProxySrv, port int64) {
6364
srv := models.Server{
6465
Name: srvSlot.Name,
65-
Port: &port,
66+
Port: utils.PtrInt64(1),
6667
Address: "127.0.0.1",
6768
ServerParams: models.ServerParams{Maintenance: "enabled"},
6869
}
@@ -72,6 +73,7 @@ func (s *Service) updateHAProxySrv(client api.HAProxyClient, srvSlot store.HAPro
7273
// Enable Server
7374
if srvSlot.Address != "" {
7475
srv.Address = srvSlot.Address
76+
srv.Port = &port
7577
srv.Maintenance = "disabled"
7678
}
7779
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)