@@ -16,6 +16,7 @@ import (
1616 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1717 "k8s.io/component-base/featuregate"
1818 "k8s.io/klog/v2/textlogger"
19+ "sigs.k8s.io/controller-runtime/pkg/client"
1920
2021 "github.com/operator-framework/operator-controller/internal/operator-controller/features"
2122)
@@ -32,6 +33,26 @@ type scenarioContext struct {
3233 removedResources []unstructured.Unstructured
3334 backGroundCmds []* exec.Cmd
3435 metricsResponse map [string ]string
36+
37+ extensionObjects []client.Object
38+ }
39+
40+ // GatherClusterExtensionObjects collects all resources related to the ClusterExtension container in
41+ // either their Helm release Secret or ClusterExtensionRevision depending on the applier being used
42+ // and saves them into the context.
43+ func (s * scenarioContext ) GatherClusterExtensionObjects () error {
44+ objs , err := listExtensionResources (s .clusterExtensionName )
45+ if err != nil {
46+ return fmt .Errorf ("failed to load extension resources into context: %w" , err )
47+ }
48+ s .extensionObjects = objs
49+ return nil
50+ }
51+
52+ // GetClusterExtensionObjects returns the ClusterExtension objects currently saved into the context.
53+ // Will always return nil until GatherClusterExtensionObjects is called
54+ func (s * scenarioContext ) GetClusterExtensionObjects () []client.Object {
55+ return s .extensionObjects
3556}
3657
3758type contextKey string
0 commit comments