// SetDeploymentAnnotationsTo sets deployment's annotations as given RS's annotations. // This action should be done if and only if the deployment is rolling back to this rs. // Note that apply and revision annotations are not changed. func SetDeploymentAnnotationsTo(deployment *extensions.Deployment, rollbackToRS *extensions.ReplicaSet) { deployment.Annotations = getSkippedAnnotations(deployment.Annotations) for k, v := range rollbackToRS.Annotations { if !skipCopyAnnotation(k) { deployment.Annotations[k] = v } } }
func (dc *DeploymentController) updateDeploymentRevision(deployment extensions.Deployment, revision string) error { if deployment.Annotations == nil { deployment.Annotations = make(map[string]string) } deployment.Annotations[deploymentutil.RevisionAnnotation] = revision _, err := dc.updateDeployment(&deployment) return err }
func (dc *DeploymentController) markDeploymentOverlap(deployment *extensions.Deployment, withDeployment string) (*extensions.Deployment, error) { if deployment.Annotations[util.OverlapAnnotation] == withDeployment { return deployment, nil } if deployment.Annotations == nil { deployment.Annotations = make(map[string]string) } deployment.Annotations[util.OverlapAnnotation] = withDeployment return dc.client.Extensions().Deployments(deployment.Namespace).Update(deployment) }
func (dc *DeploymentController) updateDeploymentRevision(deployment *extensions.Deployment, revision string) error { if deployment.Annotations == nil { deployment.Annotations = make(map[string]string) } if deployment.Annotations[deploymentutil.RevisionAnnotation] != revision { deployment.Annotations[deploymentutil.RevisionAnnotation] = revision _, err := dc.client.Extensions().Deployments(deployment.ObjectMeta.Namespace).Update(deployment) return err } return nil }
func (dc *DeploymentController) markDeploymentOverlap(deployment *extensions.Deployment, withDeployment string) (*extensions.Deployment, error) { if deployment.Annotations[util.OverlapAnnotation] == withDeployment && deployment.Status.ObservedGeneration >= deployment.Generation { return deployment, nil } if deployment.Annotations == nil { deployment.Annotations = make(map[string]string) } // Update observedGeneration for overlapping deployments so that their deletion won't be blocked. deployment.Status.ObservedGeneration = deployment.Generation deployment.Annotations[util.OverlapAnnotation] = withDeployment return dc.client.Extensions().Deployments(deployment.Namespace).UpdateStatus(deployment) }
// SetDeploymentRevision updates the revision for a deployment. func SetDeploymentRevision(deployment *extensions.Deployment, revision string) bool { updated := false if deployment.Annotations == nil { deployment.Annotations = make(map[string]string) } if deployment.Annotations[RevisionAnnotation] != revision { deployment.Annotations[RevisionAnnotation] = revision updated = true } return updated }