mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
Moving deployment deletion at the end
This commit is contained in:
parent
9d7259950b
commit
2a538e317f
@ -382,11 +382,6 @@ func (reaper *DeploymentReaper) Stop(namespace, name string, timeout time.Durati
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deployment.
|
|
||||||
if err := deployments.Delete(name, gracePeriod); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop all replica sets.
|
// Stop all replica sets.
|
||||||
selector, err := unversioned.LabelSelectorAsSelector(deployment.Spec.Selector)
|
selector, err := unversioned.LabelSelectorAsSelector(deployment.Spec.Selector)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -409,7 +404,10 @@ func (reaper *DeploymentReaper) Stop(namespace, name string, timeout time.Durati
|
|||||||
if len(errList) > 0 {
|
if len(errList) > 0 {
|
||||||
return utilerrors.NewAggregate(errList)
|
return utilerrors.NewAggregate(errList)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
|
// Delete deployment at the end.
|
||||||
|
// Note: We delete deployment at the end so that if removing RSs fails, we atleast have the deployment to retry.
|
||||||
|
return deployments.Delete(name, gracePeriod)
|
||||||
}
|
}
|
||||||
|
|
||||||
type updateDeploymentFunc func(d *extensions.Deployment)
|
type updateDeploymentFunc func(d *extensions.Deployment)
|
||||||
|
@ -538,7 +538,7 @@ func TestDeploymentStop(t *testing.T) {
|
|||||||
},
|
},
|
||||||
StopError: nil,
|
StopError: nil,
|
||||||
ExpectedActions: []string{"get:deployments", "update:deployments",
|
ExpectedActions: []string{"get:deployments", "update:deployments",
|
||||||
"get:deployments", "delete:deployments", "list:replicasets"},
|
"get:deployments", "list:replicasets", "delete:deployments"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "Deployment with single replicaset",
|
Name: "Deployment with single replicaset",
|
||||||
@ -560,9 +560,9 @@ func TestDeploymentStop(t *testing.T) {
|
|||||||
},
|
},
|
||||||
StopError: nil,
|
StopError: nil,
|
||||||
ExpectedActions: []string{"get:deployments", "update:deployments",
|
ExpectedActions: []string{"get:deployments", "update:deployments",
|
||||||
"get:deployments", "delete:deployments", "list:replicasets",
|
"get:deployments", "list:replicasets", "get:replicasets",
|
||||||
"get:replicasets", "get:replicasets", "update:replicasets",
|
"get:replicasets", "update:replicasets", "get:replicasets",
|
||||||
"get:replicasets", "get:replicasets", "delete:replicasets"},
|
"get:replicasets", "delete:replicasets", "delete:deployments"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user