Skip to content

Commit

Permalink
Control whether to fail superseded deployments with a flag
Browse files Browse the repository at this point in the history
  • Loading branch information
vaijab committed Sep 14, 2016
1 parent 90e12e9 commit bc6702d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ func main() {
Usage: "kubernetes `NAMESPACE`",
EnvVar: "KUBE_NAMESPACE,PLUGIN_KUBE_NAMESPACE",
},
cli.BoolFlag{
Name: "fail-superseded",
Usage: "fail deployment if it has been superseded by another deployment. WARNING: there are some bugs in kubernetes.",
EnvVar: "FAIL_SUPERSEDED,PLUGIN_FAIL_SUPERSEDED",
},
cli.StringSliceFlag{
Name: "file, f",
Usage: "a list of kubernetes resources FILE",
Expand Down Expand Up @@ -163,8 +168,10 @@ func deploy(c *cli.Context, r *ObjectResource) error {
}

// Fail the deployment in case another deployment has started
if og != r.DeploymentStatus.ObservedGeneration {
return fmt.Errorf("Deployment failed. It has been superseded by another deployment.")
if c.Bool("fail-superseded") {
if og != r.DeploymentStatus.ObservedGeneration {
return fmt.Errorf("Deployment failed. It has been superseded by another deployment.")
}
}
}
}
Expand Down

0 comments on commit bc6702d

Please sign in to comment.