From c979cf9e9df18548059f57def703e4d445b1f877 Mon Sep 17 00:00:00 2001 From: "Per G. da Silva" Date: Mon, 5 Oct 2026 12:16:39 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20Rename=20ClusterObjectSet=20Avai?= =?UTF-8?q?lable=20helpers=20to=20Ready?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to the ClusterObjectSet condition rename from Available to Ready (#2971). That change renamed the condition type and printer column but left behind helper functions, local variables, comments, and test names that still used the old "Available" vocabulary for the ClusterObjectSet condition. Rename for consistency, with no behavior change: - object-controller: fix the setReadyWithDeadline doc comment and the ClusterObjectSet controller test names/descriptions that referenced the old "Available" condition. - operator-controller: rename setProgressingFromAvailable -> setProgressingFromReady and progressingFromAvailable -> progressingFromReady (and their params/locals) since they derive the ClusterExtension Progressing condition from the ClusterObjectSet Ready condition; update related comments and the TestProgressingFromReady test. - docs: rename the ClusterObjectSet "Available" condition section to "Ready" and correct the kubectl example output to match the current printer columns (READY, AGE). The ClusterExtension-facing Available condition (TypeAvailable, setAvailableFromRevisionStates, and the RevisionStatus.conditions re-emission) is intentionally retained. Co-Authored-By: Claude Opus 4.8 Signed-off-by: Per G. da Silva --- docs/draft/concepts/clusterobjectsets.md | 8 +-- .../clusterobjectset_controller.go | 34 ++++++------ .../clusterobjectset_controller_test.go | 30 +++++------ .../boxcutter_reconcile_steps_apply_test.go | 4 +- .../controllers/common_controller.go | 54 +++++++++---------- .../controllers/common_controller_test.go | 20 +++---- 6 files changed, 75 insertions(+), 75 deletions(-) diff --git a/docs/draft/concepts/clusterobjectsets.md b/docs/draft/concepts/clusterobjectsets.md index 46a3684ef7..bfd5f10b02 100644 --- a/docs/draft/concepts/clusterobjectsets.md +++ b/docs/draft/concepts/clusterobjectsets.md @@ -167,7 +167,7 @@ Indicates whether the revision is actively rolling out. | False | `Blocked` | Error requiring manual intervention | | False | `Archived` | No longer actively reconciled | -### Available +### Ready Indicates whether all objects have been successfully rolled out and pass readiness probes. @@ -387,7 +387,7 @@ kubectl get clusterobjectset -o yaml Example output: ``` -NAME AVAILABLE PROGRESSING AGE -my-extension-abc12 Unknown False 2d -my-extension-def34 True True 1h +NAME READY AGE +my-extension-abc12 Unknown 2d +my-extension-def34 True 1h ``` diff --git a/internal/object-controller/controllers/clusterobjectset_controller.go b/internal/object-controller/controllers/clusterobjectset_controller.go index 404921b25f..2959cdf005 100644 --- a/internal/object-controller/controllers/clusterobjectset_controller.go +++ b/internal/object-controller/controllers/clusterobjectset_controller.go @@ -134,7 +134,7 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl // Blocked takes precedence over ProgressDeadlineExceeded: it is more actionable for the user. if err := c.verifyReferencedSecretsImmutable(ctx, cos); err != nil { l.Error(err, "referenced Secret verification failed, blocking reconciliation") - markAsUnavailable(cos, ocv1.ClusterObjectSetReasonBlocked, err.Error()) + markAsNotReady(cos, ocv1.ClusterObjectSetReasonBlocked, err.Error()) return ctrl.Result{}, nil } @@ -148,7 +148,7 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl cos.Status.ObservedPhases = currentPhases } else if err := verifyObservedPhases(cos.Status.ObservedPhases, currentPhases); err != nil { l.Error(err, "resolved phases content changed, blocking reconciliation") - markAsUnavailable(cos, ocv1.ClusterObjectSetReasonBlocked, err.Error()) + markAsNotReady(cos, ocv1.ClusterObjectSetReasonBlocked, err.Error()) return ctrl.Result{}, nil } @@ -168,7 +168,7 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl if cos.Spec.LifecycleState == ocv1.ClusterObjectSetLifecycleStateArchived { if err := c.TrackingCache.Free(ctx, cos); err != nil { - markAsUnavailable(cos, ocv1.ClusterObjectSetReasonReconciling, err.Error()) + markAsNotReady(cos, ocv1.ClusterObjectSetReasonReconciling, err.Error()) return ctrl.Result{}, fmt.Errorf("error stopping informers: %v", err) } return c.archive(ctx, revisionEngine, cos, revision) @@ -225,7 +225,7 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl revisionNumber := cos.Spec.Revision if rres.InTransition() { - setAvailableWithDeadline(cos, metav1.ConditionFalse, ocv1.ReasonRollingOut, fmt.Sprintf("Revision %d is rolling out.", revisionNumber), isDeadlineExceeded) + setReadyWithDeadline(cos, metav1.ConditionFalse, ocv1.ReasonRollingOut, fmt.Sprintf("Revision %d is rolling out.", revisionNumber), isDeadlineExceeded) } //nolint:nestif @@ -245,7 +245,7 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl } } - markAsAvailable(cos, ocv1.ClusterObjectSetReasonProbesSucceeded, "Objects are available and pass all probes.") + markAsReady(cos, ocv1.ClusterObjectSetReasonProbesSucceeded, "Objects are available and pass all probes.") // Record the timestamp of the first time the revision was observed to be // ready. This is set once and never changes for subsequent reconciliations. @@ -291,11 +291,11 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl // the "last status", not the per-object probe detail, so the reconstructed // ClusterExtension Progressing/ProgressDeadlineExceeded message matches the // message the removed COS Progressing condition historically carried. - setAvailableWithDeadline(cos, metav1.ConditionFalse, ocv1.ReasonRollingOut, rollingOutMsg, true) + setReadyWithDeadline(cos, metav1.ConditionFalse, ocv1.ReasonRollingOut, rollingOutMsg, true) case len(probeFailureMsgs) > 0: - setAvailableWithDeadline(cos, metav1.ConditionFalse, ocv1.ClusterObjectSetReasonProbeFailure, strings.Join(probeFailureMsgs, "\n"), false) + setReadyWithDeadline(cos, metav1.ConditionFalse, ocv1.ClusterObjectSetReasonProbeFailure, strings.Join(probeFailureMsgs, "\n"), false) default: - setAvailableWithDeadline(cos, metav1.ConditionFalse, ocv1.ReasonRollingOut, rollingOutMsg, false) + setReadyWithDeadline(cos, metav1.ConditionFalse, ocv1.ReasonRollingOut, rollingOutMsg, false) } if hasDeadline && !isDeadlineExceeded { return ctrl.Result{RequeueAfter: remaining}, nil @@ -307,7 +307,7 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl func (c *ClusterObjectSetReconciler) delete(ctx context.Context, cos *ocv1.ClusterObjectSet) (ctrl.Result, error) { if err := c.TrackingCache.Free(ctx, cos); err != nil { - markAsUnavailable(cos, ocv1.ClusterObjectSetReasonReconciling, err.Error()) + markAsNotReady(cos, ocv1.ClusterObjectSetReasonReconciling, err.Error()) return ctrl.Result{}, fmt.Errorf("error stopping informers: %v", err) } if err := c.removeFinalizer(ctx, cos, clusterObjectSetTeardownFinalizer); err != nil { @@ -655,13 +655,13 @@ func buildProgressionProbes(progressionProbes []ocv1.ProgressionProbe) (probing. return userProbes, nil } -// setAvailableWithDeadline sets the Available condition to the supplied status/reason/message, +// setReadyWithDeadline sets the Ready condition to the supplied status/reason/message, // unless the progress deadline has been exceeded — in which case it reports -// Available=False/ProgressDeadlineExceeded instead. This centralises the deadline +// Ready=False/ProgressDeadlineExceeded instead. This centralises the deadline // enforcement that previously lived in markAsProgressing. -func setAvailableWithDeadline(cos *ocv1.ClusterObjectSet, status metav1.ConditionStatus, reason, message string, isDeadlineExceeded bool) { // nolint:unparam +func setReadyWithDeadline(cos *ocv1.ClusterObjectSet, status metav1.ConditionStatus, reason, message string, isDeadlineExceeded bool) { // nolint:unparam if isDeadlineExceeded { - markAsUnavailable(cos, ocv1.ReasonProgressDeadlineExceeded, + markAsNotReady(cos, ocv1.ReasonProgressDeadlineExceeded, fmt.Sprintf("Revision has not rolled out for %d minute(s). Last status: %s", cos.Spec.ProgressDeadlineMinutes, message)) return } @@ -675,10 +675,10 @@ func setAvailableWithDeadline(cos *ocv1.ClusterObjectSet, status metav1.Conditio } func setRetryingConditions(cos *ocv1.ClusterObjectSet, message string, isDeadlineExceeded bool) { - setAvailableWithDeadline(cos, metav1.ConditionFalse, ocv1.ClusterObjectSetReasonReconciling, message, isDeadlineExceeded) + setReadyWithDeadline(cos, metav1.ConditionFalse, ocv1.ClusterObjectSetReasonReconciling, message, isDeadlineExceeded) } -func markAsAvailable(cos *ocv1.ClusterObjectSet, reason, message string) bool { +func markAsReady(cos *ocv1.ClusterObjectSet, reason, message string) bool { return meta.SetStatusCondition(&cos.Status.Conditions, metav1.Condition{ Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionTrue, @@ -688,7 +688,7 @@ func markAsAvailable(cos *ocv1.ClusterObjectSet, reason, message string) bool { }) } -func markAsUnavailable(cos *ocv1.ClusterObjectSet, reason, message string) bool { +func markAsNotReady(cos *ocv1.ClusterObjectSet, reason, message string) bool { return meta.SetStatusCondition(&cos.Status.Conditions, metav1.Condition{ Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionFalse, @@ -700,7 +700,7 @@ func markAsUnavailable(cos *ocv1.ClusterObjectSet, reason, message string) bool func markAsArchived(cos *ocv1.ClusterObjectSet) bool { const msg = "revision is archived" - return markAsUnavailable(cos, ocv1.ClusterObjectSetReasonArchived, msg) + return markAsNotReady(cos, ocv1.ClusterObjectSetReasonArchived, msg) } // computePhaseDigest computes a deterministic SHA-256 digest of a phase's diff --git a/internal/object-controller/controllers/clusterobjectset_controller_test.go b/internal/object-controller/controllers/clusterobjectset_controller_test.go index 5c5a3f659d..6ccf0bdcc3 100644 --- a/internal/object-controller/controllers/clusterobjectset_controller_test.go +++ b/internal/object-controller/controllers/clusterobjectset_controller_test.go @@ -68,7 +68,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing }, }, { - name: "Available condition is set to False/Reconciling on error when not previously set", + name: "Ready condition is set to False/Reconciling on error when not previously set", reconcilingRevisionName: clusterObjectSetName, revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}), revisionReconcileErr: errors.New("some error"), @@ -92,7 +92,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing }, }, { - name: "Available condition is set to False/Reconciling on error when previously set", + name: "Ready condition is set to False/Reconciling on error when previously set", reconcilingRevisionName: clusterObjectSetName, revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}), revisionReconcileErr: errors.New("some error"), @@ -124,8 +124,8 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing }, { // A revision whose FIRST reconcile fails at engine creation (factory error) - // must set Available=False/Reconciling even though Available did not previously exist. - name: "Available condition is set to False/Reconciling on factory error when not previously set", + // must set Ready=False/Reconciling even though Ready did not previously exist. + name: "Ready condition is set to False/Reconciling on factory error when not previously set", reconcilingRevisionName: clusterObjectSetName, factoryErr: errors.New("failed to create revision engine"), existingObjs: func() []client.Object { @@ -147,7 +147,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing }, }, { - name: "set Available:False:RollingOut status condition during rollout when no probe failures are detected", + name: "set Ready:False:RollingOut status condition during rollout when no probe failures are detected", reconcilingRevisionName: clusterObjectSetName, revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}), existingObjs: func() []client.Object { @@ -170,7 +170,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing }, }, { - name: "set Available:False:ProbeFailure condition when probe failures are detected and revision is in transition", + name: "set Ready:False:ProbeFailure condition when probe failures are detected and revision is in transition", reconcilingRevisionName: clusterObjectSetName, revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{ inTransition: true, @@ -258,7 +258,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing }, }, { - name: "set Available:False:ProbeFailure condition when probe failures are detected and revision is not in transition", + name: "set Ready:False:ProbeFailure condition when probe failures are detected and revision is not in transition", reconcilingRevisionName: clusterObjectSetName, revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{ inTransition: false, @@ -346,7 +346,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing }, }, { - name: "set Available:False:RollingOut condition while revision is transitioning", + name: "set Ready:False:RollingOut condition while revision is transitioning", revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{ inTransition: true, }), @@ -371,7 +371,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_RevisionReconciliation(t *testing }, }, { - name: "set Available:True:ProbesSucceeded condition and completedAt on successful revision rollout", + name: "set Ready:True:ProbesSucceeded condition and completedAt on successful revision rollout", revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{ isComplete: true, }), @@ -729,7 +729,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T) }, }, { - name: "set Available:False:Reconciling when tracking cache free fails during deletion", + name: "set Ready:False:Reconciling when tracking cache free fails during deletion", revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}), existingObjs: func() []client.Object { ext := newTestClusterExtension() @@ -761,7 +761,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T) }, }, { - name: "set Available:False:Archived condition when a revision is archived", + name: "set Ready:False:Archived condition when a revision is archived", revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}), existingObjs: func() []client.Object { ext := newTestClusterExtension() @@ -794,7 +794,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T) }, }, { - name: "set Available:False:Reconciling and requeue when archived revision archival is incomplete", + name: "set Ready:False:Reconciling and requeue when archived revision archival is incomplete", revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}), existingObjs: func() []client.Object { ext := newTestClusterExtension() @@ -993,7 +993,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ProgressDeadline(t *testing.T) { clock clock.Clock }{ { - name: "available set to false/ProgressDeadlineExceeded when progress deadline is exceeded", + name: "Ready set to false/ProgressDeadlineExceeded when progress deadline is exceeded", existingObjs: func() []client.Object { ext := newTestClusterExtension() rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme) @@ -1019,8 +1019,8 @@ func Test_ClusterObjectSetReconciler_Reconcile_ProgressDeadline(t *testing.T) { }, { // A rolling revision with failing probes AND an exceeded progress deadline must - // set Available=False/ProgressDeadlineExceeded (deadline wins over ProbeFailure). - name: "available set to false/ProgressDeadlineExceeded when deadline is exceeded during probe failure (deadline wins over ProbeFailure)", + // set Ready=False/ProgressDeadlineExceeded (deadline wins over ProbeFailure). + name: "Ready set to false/ProgressDeadlineExceeded when deadline is exceeded during probe failure (deadline wins over ProbeFailure)", existingObjs: func() []client.Object { ext := newTestClusterExtension() rev1 := newTestClusterObjectSet(t, clusterObjectSetName, ext, testScheme) diff --git a/internal/operator-controller/controllers/boxcutter_reconcile_steps_apply_test.go b/internal/operator-controller/controllers/boxcutter_reconcile_steps_apply_test.go index 7b90f509e6..3b0e901628 100644 --- a/internal/operator-controller/controllers/boxcutter_reconcile_steps_apply_test.go +++ b/internal/operator-controller/controllers/boxcutter_reconcile_steps_apply_test.go @@ -112,7 +112,7 @@ func TestApplyBundleWithBoxcutter(t *testing.T) { }, }, { - name: "rolling revision without Available resets stale Progressing to RollingOut default", + name: "rolling revision without Ready resets stale Progressing to RollingOut default", args: args{ activeRevisions: []ocv1.RevisionStatus{ {Name: "ce-1"}, @@ -128,7 +128,7 @@ func TestApplyBundleWithBoxcutter(t *testing.T) { revisionStates: &RevisionStates{ RollingOut: []*RevisionMetadata{ // Freshly created revision that has not reconciled yet: - // it has no Available condition. + // it has no Ready condition. {RevisionName: "ce-1"}, }, }, diff --git a/internal/operator-controller/controllers/common_controller.go b/internal/operator-controller/controllers/common_controller.go index d7a1d9c9ed..7f903725c2 100644 --- a/internal/operator-controller/controllers/common_controller.go +++ b/internal/operator-controller/controllers/common_controller.go @@ -77,9 +77,9 @@ func setActiveRevisionsFromRevisionStates(ext *ocv1.ClusterExtension, revisionSt } for _, r := range revisionStates.RollingOut { rs := ocv1.RevisionStatus{Name: r.RevisionName} - avail := apimeta.FindStatusCondition(r.Conditions, ocv1.ClusterObjectSetTypeReady) - if avail != nil { - a := *avail + ready := apimeta.FindStatusCondition(r.Conditions, ocv1.ClusterObjectSetTypeReady) + if ready != nil { + a := *ready a.Type = ocv1.TypeAvailable a.ObservedGeneration = ext.GetGeneration() apimeta.SetStatusCondition(&rs.Conditions, a) @@ -91,9 +91,9 @@ func setActiveRevisionsFromRevisionStates(ext *ocv1.ClusterExtension, revisionSt // setAvailableFromRevisionStates sets the Available status condition based on the given revision states func setAvailableFromRevisionStates(ext *ocv1.ClusterExtension, revisionStates *RevisionStates) { if i := revisionStates.Installed; i != nil { - avail := apimeta.FindStatusCondition(i.Conditions, ocv1.ClusterObjectSetTypeReady) - if avail != nil { - a := *avail + ready := apimeta.FindStatusCondition(i.Conditions, ocv1.ClusterObjectSetTypeReady) + if ready != nil { + a := *ready a.Type = ocv1.TypeAvailable a.ObservedGeneration = ext.GetGeneration() apimeta.SetStatusCondition(&ext.Status.Conditions, a) @@ -102,26 +102,26 @@ func setAvailableFromRevisionStates(ext *ocv1.ClusterExtension, revisionStates * } // setProgressingFromRevisionStates sets the Progressing status condition based on the given revision states -// The Progressing condition is derived from the Available condition of either: +// The Progressing condition is derived from the Ready condition of either: // - the latest rolling out revision (when one exists); OR // - the installed revision -// When the source revision has no Available condition yet (e.g. a freshly created revision that has +// When the source revision has no Ready condition yet (e.g. a freshly created revision that has // not reconciled), a nil condition is passed so the helper applies the RollingOut default rather than // leaving Progressing stale. func setProgressingFromRevisionStates(ext *ocv1.ClusterExtension, revisionStates *RevisionStates) { if len(revisionStates.RollingOut) > 0 { revisionMeta := revisionStates.RollingOut[len(revisionStates.RollingOut)-1] - avail := apimeta.FindStatusCondition(revisionMeta.Conditions, ocv1.ClusterObjectSetTypeReady) - setProgressingFromAvailable(ext, avail, false) + readyCond := apimeta.FindStatusCondition(revisionMeta.Conditions, ocv1.ClusterObjectSetTypeReady) + setProgressingFromReady(ext, readyCond, false) } else if revisionStates.Installed != nil { - setProgressingFromAvailable(ext, apimeta.FindStatusCondition(revisionStates.Installed.Conditions, ocv1.ClusterObjectSetTypeReady), true) + setProgressingFromReady(ext, apimeta.FindStatusCondition(revisionStates.Installed.Conditions, ocv1.ClusterObjectSetTypeReady), true) } } -// setProgressingFromAvailable derives the correct Progressing condition for the ClusterExtension from the given -// revision Available condition, and whether the revision is complete or not -func setProgressingFromAvailable(ext *ocv1.ClusterExtension, availableCond *metav1.Condition, isRevisionCompleted bool) { - prog := progressingFromAvailable(availableCond, isRevisionCompleted) +// setProgressingFromReady derives the correct Progressing condition for the ClusterExtension from the given +// revision Ready condition, and whether the revision is complete or not +func setProgressingFromReady(ext *ocv1.ClusterExtension, readyCond *metav1.Condition, isRevisionCompleted bool) { + prog := progressingFromReady(readyCond, isRevisionCompleted) prog.ObservedGeneration = ext.GetGeneration() apimeta.SetStatusCondition(&ext.Status.Conditions, prog) } @@ -131,16 +131,16 @@ func setProgressingFromAvailable(ext *ocv1.ClusterExtension, availableCond *meta // // Returns Failed when: // - No rolling revisions exist (nothing to install) -// - The latest rolling revision has Available condition with Reason: Reconciling (indicates an error occurred) +// - The latest rolling revision has Ready condition with Reason: Reconciling (indicates an error occurred) // // Returns Absent when: -// - Rolling revisions exist with the latest not having Available=Reconciling (healthy phased rollout in progress) +// - Rolling revisions exist with the latest not having Ready=Reconciling (healthy phased rollout in progress) // // Rationale: // - Failed: Semantically indicates an error prevented installation // - Absent: Semantically indicates "not there yet" (neutral state, e.g., during healthy rollout) -// - Reconciling reason on Available indicates an error (config validation, apply failure, etc.) -// - Other Available reasons indicate healthy progress or terminal states handled elsewhere +// - Reconciling reason on Ready indicates an error (config validation, apply failure, etc.) +// - Other Ready reasons indicate healthy progress or terminal states handled elsewhere // - Only the LATEST revision matters - old errors superseded by newer healthy revisions should not cause Failed // // Note: rollingRevisions are sorted in ascending order by Spec.Revision (oldest to newest), @@ -151,9 +151,9 @@ func determineFailureReason(rollingRevisions []*RevisionMetadata) string { } // Latest revision is the last element (sorted ascending by Spec.Revision). latestRevision := rollingRevisions[len(rollingRevisions)-1] - availableCond := apimeta.FindStatusCondition(latestRevision.Conditions, ocv1.ClusterObjectSetTypeReady) + readyCond := apimeta.FindStatusCondition(latestRevision.Conditions, ocv1.ClusterObjectSetTypeReady) // Reconciling is the new home of the old Retrying signal: it indicates an error occurred. - if availableCond != nil && availableCond.Reason == ocv1.ClusterObjectSetReasonReconciling { + if readyCond != nil && readyCond.Reason == ocv1.ClusterObjectSetReasonReconciling { return ocv1.ReasonFailed } @@ -229,13 +229,13 @@ func setStatusProgressing(ext *ocv1.ClusterExtension, err error) { SetStatusCondition(&ext.Status.Conditions, progressingCond) } -// progressingFromAvailable reconstructs the ClusterExtension Progressing condition -// for a single revision from that revision's ClusterObjectSet Available condition +// progressingFromReady reconstructs the ClusterExtension Progressing condition +// for a single revision from that revision's ClusterObjectSet Ready condition // and whether the revision has completed its rollout (status.completedAt set). // // This replaces the previous behavior of mirroring the ClusterObjectSet Progressing // condition, which no longer exists. ObservedGeneration is left unset; callers set it. -func progressingFromAvailable(available *metav1.Condition, completed bool) metav1.Condition { +func progressingFromReady(ready *metav1.Condition, completed bool) metav1.Condition { cond := metav1.Condition{ Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, @@ -245,13 +245,13 @@ func progressingFromAvailable(available *metav1.Condition, completed bool) metav cond.Message = "Desired state reached" return cond } - if available == nil { + if ready == nil { cond.Reason = ocv1.ReasonRollingOut cond.Message = "Revision is rolling out." return cond } - cond.Message = available.Message - switch available.Reason { + cond.Message = ready.Message + switch ready.Reason { case ocv1.ClusterObjectSetReasonBlocked: cond.Status = metav1.ConditionFalse cond.Reason = ocv1.ReasonBlocked diff --git a/internal/operator-controller/controllers/common_controller_test.go b/internal/operator-controller/controllers/common_controller_test.go index 43ba39ac7f..83fc79ae75 100644 --- a/internal/operator-controller/controllers/common_controller_test.go +++ b/internal/operator-controller/controllers/common_controller_test.go @@ -495,52 +495,52 @@ func TestDetermineFailureReason(t *testing.T) { } } -func TestProgressingFromAvailable(t *testing.T) { +func TestProgressingFromReady(t *testing.T) { for _, tc := range []struct { name string - available *metav1.Condition + ready *metav1.Condition completed bool expected metav1.Condition }{ { name: "completed revision maps to Succeeded", - available: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionTrue, Reason: ocv1.ClusterObjectSetReasonProbesSucceeded, Message: "ok"}, + ready: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionTrue, Reason: ocv1.ClusterObjectSetReasonProbesSucceeded, Message: "ok"}, completed: true, expected: metav1.Condition{Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, Reason: ocv1.ReasonSucceeded, Message: "Desired state reached"}, }, { - name: "nil available on rolling revision defaults to RollingOut", - available: nil, + name: "nil ready on rolling revision defaults to RollingOut", + ready: nil, completed: false, expected: metav1.Condition{Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, Reason: ocv1.ReasonRollingOut, Message: "Revision is rolling out."}, }, { name: "probe failure maps to RollingOut", - available: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionFalse, Reason: ocv1.ClusterObjectSetReasonProbeFailure, Message: "probe failed"}, + ready: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionFalse, Reason: ocv1.ClusterObjectSetReasonProbeFailure, Message: "probe failed"}, completed: false, expected: metav1.Condition{Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, Reason: ocv1.ReasonRollingOut, Message: "probe failed"}, }, { name: "reconciling maps to Retrying", - available: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionUnknown, Reason: ocv1.ClusterObjectSetReasonReconciling, Message: "boom"}, + ready: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionUnknown, Reason: ocv1.ClusterObjectSetReasonReconciling, Message: "boom"}, completed: false, expected: metav1.Condition{Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, Reason: ocv1.ReasonRetrying, Message: "boom"}, }, { name: "blocked maps to Blocked", - available: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionFalse, Reason: ocv1.ClusterObjectSetReasonBlocked, Message: "manual fix needed"}, + ready: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionFalse, Reason: ocv1.ClusterObjectSetReasonBlocked, Message: "manual fix needed"}, completed: false, expected: metav1.Condition{Type: ocv1.TypeProgressing, Status: metav1.ConditionFalse, Reason: ocv1.ReasonBlocked, Message: "manual fix needed"}, }, { name: "deadline exceeded maps to ProgressDeadlineExceeded", - available: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionFalse, Reason: ocv1.ReasonProgressDeadlineExceeded, Message: "too slow"}, + ready: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionFalse, Reason: ocv1.ReasonProgressDeadlineExceeded, Message: "too slow"}, completed: false, expected: metav1.Condition{Type: ocv1.TypeProgressing, Status: metav1.ConditionFalse, Reason: ocv1.ReasonProgressDeadlineExceeded, Message: "too slow"}, }, } { t.Run(tc.name, func(t *testing.T) { - got := progressingFromAvailable(tc.available, tc.completed) + got := progressingFromReady(tc.ready, tc.completed) require.Equal(t, tc.expected.Type, got.Type) require.Equal(t, tc.expected.Status, got.Status) require.Equal(t, tc.expected.Reason, got.Reason)