Skip to content

Commit 75c07f5

Browse files
committed
remove unpacked status
1 parent 679e4ab commit 75c07f5

File tree

5 files changed

+4
-85
lines changed

5 files changed

+4
-85
lines changed

api/v1alpha1/clusterextension_types.go

-2
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ const (
422422
TypePackageDeprecated = "PackageDeprecated"
423423
TypeChannelDeprecated = "ChannelDeprecated"
424424
TypeBundleDeprecated = "BundleDeprecated"
425-
TypeUnpacked = "Unpacked"
426425

427426
ReasonSuccess = "Succeeded"
428427
ReasonDeprecated = "Deprecated"
@@ -446,7 +445,6 @@ func init() {
446445
TypePackageDeprecated,
447446
TypeChannelDeprecated,
448447
TypeBundleDeprecated,
449-
TypeUnpacked,
450448
TypeProgressing,
451449
)
452450
// TODO(user): add Reasons from above

internal/controllers/clusterextension_controller.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,14 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
267267
l.V(1).Info("unpacking resolved bundle")
268268
unpackResult, err := r.Unpacker.Unpack(ctx, bundleSource)
269269
if err != nil {
270-
setStatusUnpackFailed(ext, err.Error())
271270
// Wrap the error passed to this with the resolution information until we have successfully
272271
// installed since we intend for the progressing condition to replace the resolved condition
273272
// and will be removing the .status.resolution field from the ClusterExtension status API
274273
setStatusProgressing(ext, wrapErrorWithResolutionInfo(resolvedBundleMetadata, err))
275274
return ctrl.Result{}, err
276275
}
277276

278-
switch unpackResult.State {
279-
case rukpaksource.StateUnpacked:
280-
setStatusUnpacked(ext, unpackResult.Message)
281-
default:
277+
if unpackResult.State != rukpaksource.StateUnpacked {
282278
panic(fmt.Sprintf("unexpected unpack state %q", unpackResult.State))
283279
}
284280

internal/controllers/clusterextension_controller_test.go

+3-30
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,6 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) {
167167
require.Equal(t, ocv1alpha1.ReasonSuccess, resolvedCond.Reason)
168168
require.Equal(t, "resolved to \"quay.io/operatorhubio/[email protected]\"", resolvedCond.Message)
169169

170-
t.Log("By checking the expected unpacked conditions")
171-
unpackedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeUnpacked)
172-
require.NotNil(t, unpackedCond)
173-
require.Equal(t, metav1.ConditionFalse, unpackedCond.Status)
174-
require.Equal(t, ocv1alpha1.ReasonFailed, unpackedCond.Reason)
175-
176170
progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing)
177171
require.NotNil(t, progressingCond)
178172
require.Equal(t, metav1.ConditionTrue, progressingCond.Status)
@@ -233,9 +227,12 @@ func TestClusterExtensionUnpackUnexpectedState(t *testing.T) {
233227
Image: "quay.io/operatorhubio/[email protected]",
234228
}, &v, nil, nil
235229
})
230+
236231
require.Panics(t, func() {
237232
_, _ = reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: extKey})
238233
}, "reconciliation should panic on unknown unpack state")
234+
235+
require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{}))
239236
}
240237

241238
func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T) {
@@ -312,12 +309,6 @@ func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T)
312309
require.Equal(t, ocv1alpha1.ReasonSuccess, resolvedCond.Reason)
313310
require.Equal(t, "resolved to \"quay.io/operatorhubio/[email protected]\"", resolvedCond.Message)
314311

