mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
deployment: Ignore namespace termination errors when creating replicasets
Instead of reporting an event or displaying an error, simply exit when the namespace is being terminated. This reduces the amount of controller churn on namespace shutdown. Unlike other controllers, we drop the replica set create error very late (in the queue handleErr) in order to avoid changing the structure of the controller substantially.
This commit is contained in:
parent
c6e34e58c5
commit
bd9260711f
@ -475,7 +475,7 @@ func (dc *DeploymentController) processNextWorkItem() bool {
|
||||
}
|
||||
|
||||
func (dc *DeploymentController) handleErr(err error, key interface{}) {
|
||||
if err == nil {
|
||||
if err == nil || errors.HasStatusCause(err, v1.NamespaceTerminatingCause) {
|
||||
dc.queue.Forget(key)
|
||||
return
|
||||
}
|
||||
|
@ -256,6 +256,9 @@ func (dc *DeploymentController) getNewReplicaSet(d *apps.Deployment, rsList, old
|
||||
klog.V(2).Infof("Found a hash collision for deployment %q - bumping collisionCount (%d->%d) to resolve it", d.Name, preCollisionCount, *d.Status.CollisionCount)
|
||||
}
|
||||
return nil, err
|
||||
case errors.HasStatusCause(err, v1.NamespaceTerminatingCause):
|
||||
// if the namespace is terminating, all subsequent creates will fail and we can safely do nothing
|
||||
return nil, err
|
||||
case err != nil:
|
||||
msg := fmt.Sprintf("Failed to create new replica set %q: %v", newRS.Name, err)
|
||||
if deploymentutil.HasProgressDeadline(d) {
|
||||
|
Loading…
Reference in New Issue
Block a user