Skip to content

Commit fba8473

Browse files
⚠️ Remove status.resolution (#1315)
* Remove status.resolution Fixes #1306 Signed-off-by: Lalatendu Mohanty <[email protected]> * Improving the unit test code readability replacing below code with require.NotNil(ct, cond) ``` if !assert.NotNil(ct, cond) { return } ``` Signed-off-by: Lalatendu Mohanty <[email protected]> --------- Signed-off-by: Lalatendu Mohanty <[email protected]>
1 parent 024c78b commit fba8473

9 files changed

+20
-253
lines changed

api/v1alpha1/clusterextension_types.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,6 @@ type BundleMetadata struct {
470470
type ClusterExtensionStatus struct {
471471
Install *ClusterExtensionInstallStatus `json:"install,omitempty"`
472472

473-
Resolution *ClusterExtensionResolutionStatus `json:"resolution,omitempty"`
474-
475473
// conditions is a representation of the current state for this ClusterExtension.
476474
// The status is represented by a set of "conditions".
477475
//
@@ -512,16 +510,6 @@ type ClusterExtensionInstallStatus struct {
512510
Bundle BundleMetadata `json:"bundle"`
513511
}
514512

515-
type ClusterExtensionResolutionStatus struct {
516-
// bundle is a representation of the bundle that was identified during
517-
// resolution to meet all installation/upgrade constraints and is slated to be
518-
// installed or upgraded to.
519-
//
520-
// A "bundle" is a versioned set of content that represents the resources that
521-
// need to be applied to a cluster to install a package.
522-
Bundle BundleMetadata `json:"bundle"`
523-
}
524-
525513
//+kubebuilder:object:root=true
526514
//+kubebuilder:resource:scope=Cluster
527515
//+kubebuilder:subresource:status

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 0 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -572,34 +572,6 @@ spec:
572572
required:
573573
- bundle
574574
type: object
575-
resolution:
576-
properties:
577-
bundle:
578-
description: |-
579-
bundle is a representation of the bundle that was identified during
580-
resolution to meet all installation/upgrade constraints and is slated to be
581-
installed or upgraded to.
582-
583-
A "bundle" is a versioned set of content that represents the resources that
584-
need to be applied to a cluster to install a package.
585-
properties:
586-
name:
587-
description: |-
588-
name is a required field and is a reference
589-
to the name of a bundle
590-
type: string
591-
version:
592-
description: |-
593-
version is a required field and is a reference
594-
to the version that this bundle represents
595-
type: string
596-
required:
597-
- name
598-
- version
599-
type: object
600-
required:
601-
- bundle
602-
type: object
603575
type: object
604576
type: object
605577
served: true

docs/refs/api/operator-controller-api-reference.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Package v1alpha1 contains API Schema definitions for the olm v1alpha1 API group
2424

2525
_Appears in:_
2626
- [ClusterExtensionInstallStatus](#clusterextensioninstallstatus)
27-
- [ClusterExtensionResolutionStatus](#clusterextensionresolutionstatus)
2827

2928
| Field | Description | Default | Validation |
3029
| --- | --- | --- | --- |
@@ -162,22 +161,6 @@ ClusterExtensionList contains a list of ClusterExtension
162161
| `items` _[ClusterExtension](#clusterextension) array_ | | | |
163162

164163

165-
#### ClusterExtensionResolutionStatus
166-
167-
168-
169-
170-
171-
172-
173-
_Appears in:_
174-
- [ClusterExtensionStatus](#clusterextensionstatus)
175-
176-
| Field | Description | Default | Validation |
177-
| --- | --- | --- | --- |
178-
| `bundle` _[BundleMetadata](#bundlemetadata)_ | bundle is a representation of the bundle that was identified during<br />resolution to meet all installation/upgrade constraints and is slated to be<br />installed or upgraded to.<br /><br />A "bundle" is a versioned set of content that represents the resources that<br />need to be applied to a cluster to install a package. | | |
179-
180-
181164
#### ClusterExtensionSpec
182165

183166

@@ -209,7 +192,6 @@ _Appears in:_
209192
| Field | Description | Default | Validation |
210193
| --- | --- | --- | --- |
211194
| `install` _[ClusterExtensionInstallStatus](#clusterextensioninstallstatus)_ | | | |
212-
| `resolution` _[ClusterExtensionResolutionStatus](#clusterextensionresolutionstatus)_ | | | |
213195
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | conditions is a representation of the current state for this ClusterExtension.<br />The status is represented by a set of "conditions".<br /><br />Each condition is generally structured in the following format:<br /> - Type: a string representation of the condition type. More or less the condition "name".<br /> - Status: a string representation of the state of the condition. Can be one of ["True", "False", "Unknown"].<br /> - Reason: a string representation of the reason for the current state of the condition. Typically useful for building automation around particular Type+Reason combinations.<br /> - Message: a human readable message that further elaborates on the state of the condition<br /><br />The global set of condition types are:<br /> - "Installed", represents whether or not the a bundle has been installed for this ClusterExtension<br /> - "Resolved", represents whether or not a bundle was found that satisfies the selection criteria outlined in the spec<br /> - "Unpacked", represents whether or not the bundle contents have been successfully unpacked<br /><br />When the ClusterExtension is sourced from a catalog, the following conditions are also possible:<br /> - "Deprecated", represents an aggregation of the PackageDeprecated, ChannelDeprecated, and BundleDeprecated condition types<br /> - "PackageDeprecated", represents whether or not the package specified in the spec.source.catalog.packageName field has been deprecated<br /> - "ChannelDeprecated", represents whether or not any channel specified in spec.source.catalog.channels has been deprecated<br /> - "BundleDeprecated", represents whether or not the installed bundle is deprecated<br /><br />The current set of reasons are:<br /> - "Success", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when unpacking a bundle's content, resolution and installation/upgrading is successful<br /> - "Failed", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when an error has occurred while unpacking the contents of a bundle, during resolution or installation. | | |
214196

215197

internal/controllers/clusterextension_controller.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
192192
l.Info("handling finalizers")
193193
finalizeResult, err := r.Finalizers.Finalize(ctx, ext)
194194
if err != nil {
195-
setResolutionStatus(ext, nil)
196195
setStatusProgressing(ext, err)
197-
198196
return ctrl.Result{}, err
199197
}
200198
if finalizeResult.Updated || finalizeResult.StatusUpdated {
@@ -219,7 +217,6 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
219217
if err != nil {
220218
// Note: We don't distinguish between resolution-specific errors and generic errors
221219
setInstallStatus(ext, nil)
222-
setResolutionStatus(ext, nil)
223220
setStatusProgressing(ext, err)
224221
ensureAllConditionsWithReason(ext, ocv1alpha1.ReasonFailed, err.Error())
225222
return ctrl.Result{}, err
@@ -242,11 +239,6 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
242239
SetDeprecationStatus(ext, resolvedBundle.Name, resolvedDeprecation)
243240

244241
resolvedBundleMetadata := bundleutil.MetadataFor(resolvedBundle.Name, *resolvedBundleVersion)
245-
resStatus := &ocv1alpha1.ClusterExtensionResolutionStatus{
246-
Bundle: resolvedBundleMetadata,
247-
}
248-
setResolutionStatus(ext, resStatus)
249-
250242
bundleSource := &rukpaksource.BundleSource{
251243
Name: ext.GetName(),
252244
Type: rukpaksource.SourceTypeImage,

internal/controllers/clusterextension_controller_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ func TestClusterExtensionResolutionFails(t *testing.T) {
8282
require.NoError(t, cl.Get(ctx, extKey, clusterExtension))
8383

8484
t.Log("By checking the status fields")
85-
require.Empty(t, clusterExtension.Status.Resolution)
8685
require.Empty(t, clusterExtension.Status.Install)
8786

8887
t.Log("By checking the expected conditions")
@@ -175,7 +174,6 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) {
175174

176175
t.Log("By checking the status fields")
177176
expectedBundleMetadata := ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}
178-
require.Equal(t, expectedBundleMetadata, clusterExtension.Status.Resolution.Bundle)
179177
require.Empty(t, clusterExtension.Status.Install)
180178

181179
t.Log("By checking the expected conditions")
@@ -319,7 +317,6 @@ func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T)
319317

320318
t.Log("By checking the status fields")
321319
expectedBundleMetadata := ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}
322-
require.Equal(t, expectedBundleMetadata, clusterExtension.Status.Resolution.Bundle)
323320
require.Empty(t, clusterExtension.Status.Install)
324321

325322
t.Log("By checking the expected installed conditions")
@@ -418,7 +415,6 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) {
418415

419416
t.Log("By checking the status fields")
420417
expectedBundleMetadata := ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}
421-
require.Equal(t, expectedBundleMetadata, clusterExtension.Status.Resolution.Bundle)
422418
require.Equal(t, expectedBundleMetadata, clusterExtension.Status.Install.Bundle)
423419

424420
t.Log("By checking the expected installed conditions")
@@ -503,7 +499,6 @@ func TestClusterExtensionManagerFailed(t *testing.T) {
503499
require.NoError(t, cl.Get(ctx, extKey, clusterExtension))
504500

505501
t.Log("By checking the status fields")
506-
require.Equal(t, ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Resolution.Bundle)
507502
require.Equal(t, ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle)
508503

509504
t.Log("By checking the expected installed conditions")
@@ -590,7 +585,6 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) {
590585
require.NoError(t, cl.Get(ctx, extKey, clusterExtension))
591586

592587
t.Log("By checking the status fields")
593-
require.Equal(t, ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Resolution.Bundle)
594588
require.Equal(t, ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle)
595589

596590
t.Log("By checking the expected installed conditions")
@@ -674,7 +668,6 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) {
674668
require.NoError(t, cl.Get(ctx, extKey, clusterExtension))
675669

676670
t.Log("By checking the status fields")
677-
require.Equal(t, ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Resolution.Bundle)
678671
require.Equal(t, ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle)
679672

680673
t.Log("By checking the expected installed conditions")

internal/controllers/common_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ func setInstalledStatusConditionFailed(ext *ocv1alpha1.ClusterExtension, message
4848
})
4949
}
5050

51-
func setResolutionStatus(ext *ocv1alpha1.ClusterExtension, resStatus *ocv1alpha1.ClusterExtensionResolutionStatus) {
52-
ext.Status.Resolution = resStatus
53-
}
54-
5551
func setInstallStatus(ext *ocv1alpha1.ClusterExtension, installStatus *ocv1alpha1.ClusterExtensionInstallStatus) {
5652
ext.Status.Install = installStatus
5753
}

0 commit comments

Comments
 (0)