Skip to content

Commit d42a4ec

Browse files
committed
Warn when all Endpoints are draining
1 parent 5442fa3 commit d42a4ec

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

internal/ingress/controller/controller.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,10 @@ func (n *NGINXController) createUpstreams(data []*ingress.Ingress, du *ingress.B
11321132
n.metricCollector.IncOrphanIngress(ing.Namespace, ing.Name, orphanMetricLabelNoEndpoint)
11331133
} else {
11341134
n.metricCollector.DecOrphanIngress(ing.Namespace, ing.Name, orphanMetricLabelNoEndpoint)
1135+
1136+
if allEndpointsAreDraining(endp) {
1137+
klog.Warningf("All Endpoints for Service %q are draining.", svcKey)
1138+
}
11351139
}
11361140
upstreams[name].Endpoints = endp
11371141
}
@@ -1908,3 +1912,12 @@ func newTrafficShapingPolicy(cfg *canary.Config) ingress.TrafficShapingPolicy {
19081912
Cookie: cfg.Cookie,
19091913
}
19101914
}
1915+
1916+
func allEndpointsAreDraining(eps []ingress.Endpoint) bool {
1917+
for _, ep := range eps {
1918+
if !ep.IsDraining {
1919+
return false
1920+
}
1921+
}
1922+
return true
1923+
}

0 commit comments

Comments
 (0)