mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 11:18:16 +00:00
Merge pull request #37093 from simonswine/fix-tolerate-unready-endpoints-pods-terminating
Automatic merge from submit-queue (batch tested with PRs 39092, 39126, 37380, 37093, 39237) Endpoints with TolerateUnready annotation, should list Pods in state terminating **What this PR does / why we need it**: We are using preStop lifecycle hooks to gracefully remove a node from a cluster. This hook is potentially long running and after the preStop hook is fired, the DNS resolution of the soon to be stopped Pod is failing, which causes a failure there. **Special notes for your reviewer**: Would be great to backport that to 1.4, 1.3 **Release note**: ```release-note Endpoints, that tolerate unready Pods, are now listing Pods in state Terminating as well ``` @bprashanth
This commit is contained in:
@@ -59,9 +59,13 @@ const (
|
||||
// An annotation on the Service denoting if the endpoints controller should
|
||||
// go ahead and create endpoints for unready pods. This annotation is
|
||||
// currently only used by StatefulSets, where we need the pod to be DNS
|
||||
// resolvable during initialization. In this situation we create a headless
|
||||
// service just for the StatefulSet, and clients shouldn't be using this Service
|
||||
// for anything so unready endpoints don't matter.
|
||||
// resolvable during initialization and termination. In this situation we
|
||||
// create a headless Service just for the StatefulSet, and clients shouldn't
|
||||
// be using this Service for anything so unready endpoints don't matter.
|
||||
// Endpoints of these Services retain their DNS records and continue
|
||||
// receiving traffic for the Service from the moment the kubelet starts all
|
||||
// containers in the pod and marks it "Running", till the kubelet stops all
|
||||
// containers and deletes the pod from the apiserver.
|
||||
TolerateUnreadyEndpointsAnnotation = "service.alpha.kubernetes.io/tolerate-unready-endpoints"
|
||||
)
|
||||
|
||||
@@ -403,7 +407,7 @@ func (e *EndpointController) syncService(key string) error {
|
||||
glog.V(5).Infof("Failed to find an IP for pod %s/%s", pod.Namespace, pod.Name)
|
||||
continue
|
||||
}
|
||||
if pod.DeletionTimestamp != nil {
|
||||
if !tolerateUnreadyEndpoints && pod.DeletionTimestamp != nil {
|
||||
glog.V(5).Infof("Pod is being deleted %s/%s", pod.Namespace, pod.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user