Skip to content

Commit

Permalink
React to new --revision flag in rollout status
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmichalis committed Oct 18, 2016
1 parent fc82249 commit fd5d49f
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions contrib/completions/bash/oc
Original file line number Diff line number Diff line change
Expand Up @@ -11674,6 +11674,8 @@ _oc_rollout_status()
flags+=("--recursive")
flags+=("-R")
local_nonpersistent_flags+=("--recursive")
flags+=("--revision=")
local_nonpersistent_flags+=("--revision=")
flags+=("--as=")
flags+=("--certificate-authority=")
flags_with_completion+=("--certificate-authority")
Expand Down
4 changes: 4 additions & 0 deletions contrib/completions/bash/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -16238,6 +16238,8 @@ _openshift_cli_rollout_status()
flags+=("--recursive")
flags+=("-R")
local_nonpersistent_flags+=("--recursive")
flags+=("--revision=")
local_nonpersistent_flags+=("--revision=")
flags+=("--as=")
flags+=("--certificate-authority=")
flags_with_completion+=("--certificate-authority")
Expand Down Expand Up @@ -26529,6 +26531,8 @@ _openshift_kube_rollout_status()
flags+=("--recursive")
flags+=("-R")
local_nonpersistent_flags+=("--recursive")
flags+=("--revision=")
local_nonpersistent_flags+=("--revision=")
flags+=("--allow-verification-with-non-compliant-keys")
flags+=("--alsologtostderr")
flags+=("--application-metrics-count-limit=")
Expand Down
2 changes: 2 additions & 0 deletions contrib/completions/zsh/oc
Original file line number Diff line number Diff line change
Expand Up @@ -11835,6 +11835,8 @@ _oc_rollout_status()
flags+=("--recursive")
flags+=("-R")
local_nonpersistent_flags+=("--recursive")
flags+=("--revision=")
local_nonpersistent_flags+=("--revision=")
flags+=("--as=")
flags+=("--certificate-authority=")
flags_with_completion+=("--certificate-authority")
Expand Down
4 changes: 4 additions & 0 deletions contrib/completions/zsh/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -16399,6 +16399,8 @@ _openshift_cli_rollout_status()
flags+=("--recursive")
flags+=("-R")
local_nonpersistent_flags+=("--recursive")
flags+=("--revision=")
local_nonpersistent_flags+=("--revision=")
flags+=("--as=")
flags+=("--certificate-authority=")
flags_with_completion+=("--certificate-authority")
Expand Down Expand Up @@ -26690,6 +26692,8 @@ _openshift_kube_rollout_status()
flags+=("--recursive")
flags+=("-R")
local_nonpersistent_flags+=("--recursive")
flags+=("--revision=")
local_nonpersistent_flags+=("--revision=")
flags+=("--allow-verification-with-non-compliant-keys")
flags+=("--alsologtostderr")
flags+=("--application-metrics-count-limit=")
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/oc-rollout-status.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Watch the status of the latest rollout, until it's done.
\fB\-R\fP, \fB\-\-recursive\fP=false
Process the directory used in \-f, \-\-filename recursively. Useful when you want to manage related manifests organized within the same directory.

.PP
\fB\-\-revision\fP=0
Pin to a specific revision for showing its status. Defaults to 0 (last revision).


.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/openshift-cli-rollout-status.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Watch the status of the latest rollout, until it's done.
\fB\-R\fP, \fB\-\-recursive\fP=false
Process the directory used in \-f, \-\-filename recursively. Useful when you want to manage related manifests organized within the same directory.

.PP
\fB\-\-revision\fP=0
Pin to a specific revision for showing its status. Defaults to 0 (last revision).


.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/openshift-kube-rollout-status.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Watch the status of current rollout, until it's done.
\fB\-R\fP, \fB\-\-recursive\fP=false
Process the directory used in \-f, \-\-filename recursively. Useful when you want to manage related manifests organized within the same directory.

.PP
\fB\-\-revision\fP=0
Pin to a specific revision for showing its status. Defaults to 0 (last revision).


.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP
Expand Down
9 changes: 7 additions & 2 deletions pkg/deploy/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ type DeploymentConfigStatusViewer struct {
var _ kubectl.StatusViewer = &DeploymentConfigStatusViewer{}

// Status returns a message describing deployment status, and a bool value indicating if the status is considered done
func (s *DeploymentConfigStatusViewer) Status(namespace, name string) (string, bool, error) {
func (s *DeploymentConfigStatusViewer) Status(namespace, name string, desiredRevision int64) (string, bool, error) {
config, err := s.dn.DeploymentConfigs(namespace).Get(name)
if err != nil {
return "", false, err
}
latestRevision := config.Status.LatestVersion

if config.Status.LatestVersion == 0 {
if latestRevision == 0 {
switch {
case deployutil.HasImageChangeTrigger(config):
return fmt.Sprintf("Deployment config %q waiting on image update\n", name), false, nil
Expand All @@ -40,6 +41,10 @@ func (s *DeploymentConfigStatusViewer) Status(namespace, name string) (string, b
}
}

if desiredRevision > 0 && latestRevision != desiredRevision {
return "", false, fmt.Errorf("desired revision (%d) is different from the running revision (%d)", desiredRevision, latestRevision)
}

cond := deployutil.GetDeploymentCondition(config.Status, deployapi.DeploymentProgressing)

if config.Generation <= config.Status.ObservedGeneration {
Expand Down

0 comments on commit fd5d49f

Please sign in to comment.