Skip to content

Commit d624e99

Browse files
committed
Warn when all Endpoints are draining
1 parent 3a70619 commit d624e99

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
@@ -1133,6 +1133,10 @@ func (n *NGINXController) createUpstreams(data []*ingress.Ingress, du *ingress.B
11331133
n.metricCollector.IncOrphanIngress(ing.Namespace, ing.Name, orphanMetricLabelNoEndpoint)
11341134
} else {
11351135
n.metricCollector.DecOrphanIngress(ing.Namespace, ing.Name, orphanMetricLabelNoEndpoint)
1136+
1137+
if allEndpointsAreDraining(endp) {
1138+
klog.Warningf("All Endpoints for Service %q are draining.", svcKey)
1139+
}
11361140
}
11371141
upstreams[name].Endpoints = endp
11381142
}
@@ -1909,3 +1913,12 @@ func newTrafficShapingPolicy(cfg *canary.Config) ingress.TrafficShapingPolicy {
19091913
Cookie: cfg.Cookie,
19101914
}
19111915
}
1916+
1917+
func allEndpointsAreDraining(eps []ingress.Endpoint) bool {
1918+
for _, ep := range eps {
1919+
if !ep.IsDraining {
1920+
return false
1921+
}
1922+
}
1923+
return true
1924+
}

0 commit comments

Comments
 (0)