From 20bceda22851f65b1d24de7d5f77ced8f303a9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20L=C3=B3pez=20Ruiz?= Date: Tue, 24 Sep 2024 10:46:12 +0200 Subject: [PATCH] Fix runtime not update state --- pkg/haproxy/api/runtime.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/haproxy/api/runtime.go b/pkg/haproxy/api/runtime.go index 4b304be5..035f371c 100644 --- a/pkg/haproxy/api/runtime.go +++ b/pkg/haproxy/api/runtime.go @@ -8,6 +8,7 @@ import ( "github.com/haproxytech/kubernetes-ingress/pkg/store" "github.com/haproxytech/kubernetes-ingress/pkg/utils" + "github.com/haproxytech/kubernetes-ingress/pkg/zone" ) var ErrMapNotFound = fmt.Errorf("map not found") @@ -130,7 +131,11 @@ func (c *clientNative) SyncBackendSrvs(backend *store.RuntimeBackend, portUpdate } else { logger.Tracef("[RUNTIME] [BACKEND] [SERVER] [SOCKET] backend %s: server '%s': addr '%s' changed status to %v", backend.Name, srv.Name, srv.Address, "ready") addrErr = c.SetServerAddr(backend.Name, srv.Name, srv.Address, int(backend.Endpoints.Port)) - stateErr = c.SetServerState(backend.Name, srv.Name, "ready") + if zone.IsBackupEnabledForThisIP(srv.Address) { + stateErr = c.SetServerState(backend.Name, srv.Name, "backup") + } else { + stateErr = c.SetServerState(backend.Name, srv.Name, "ready") + } } if addrErr != nil || stateErr != nil { backend.DynUpdateFailed = true