code: func (dc *DeploymentController) checkPausedConditions(d *apps.Deployment) error {
  	if !deploymentutil.HasProgressDeadline(d) {
  		return nil
  	}
  	cond := deploymentutil.GetDeploymentCondition(d.Status, apps.DeploymentProgressing)
  	if cond != nil && cond.Reason == deploymentutil.TimedOutReason {
  		// If we have reported lack of progress, do not overwrite it with a paused condition.
  		return nil
  	}
  	pausedCondExists := cond != nil && cond.Reason == deploymentutil.PausedDeployReason
  
  	needsUpdate := false
  	if d.Spec.Paused && !pausedCondExists {
  		condition := deploymentutil.NewDeploymentCondition(apps.DeploymentProgressing, v1.ConditionUnknown, deploymentutil.PausedDeployReason, "Deployment is paused")
  		deploymentutil.SetDeploymentCondition(&d.Status, *condition)
  		needsUpdate = true
  	} else if !d.Spec.Paused && pausedCondExists {
  		condition := deploymentutil.NewDeploymentCondition(apps.DeploymentProgressing, v1.ConditionUnknown, deploymentutil.ResumedDeployReason, "Deployment is resumed")
  		deploymentutil.SetDeploymentCondition(&d.Status, *condition)
  		needsUpdate = true
  	}
  
  	if !needsUpdate {
  		return nil
  	}
  
  	var err error
  	d, err = dc.client.AppsV1().Deployments(d.Namespace).UpdateStatus(d)
  	return err
  }
docs: // checkPausedConditions checks if the given deployment is paused or not and adds an appropriate condition.
  // These conditions are needed so that we won't accidentally report lack of progress for resumed deployments
  // that were paused for longer than progressDeadlineSeconds.