315-
t.Log("By checking the expected unpacked conditions")
316-
unpackedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeUnpacked)
317-
require.NotNil(t, unpackedCond)
318-
require.Equal(t, metav1.ConditionTrue, unpackedCond.Status)
319-
require.Equal(t, ocv1alpha1.ReasonSuccess, unpackedCond.Reason)
320-
321312
t.Log("By checking the expected installed conditions")
322313
installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled)
323314
require.NotNil(t, installedCond)
@@ -410,12 +401,6 @@ func TestClusterExtensionManagerFailed(t *testing.T) {
410401
require.Equal(t, ocv1alpha1.ReasonSuccess, resolvedCond.Reason)
411402
require.Equal(t, "resolved to \"quay.io/operatorhubio/[email protected]\"", resolvedCond.Message)
412403

413-
t.Log("By checking the expected unpacked conditions")
414-
unpackedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeUnpacked)
415-
require.NotNil(t, unpackedCond)
416-
require.Equal(t, metav1.ConditionTrue, unpackedCond.Status)
417-
require.Equal(t, ocv1alpha1.ReasonSuccess, unpackedCond.Reason)
418-
419404
t.Log("By checking the expected installed conditions")
420405
installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled)
421406
require.NotNil(t, installedCond)
@@ -510,12 +495,6 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) {
510495
require.Equal(t, ocv1alpha1.ReasonSuccess, resolvedCond.Reason)
511496
require.Equal(t, "resolved to \"quay.io/operatorhubio/[email protected]\"", resolvedCond.Message)
512497

513-
t.Log("By checking the expected unpacked conditions")
514-
unpackedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeUnpacked)
515-
require.NotNil(t, unpackedCond)
516-
require.Equal(t, metav1.ConditionTrue, unpackedCond.Status)
517-
require.Equal(t, ocv1alpha1.ReasonSuccess, unpackedCond.Reason)
518-
519498
t.Log("By checking the expected installed conditions")
520499
installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled)
521500
require.NotNil(t, installedCond)
@@ -607,12 +586,6 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) {
607586
require.Equal(t, ocv1alpha1.ReasonSuccess, resolvedCond.Reason)
608587
require.Equal(t, "resolved to \"quay.io/operatorhubio/[email protected]\"", resolvedCond.Message)
609588

610-
t.Log("By checking the expected unpacked conditions")
611-
unpackedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeUnpacked)
612-
require.NotNil(t, unpackedCond)
613-
require.Equal(t, metav1.ConditionTrue, unpackedCond.Status)
614-
require.Equal(t, ocv1alpha1.ReasonSuccess, unpackedCond.Reason)
615-
616589
t.Log("By checking the expected installed conditions")
617590
installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled)
618591
require.NotNil(t, installedCond)

internal/controllers/common_controller.go

-24
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,6 @@ func setInstalledStatusConditionFailed(ext *ocv1alpha1.ClusterExtension, message
7070
})
7171
}
7272

73-
func setStatusUnpackFailed(ext *ocv1alpha1.ClusterExtension, message string) {
74-
setInstallStatus(ext, nil)
75-
apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{
76-
Type: ocv1alpha1.TypeUnpacked,
77-
Status: metav1.ConditionFalse,
78-
Reason: ocv1alpha1.ReasonFailed,
79-
Message: message,
80-
ObservedGeneration: ext.GetGeneration(),
81-
})
82-
}
83-
84-
func setStatusUnpacked(ext *ocv1alpha1.ClusterExtension, message string) {
85-
if message == "" {
86-
message = "unpack successful"
87-
}
88-
apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{
89-
Type: ocv1alpha1.TypeUnpacked,
90-
Status: metav1.ConditionTrue,
91-
Reason: ocv1alpha1.ReasonSuccess,
92-
Message: message,
93-
ObservedGeneration: ext.GetGeneration(),
94-
})
95-
}
96-
9773
func setResolutionStatus(ext *ocv1alpha1.ClusterExtension, resStatus *ocv1alpha1.ClusterExtensionResolutionStatus) {
9874
ext.Status.Resolution = resStatus
9975
}

test/e2e/cluster_extension_install_test.go

-24
Original file line numberDiff line numberDiff line change
@@ -284,18 +284,6 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {
284284
)
285285
}, pollDuration, pollInterval)
286286

287-
t.Log("By eventually reporting a successful unpacked")
288-
require.EventuallyWithT(t, func(ct *assert.CollectT) {
289-
assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension))
290-
cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeUnpacked)
291-
if !assert.NotNil(ct, cond) {
292-
return
293-
}
294-
assert.Equal(ct, metav1.ConditionTrue, cond.Status)
295-
assert.Equal(ct, ocv1alpha1.ReasonSuccess, cond.Reason)
296-
assert.Regexp(ct, "^unpacked .* successfully", cond.Message)
297-
}, pollDuration, pollInterval)
298-
299287
t.Log("By eventually reporting no longer progressing")
300288
require.EventuallyWithT(t, func(ct *assert.CollectT) {
301289
assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension))
@@ -968,18 +956,6 @@ func TestClusterExtensionRecoversFromInitialInstallFailedWhenFailureFixed(t *tes
968956
)
969957
}, pollDuration, pollInterval)
970958

971-
t.Log("By eventually reporting a successful unpacked")
972-
require.EventuallyWithT(t, func(ct *assert.CollectT) {
973-
assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension))
974-
cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeUnpacked)
975-
if !assert.NotNil(ct, cond) {
976-
return
977-
}
978-
assert.Equal(ct, metav1.ConditionTrue, cond.Status)
979-
assert.Equal(ct, ocv1alpha1.ReasonSuccess, cond.Reason)
980-
assert.Regexp(ct, "^unpacked .* successfully", cond.Message)
981-
}, pollDuration, pollInterval)
982-
983959
t.Log("By eventually reporting Progressing == True with Reason Retrying")
984960
require.EventuallyWithT(t, func(ct *assert.CollectT) {
985961
assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension))

0 commit comments

Comments
 (0)