@@ -24,15 +24,11 @@ import (
2424
2525 "github.com/openshift/cluster-version-operator/lib/resourcemerge"
2626 "github.com/openshift/cluster-version-operator/pkg/featuregates"
27+ "github.com/openshift/cluster-version-operator/pkg/internal"
2728 "github.com/openshift/cluster-version-operator/pkg/payload"
2829)
2930
3031const (
31- // ClusterStatusFailing is set on the ClusterVersion status when a cluster
32- // cannot reach the desired state. It is considered more serious than Degraded
33- // and indicates the cluster is not healthy.
34- ClusterStatusFailing = configv1 .ClusterStatusConditionType ("Failing" )
35-
3632 // ConditionalUpdateConditionTypeRecommended is a type of the condition present on a conditional update
3733 // that indicates whether the conditional update is recommended or not
3834 ConditionalUpdateConditionTypeRecommended = "Recommended"
@@ -159,21 +155,6 @@ func mergeOperatorHistory(cvStatus *configv1.ClusterVersionStatus, desired confi
159155 cvStatus .Desired = desired
160156}
161157
162- // ClusterVersionInvalid indicates that the cluster version has an error that prevents the server from
163- // taking action. The cluster version operator will only reconcile the current state as long as this
164- // condition is set.
165- const ClusterVersionInvalid configv1.ClusterStatusConditionType = "Invalid"
166-
167- // DesiredReleaseAccepted indicates whether the requested (desired) release payload was successfully loaded
168- // and no failures occurred during image verification and precondition checking.
169- const DesiredReleaseAccepted configv1.ClusterStatusConditionType = "ReleaseAccepted"
170-
171- // ImplicitlyEnabledCapabilities is True if there are enabled capabilities which the user is not currently
172- // requesting via spec.capabilities, because the cluster version operator does not support uninstalling
173- // capabilities if any associated resources were previously managed by the CVO or disabling previously
174- // enabled capabilities.
175- const ImplicitlyEnabledCapabilities configv1.ClusterStatusConditionType = "ImplicitlyEnabledCapabilities"
176-
177158// syncStatus calculates the new status of the ClusterVersion based on the current sync state and any
178159// validation errors found. We allow the caller to pass the original object to avoid DeepCopying twice.
179160func (optr * Operator ) syncStatus (ctx context.Context , original , config * configv1.ClusterVersion , status * SyncWorkerStatus , validationErrs field.ErrorList ) error {
@@ -265,21 +246,21 @@ func updateClusterVersionStatus(cvStatus *configv1.ClusterVersionStatus, status
265246 reason = "InvalidClusterVersion"
266247
267248 resourcemerge .SetOperatorStatusCondition (& cvStatus .Conditions , configv1.ClusterOperatorStatusCondition {
268- Type : ClusterVersionInvalid ,
249+ Type : internal . ClusterVersionInvalid ,
269250 Status : configv1 .ConditionTrue ,
270251 Reason : reason ,
271252 Message : buf .String (),
272253 LastTransitionTime : now ,
273254 })
274255 } else {
275- resourcemerge .RemoveOperatorStatusCondition (& cvStatus .Conditions , ClusterVersionInvalid )
256+ resourcemerge .RemoveOperatorStatusCondition (& cvStatus .Conditions , internal . ClusterVersionInvalid )
276257 }
277258
278259 // set the implicitly enabled capabilities condition
279260 setImplicitlyEnabledCapabilitiesCondition (cvStatus , status .CapabilitiesStatus .ImplicitlyEnabledCaps , now )
280261
281- // set the desired release accepted condition
282- setDesiredReleaseAcceptedCondition (cvStatus , status .loadPayloadStatus , now )
262+ // set the release accepted condition
263+ setReleaseAcceptedCondition (cvStatus , status .loadPayloadStatus , now )
283264
284265 // set the available condition
285266 if status .Completed > 0 {
@@ -318,7 +299,7 @@ func updateClusterVersionStatus(cvStatus *configv1.ClusterVersionStatus, status
318299
319300 // set the failing condition
320301 failingCondition := configv1.ClusterOperatorStatusCondition {
321- Type : ClusterStatusFailing ,
302+ Type : internal . ClusterStatusFailing ,
322303 Status : configv1 .ConditionFalse ,
323304 LastTransitionTime : now ,
324305 }
@@ -482,15 +463,15 @@ func setImplicitlyEnabledCapabilitiesCondition(cvStatus *configv1.ClusterVersion
482463 message = message + strings .Join ([]string (caps ), ", " )
483464
484465 resourcemerge .SetOperatorStatusCondition (& cvStatus .Conditions , configv1.ClusterOperatorStatusCondition {
485- Type : ImplicitlyEnabledCapabilities ,
466+ Type : internal . ImplicitlyEnabledCapabilities ,
486467 Status : configv1 .ConditionTrue ,
487468 Reason : "CapabilitiesImplicitlyEnabled" ,
488469 Message : message ,
489470 LastTransitionTime : now ,
490471 })
491472 } else {
492473 resourcemerge .SetOperatorStatusCondition (& cvStatus .Conditions , configv1.ClusterOperatorStatusCondition {
493- Type : ImplicitlyEnabledCapabilities ,
474+ Type : internal . ImplicitlyEnabledCapabilities ,
494475 Status : configv1 .ConditionFalse ,
495476 Reason : "AsExpected" ,
496477 Message : "Capabilities match configured spec" ,
@@ -499,10 +480,10 @@ func setImplicitlyEnabledCapabilitiesCondition(cvStatus *configv1.ClusterVersion
499480 }
500481}
501482
502- func setDesiredReleaseAcceptedCondition (cvStatus * configv1.ClusterVersionStatus , status LoadPayloadStatus , now metav1.Time ) {
483+ func setReleaseAcceptedCondition (cvStatus * configv1.ClusterVersionStatus , status LoadPayloadStatus , now metav1.Time ) {
503484 if status .Step == "PayloadLoaded" {
504485 resourcemerge .SetOperatorStatusCondition (& cvStatus .Conditions , configv1.ClusterOperatorStatusCondition {
505- Type : DesiredReleaseAccepted ,
486+ Type : internal . ReleaseAccepted ,
506487 Status : configv1 .ConditionTrue ,
507488 Reason : status .Step ,
508489 Message : status .Message ,
@@ -511,15 +492,15 @@ func setDesiredReleaseAcceptedCondition(cvStatus *configv1.ClusterVersionStatus,
511492 } else if status .Step != "" {
512493 if status .Failure != nil {
513494 resourcemerge .SetOperatorStatusCondition (& cvStatus .Conditions , configv1.ClusterOperatorStatusCondition {
514- Type : DesiredReleaseAccepted ,
495+ Type : internal . ReleaseAccepted ,
515496 Status : configv1 .ConditionFalse ,
516497 Reason : status .Step ,
517498 Message : status .Message ,
518499 LastTransitionTime : now ,
519500 })
520501 } else {
521502 resourcemerge .SetOperatorStatusCondition (& cvStatus .Conditions , configv1.ClusterOperatorStatusCondition {
522- Type : DesiredReleaseAccepted ,
503+ Type : internal . ReleaseAccepted ,
523504 Status : configv1 .ConditionUnknown ,
524505 Reason : status .Step ,
525506 Message : status .Message ,
@@ -644,7 +625,7 @@ func (optr *Operator) syncFailingStatus(ctx context.Context, original *configv1.
644625
645626 // reset the failing message
646627 resourcemerge .SetOperatorStatusCondition (& config .Status .Conditions , configv1.ClusterOperatorStatusCondition {
647- Type : ClusterStatusFailing ,
628+ Type : internal . ClusterStatusFailing ,
648629 Status : configv1 .ConditionTrue ,
649630 Message : ierr .Error (),
650631 LastTransitionTime : now ,
0 commit comments