Skip to content

Commit

Permalink
Fixup variable names in DC controller
Browse files Browse the repository at this point in the history
  • Loading branch information
tnozicka committed Nov 29, 2017
1 parent fe4f498 commit 086cc82
Showing 1 changed file with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ func (c *DeploymentConfigController) Handle(config *deployapi.DeploymentConfig)
return c.updateStatus(config, existingDeployments)
}

latestIsDeployed, latestDeployment := deployutil.LatestDeploymentInfo(config, existingDeployments)
latestExists, latestDeployment := deployutil.LatestDeploymentInfo(config, existingDeployments)

if !latestIsDeployed {
if !latestExists {
if err := c.cancelRunningRollouts(config, existingDeployments, cm); err != nil {
return err
}
}
configCopy := config.DeepCopy()
// Process triggers and start an initial rollouts
shouldTrigger, shouldSkip := triggerActivated(configCopy, latestIsDeployed, latestDeployment, c.codec)
shouldTrigger, shouldSkip := triggerActivated(configCopy, latestExists, latestDeployment, c.codec)
if !shouldSkip && shouldTrigger {
configCopy.Status.LatestVersion++
return c.updateStatus(configCopy, existingDeployments)
Expand All @@ -141,18 +141,7 @@ func (c *DeploymentConfigController) Handle(config *deployapi.DeploymentConfig)
}
// If the latest deployment already exists, reconcile existing deployments
// and return early.
if latestIsDeployed {
// If the latest deployment is still running, try again later. We don't
// want to compete with the deployer.
if !deployutil.IsTerminatedDeployment(latestDeployment) {
return c.updateStatus(config, existingDeployments)
}

return c.reconcileDeployments(existingDeployments, config, cm)
}
// If the latest deployment already exists, reconcile existing deployments
// and return early.
if latestIsDeployed {
if latestExists {
// If the latest deployment is still running, try again later. We don't
// want to compete with the deployer.
if !deployutil.IsTerminatedDeployment(latestDeployment) {
Expand Down Expand Up @@ -530,7 +519,7 @@ func (c *DeploymentConfigController) cleanupOldDeployments(existingDeployments [
// triggers were activated (config change or image change). The first bool indicates that
// the triggers are active and second indicates if we should skip the rollout because we
// are waiting for the trigger to complete update (waiting for image for example).
func triggerActivated(config *deployapi.DeploymentConfig, latestIsDeployed bool, latestDeployment *v1.ReplicationController, codec runtime.Codec) (bool, bool) {
func triggerActivated(config *deployapi.DeploymentConfig, latestExists bool, latestDeployment *v1.ReplicationController, codec runtime.Codec) (bool, bool) {
if config.Spec.Paused {
return false, false
}
Expand Down Expand Up @@ -569,7 +558,7 @@ func triggerActivated(config *deployapi.DeploymentConfig, latestIsDeployed bool,
}

// Wait for the RC to be created
if !latestIsDeployed {
if !latestExists {
return false, true
}

Expand Down

0 comments on commit 086cc82

Please sign in to comment.