Skip to content

Commit

Permalink
BUG/MINOR: avoid hard restarts when the number of endpoints reaches zero
Browse files Browse the repository at this point in the history
If the number of endpoints of a service reaches zero the haproxy does
a forced restart. this scenario happens, for example, during a deploy/rollout
of a workload with `replicas: 1` or if the rolling strategy of the workload has
`maxUnavailable: 100%`.
  • Loading branch information
fabianonunes committed Aug 31, 2023
1 parent 6d18884 commit 03fb538
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/store/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ func (k *K8s) EventEndpoints(ns *Namespace, data *Endpoints, syncHAproxySrvs fun
endpoints := getEndpoints(ns.Endpoints[data.Service])
logger.Tracef("service %s : endpoints list %+v", data.Service, endpoints)
_, ok := ns.HAProxyRuntime[data.Service]
if !ok || len(endpoints) == 0 {
//if !ok || len(endpoints) == 0 {
if !ok {
ns.HAProxyRuntime[data.Service] = make(map[string]*RuntimeBackend)
}
logger.Tracef("service %s : number of already existing backend(s) in this transaction for this endpoint: %d", data.Service, len(ns.HAProxyRuntime[data.Service]))
Expand Down

0 comments on commit 03fb538

Please sign in to comment.