-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update provider contract to account for the paused condition
This change updates the provider contract to account for a new paused condition. It is intended to start as an optional condition, but then become required at a later date.
- Loading branch information
1 parent
404084f
commit bfb4ec8
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!-- DOCTOC SKIP --> | ||
// Return early and set the paused condition to True if the object or Cluster | ||
// is paused. | ||
// We assume that the change to the object has to be written, e.g. via the | ||
// patchHelper in defer. | ||
if annotations.IsPaused(cluster, m) { | ||
log.Info("Reconciliation is paused for this object") | ||
|
||
newPausedCondition := &clusterv1.Condition{ | ||
Type: clusterv1.PausedCondition, | ||
Status: corev1.ConditionTrue, | ||
Severity: clusterv1.ConditionSeverityInfo, | ||
} | ||
|
||
if cluster.Spec.Paused { | ||
newPausedCondition.Reason = clusterv1.ClusterPausedReason | ||
newPausedCondition.Message = fmt.Sprintf("The cluster %s is paused, pausing this object until the cluster is unpaused", cluster.Name) | ||
} else { | ||
newPausedCondition.Reason = clusterv1.AnnotationPausedReason | ||
newPausedCondition.Message = fmt.Sprintf("The machine %s is paused, pausing this object until the annotation is removed", m.Name) | ||
|
||
} | ||
|
||
conditions.Set(m, newPausedCondition) | ||
return ctrl.Result{}, nil | ||
} | ||
|
||
conditions.MarkFalseWithNegativePolarity(m, clusterv1.PausedCondition) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters