Stop the users from rolling back a paused deployment in kubectl rollout undo

This commit is contained in:
Janet Kuo
2016-03-16 15:46:22 -07:00
parent c412dcba7f
commit 2bd30c7572
2 changed files with 12 additions and 1 deletions

View File

@@ -49,6 +49,10 @@ type DeploymentRollbacker struct {
}
func (r *DeploymentRollbacker) Rollback(namespace, name string, updatedAnnotations map[string]string, toRevision int64, obj runtime.Object) (string, error) {
d := obj.(*extensions.Deployment)
if d.Spec.Paused {
return "", fmt.Errorf("you cannot rollback a paused deployment; resume it first with 'kubectl rollout resume' and try again")
}
deploymentRollback := &extensions.DeploymentRollback{
Name: name,
UpdatedAnnotations: updatedAnnotations,