mirror of https://github.com/k3s-io/k3s
Merge pull request #58033 from hzxuzhonghu/revert-57747-ep-cm
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Revert "no need delete endpoint explicitly in endpoint controller" Reverts kubernetes/kubernetes#57747 For: 1. `checkLeftoverEndpoints` does not work any more. 2. service delete auto trigger endpoint delete in apiserver, if service is successfully deleted but fail on endpoint delete. Then this endpoint will be garbage resource.pull/6/head
commit
807dab6f6a
|
@ -394,7 +394,15 @@ func (e *EndpointController) syncService(key string) error {
|
|||
}
|
||||
service, err := e.serviceLister.Services(namespace).Get(name)
|
||||
if err != nil {
|
||||
// Service has been deleted. So no need to do any more operations.
|
||||
// Delete the corresponding endpoint, as the service has been deleted.
|
||||
// TODO: Please note that this will delete an endpoint when a
|
||||
// service is deleted. However, if we're down at the time when
|
||||
// the service is deleted, we will miss that deletion, so this
|
||||
// doesn't completely solve the problem. See #6877.
|
||||
err = e.client.CoreV1().Endpoints(namespace).Delete(name, nil)
|
||||
if err != nil && !errors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue