Skip to content

Commit 32f7fa6

Browse files
mhofstetteraanm
authored andcommitted
loadbalancer: Fix backend state in REST API
The new Cilium LB controlplane introduced a new property `Unhealthy` on the backend params which allows for healthchecker extensions to report a backend as unhealthy. The LB backend selection respects the `State` & `Unhealthy` properties of the backend. While introducing the new property, there was an oversight of `cilium-dbg service list` which still shows the backend state as `active` even though the backend is reported as `unhealthy`. Therefore, this commit changes the LB REST API implementation to report the state of a backend as `quarantined` if `Unhealthy==true`. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
1 parent 32034ef commit 32f7fa6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

pkg/loadbalancer/frontend.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"k8s.io/apimachinery/pkg/util/duration"
1717

1818
"github.com/cilium/cilium/api/v1/models"
19-
2019
"github.com/cilium/cilium/pkg/option"
2120
"github.com/cilium/cilium/pkg/time"
2221
)
@@ -158,7 +157,13 @@ func (fe *Frontend) ToModel() *models.Service {
158157

159158
backendModel := func(be BackendParams) *models.BackendAddress {
160159
addrClusterStr := be.Address.AddrCluster.String()
161-
stateStr, _ := be.State.String()
160+
161+
state := be.State
162+
if be.Unhealthy {
163+
state = BackendStateQuarantined
164+
}
165+
stateStr, _ := state.String()
166+
162167
return &models.BackendAddress{
163168
IP: &addrClusterStr,
164169
Protocol: be.Address.Protocol,

0 commit comments

Comments
 (0)