diff --git a/api/v1/clusterobjectset_types.go b/api/v1/clusterobjectset_types.go index 0bc971dcb5..4a22ad15a2 100644 --- a/api/v1/clusterobjectset_types.go +++ b/api/v1/clusterobjectset_types.go @@ -30,6 +30,7 @@ const ( // Condition Reasons ClusterObjectSetReasonArchived = "Archived" + ClusterObjectSetReasonArchiving = "Archiving" ClusterObjectSetReasonObjectsNotReady = "ObjectsNotReady" ClusterObjectSetReasonObjectCollision = "ObjectCollision" ClusterObjectSetReasonRetryableError = "RetryableError" @@ -504,6 +505,7 @@ type ClusterObjectSetStatus struct { // - False with reason ValidationFailure: the revision failed a pre-apply check (an invalid revision/phase object or probe, preflight validation, a mutable referenced Secret, or changed referenced content) and requires manual intervention. // - False with reason ProgressDeadlineExceeded: the revision did not roll out within spec.progressDeadlineMinutes. // - False with reason RetryableError: the revision encountered a transient error that may resolve on a subsequent reconciliation. + // - False with reason Archiving: the revision is being archived and its owned objects are still being torn down. // - False with reason Archived: the revision has been archived and its objects have been torn down. // // Rollout completion is recorded separately by status.completedAt. diff --git a/applyconfigurations/api/v1/clusterobjectsetstatus.go b/applyconfigurations/api/v1/clusterobjectsetstatus.go index 581f3fb11f..16eb7a7f84 100644 --- a/applyconfigurations/api/v1/clusterobjectsetstatus.go +++ b/applyconfigurations/api/v1/clusterobjectsetstatus.go @@ -45,6 +45,7 @@ type ClusterObjectSetStatusApplyConfiguration struct { // - False with reason ValidationFailure: the revision failed a pre-apply check (an invalid revision/phase object or probe, preflight validation, a mutable referenced Secret, or changed referenced content) and requires manual intervention. // - False with reason ProgressDeadlineExceeded: the revision did not roll out within spec.progressDeadlineMinutes. // - False with reason RetryableError: the revision encountered a transient error that may resolve on a subsequent reconciliation. + // - False with reason Archiving: the revision is being archived and its owned objects are still being torn down. // - False with reason Archived: the revision has been archived and its objects have been torn down. // // Rollout completion is recorded separately by status.completedAt. diff --git a/docs/draft/concepts/clusterobjectsets.md b/docs/draft/concepts/clusterobjectsets.md index 7953c608ac..8c48744509 100644 --- a/docs/draft/concepts/clusterobjectsets.md +++ b/docs/draft/concepts/clusterobjectsets.md @@ -221,7 +221,8 @@ Indicates whether all objects in the revision have been successfully rolled out | False | `ObjectCollision` | One or more objects are controlled by another owner, or are unowned and collision protection prevents adoption | | False | `ValidationFailure` | A pre-apply check failed (an invalid revision/phase object or probe, preflight validation, a mutable referenced Secret, or changed referenced content); requires manual intervention | | Unknown | `RetryableError` | Error prevented probe observation | -| Unknown | `Archived` | Objects torn down after archival | +| False | `Archiving` | The revision is being archived; owned objects are still being torn down | +| False | `Archived` | Objects torn down after archival | | Unknown | `Migrated` | Migrated from existing release; probes not yet observed | ### Succeeded diff --git a/helm/olmv1/base/object-controller/crd/experimental/olm.operatorframework.io_clusterobjectsets.yaml b/helm/olmv1/base/object-controller/crd/experimental/olm.operatorframework.io_clusterobjectsets.yaml index 6284bd8f21..31c3a9ec7f 100644 --- a/helm/olmv1/base/object-controller/crd/experimental/olm.operatorframework.io_clusterobjectsets.yaml +++ b/helm/olmv1/base/object-controller/crd/experimental/olm.operatorframework.io_clusterobjectsets.yaml @@ -564,6 +564,7 @@ spec: - False with reason ValidationFailure: the revision failed a pre-apply check (an invalid revision/phase object or probe, preflight validation, a mutable referenced Secret, or changed referenced content) and requires manual intervention. - False with reason ProgressDeadlineExceeded: the revision did not roll out within spec.progressDeadlineMinutes. - False with reason RetryableError: the revision encountered a transient error that may resolve on a subsequent reconciliation. + - False with reason Archiving: the revision is being archived and its owned objects are still being torn down. - False with reason Archived: the revision has been archived and its objects have been torn down. Rollout completion is recorded separately by status.completedAt. diff --git a/internal/object-controller/controllers/clusterobjectset_controller.go b/internal/object-controller/controllers/clusterobjectset_controller.go index 28b31c6904..4949f8d715 100644 --- a/internal/object-controller/controllers/clusterobjectset_controller.go +++ b/internal/object-controller/controllers/clusterobjectset_controller.go @@ -393,7 +393,7 @@ func (c *ClusterObjectSetReconciler) archive(ctx context.Context, revisionEngine return ctrl.Result{}, err } if tdres != nil && !tdres.IsComplete() { - setRetryableErrorConditions(cos, "removing revision resources that are not owned by another revision", false) + markAsArchiving(cos) return ctrl.Result{RequeueAfter: 5 * time.Second}, nil } // Ensure conditions are set before removing the finalizer when archiving @@ -780,6 +780,11 @@ func markAsNotReady(cos *ocv1.ClusterObjectSet, reason, message string) bool { }) } +func markAsArchiving(cos *ocv1.ClusterObjectSet) { + const msg = "The object set is being archived; removing owned objects." + markAsNotReady(cos, ocv1.ClusterObjectSetReasonArchiving, msg) +} + func markAsArchived(cos *ocv1.ClusterObjectSet) bool { const msg = "revision is archived" return markAsNotReady(cos, ocv1.ClusterObjectSetReasonArchived, msg) diff --git a/internal/object-controller/controllers/clusterobjectset_controller_test.go b/internal/object-controller/controllers/clusterobjectset_controller_test.go index b7e67a3f62..d5165bdfee 100644 --- a/internal/object-controller/controllers/clusterobjectset_controller_test.go +++ b/internal/object-controller/controllers/clusterobjectset_controller_test.go @@ -1157,7 +1157,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T) }, }, { - name: "set Ready:False:RetryableError and requeue when archived revision archival is incomplete", + name: "set Ready:False:Archiving and requeue when archived revision archival is incomplete", revisionResult: newMockRevisionResult(mockCtrl, revisionResultConfig{}), existingObjs: func() []client.Object { ext := newTestClusterExtension() @@ -1185,8 +1185,8 @@ func Test_ClusterObjectSetReconciler_Reconcile_ArchivalAndDeletion(t *testing.T) cond := meta.FindStatusCondition(rev.Status.Conditions, ocv1.ClusterObjectSetTypeReady) require.NotNil(t, cond) require.Equal(t, metav1.ConditionFalse, cond.Status) - require.Equal(t, ocv1.ClusterObjectSetReasonRetryableError, cond.Reason) - require.Equal(t, "removing revision resources that are not owned by another revision", cond.Message) + require.Equal(t, ocv1.ClusterObjectSetReasonArchiving, cond.Reason) + require.Equal(t, "The object set is being archived; removing owned objects.", cond.Message) // Finalizer should still be present require.Contains(t, rev.Finalizers, "olm.operatorframework.io/teardown") diff --git a/internal/operator-controller/controllers/common_controller_test.go b/internal/operator-controller/controllers/common_controller_test.go index 53ae38470b..a98e5f3d51 100644 --- a/internal/operator-controller/controllers/common_controller_test.go +++ b/internal/operator-controller/controllers/common_controller_test.go @@ -520,6 +520,12 @@ func TestProgressingFromReady(t *testing.T) { completed: false, expected: metav1.Condition{Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, Reason: ocv1.ReasonRollingOut, Message: "Objects are not yet ready."}, }, + { + name: "archiving maps to RollingOut", + ready: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionFalse, Reason: ocv1.ClusterObjectSetReasonArchiving, Message: "The object set is being archived; removing owned objects."}, + completed: false, + expected: metav1.Condition{Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, Reason: ocv1.ReasonRollingOut, Message: "The object set is being archived; removing owned objects."}, + }, { name: "retryable error maps to Retrying", ready: &metav1.Condition{Type: ocv1.ClusterObjectSetTypeReady, Status: metav1.ConditionUnknown, Reason: ocv1.ClusterObjectSetReasonRetryableError, Message: "boom"}, diff --git a/manifests/experimental-e2e.yaml b/manifests/experimental-e2e.yaml index 778fa5019d..3e876e7182 100644 --- a/manifests/experimental-e2e.yaml +++ b/manifests/experimental-e2e.yaml @@ -1975,6 +1975,7 @@ spec: - False with reason ValidationFailure: the revision failed a pre-apply check (an invalid revision/phase object or probe, preflight validation, a mutable referenced Secret, or changed referenced content) and requires manual intervention. - False with reason ProgressDeadlineExceeded: the revision did not roll out within spec.progressDeadlineMinutes. - False with reason RetryableError: the revision encountered a transient error that may resolve on a subsequent reconciliation. + - False with reason Archiving: the revision is being archived and its owned objects are still being torn down. - False with reason Archived: the revision has been archived and its objects have been torn down. Rollout completion is recorded separately by status.completedAt. diff --git a/manifests/experimental.yaml b/manifests/experimental.yaml index 9fd387cac6..8891ae4962 100644 --- a/manifests/experimental.yaml +++ b/manifests/experimental.yaml @@ -1936,6 +1936,7 @@ spec: - False with reason ValidationFailure: the revision failed a pre-apply check (an invalid revision/phase object or probe, preflight validation, a mutable referenced Secret, or changed referenced content) and requires manual intervention. - False with reason ProgressDeadlineExceeded: the revision did not roll out within spec.progressDeadlineMinutes. - False with reason RetryableError: the revision encountered a transient error that may resolve on a subsequent reconciliation. + - False with reason Archiving: the revision is being archived and its owned objects are still being torn down. - False with reason Archived: the revision has been archived and its objects have been torn down. Rollout completion is recorded separately by status.completedAt.