diff --git a/PROJECT b/PROJECT index 500d2061d..a307347a4 100644 --- a/PROJECT +++ b/PROJECT @@ -12,7 +12,7 @@ resources: group: olm kind: ClusterExtension path: github.com/operator-framework/operator-controller/api/v1 - version: v1alpha1 + version: v1 - api: crdVersion: v1 namespaced: true @@ -20,6 +20,6 @@ resources: domain: operatorframework.io group: olm kind: Extension - path: github.com/operator-framework/operator-controller/api/v11 - version: v1alpha1 + path: github.com/operator-framework/operator-controller/api/v1 + version: v1 version: "3" diff --git a/cmd/manager/main.go b/cmd/manager/main.go index 959258026..563e51479 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -49,7 +49,7 @@ import ( catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/action" "github.com/operator-framework/operator-controller/internal/applier" "github.com/operator-framework/operator-controller/internal/authentication" @@ -141,8 +141,8 @@ func main() { setupLog.Info("set up manager") cacheOptions := crcache.Options{ ByObject: map[client.Object]crcache.ByObject{ - &ocv1alpha1.ClusterExtension{}: {Label: k8slabels.Everything()}, - &catalogd.ClusterCatalog{}: {Label: k8slabels.Everything()}, + &ocv1.ClusterExtension{}: {Label: k8slabels.Everything()}, + &catalogd.ClusterCatalog{}: {Label: k8slabels.Everything()}, }, DefaultNamespaces: map[string]crcache.Config{ systemNamespace: {LabelSelector: k8slabels.Everything()}, @@ -196,7 +196,7 @@ func main() { cfgGetter, err := helmclient.NewActionConfigGetter(mgr.GetConfig(), mgr.GetRESTMapper(), helmclient.StorageDriverMapper(action.ChunkedStorageDriverMapper(coreClient, mgr.GetAPIReader(), systemNamespace)), helmclient.ClientNamespaceMapper(func(obj client.Object) (string, error) { - ext := obj.(*ocv1alpha1.ClusterExtension) + ext := obj.(*ocv1.ClusterExtension) return ext.Spec.Namespace, nil }), helmclient.ClientRestConfigMapper(clientRestConfigMapper), @@ -291,7 +291,7 @@ func main() { cm := contentmanager.NewManager(clientRestConfigMapper, mgr.GetConfig(), mgr.GetRESTMapper()) err = clusterExtensionFinalizers.Register(controllers.ClusterExtensionCleanupContentManagerCacheFinalizer, finalizers.FinalizerFunc(func(ctx context.Context, obj client.Object) (crfinalizer.Result, error) { - ext := obj.(*ocv1alpha1.ClusterExtension) + ext := obj.(*ocv1.ClusterExtension) err := cm.Delete(ext) return crfinalizer.Result{}, err })) diff --git a/internal/action/restconfig.go b/internal/action/restconfig.go index 6f16966d4..cca0b1fb3 100644 --- a/internal/action/restconfig.go +++ b/internal/action/restconfig.go @@ -8,13 +8,13 @@ import ( "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/client" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/authentication" ) func ServiceAccountRestConfigMapper(tokenGetter *authentication.TokenGetter) func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) { return func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) { - cExt := o.(*ocv1alpha1.ClusterExtension) + cExt := o.(*ocv1.ClusterExtension) saKey := types.NamespacedName{ Name: cExt.Spec.ServiceAccount.Name, Namespace: cExt.Spec.Namespace, diff --git a/internal/applier/helm.go b/internal/applier/helm.go index 21032ca58..4ed914b5e 100644 --- a/internal/applier/helm.go +++ b/internal/applier/helm.go @@ -23,7 +23,7 @@ import ( helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/rukpak/convert" "github.com/operator-framework/operator-controller/internal/rukpak/preflights/crdupgradesafety" "github.com/operator-framework/operator-controller/internal/rukpak/util" @@ -59,7 +59,7 @@ type Helm struct { // shouldSkipPreflight is a helper to determine if the preflight check is CRDUpgradeSafety AND // if it is set to enforcement None. -func shouldSkipPreflight(ctx context.Context, preflight Preflight, ext *ocv1alpha1.ClusterExtension, state string) bool { +func shouldSkipPreflight(ctx context.Context, preflight Preflight, ext *ocv1.ClusterExtension, state string) bool { l := log.FromContext(ctx) hasCRDUpgradeSafety := ext.Spec.Install != nil && ext.Spec.Install.Preflight != nil && ext.Spec.Install.Preflight.CRDUpgradeSafety != nil _, isCRDUpgradeSafetyInstance := preflight.(*crdupgradesafety.Preflight) @@ -68,7 +68,7 @@ func shouldSkipPreflight(ctx context.Context, preflight Preflight, ext *ocv1alph if state == StateNeedsInstall || state == StateNeedsUpgrade { l.Info("crdUpgradeSafety ", "policy", ext.Spec.Install.Preflight.CRDUpgradeSafety.Enforcement) } - if ext.Spec.Install.Preflight.CRDUpgradeSafety.Enforcement == ocv1alpha1.CRDUpgradeSafetyEnforcementNone { + if ext.Spec.Install.Preflight.CRDUpgradeSafety.Enforcement == ocv1.CRDUpgradeSafetyEnforcementNone { // Skip this preflight check because it is of type *crdupgradesafety.Preflight and the CRD Upgrade Safety // policy is set to None return true @@ -77,7 +77,7 @@ func shouldSkipPreflight(ctx context.Context, preflight Preflight, ext *ocv1alph return false } -func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1alpha1.ClusterExtension, objectLabels map[string]string, storageLabels map[string]string) ([]client.Object, string, error) { +func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1.ClusterExtension, objectLabels map[string]string, storageLabels map[string]string) ([]client.Object, string, error) { chrt, err := convert.RegistryV1ToHelmChart(ctx, contentFS, ext.Spec.Namespace, []string{corev1.NamespaceAll}) if err != nil { return nil, "", err @@ -151,7 +151,7 @@ func (h *Helm) Apply(ctx context.Context, contentFS fs.FS, ext *ocv1alpha1.Clust return relObjects, state, nil } -func (h *Helm) getReleaseState(cl helmclient.ActionInterface, ext *ocv1alpha1.ClusterExtension, chrt *chart.Chart, values chartutil.Values, post postrender.PostRenderer) (*release.Release, *release.Release, string, error) { +func (h *Helm) getReleaseState(cl helmclient.ActionInterface, ext *ocv1.ClusterExtension, chrt *chart.Chart, values chartutil.Values, post postrender.PostRenderer) (*release.Release, *release.Release, string, error) { currentRelease, err := cl.Get(ext.GetName()) if err != nil && !errors.Is(err, driver.ErrReleaseNotFound) { return nil, nil, StateError, err diff --git a/internal/bundleutil/bundle.go b/internal/bundleutil/bundle.go index bf8de0fd8..e12368068 100644 --- a/internal/bundleutil/bundle.go +++ b/internal/bundleutil/bundle.go @@ -9,7 +9,7 @@ import ( "github.com/operator-framework/operator-registry/alpha/declcfg" "github.com/operator-framework/operator-registry/alpha/property" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) func GetVersion(b declcfg.Bundle) (*bsemver.Version, error) { @@ -30,8 +30,8 @@ func GetVersion(b declcfg.Bundle) (*bsemver.Version, error) { } // MetadataFor returns a BundleMetadata for the given bundle name and version. -func MetadataFor(bundleName string, bundleVersion bsemver.Version) ocv1alpha1.BundleMetadata { - return ocv1alpha1.BundleMetadata{ +func MetadataFor(bundleName string, bundleVersion bsemver.Version) ocv1.BundleMetadata { + return ocv1.BundleMetadata{ Name: bundleName, Version: bundleVersion.String(), } diff --git a/internal/catalogmetadata/filter/successors.go b/internal/catalogmetadata/filter/successors.go index 28bd05d47..67f24e97e 100644 --- a/internal/catalogmetadata/filter/successors.go +++ b/internal/catalogmetadata/filter/successors.go @@ -8,11 +8,11 @@ import ( "github.com/operator-framework/operator-registry/alpha/declcfg" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/features" ) -func SuccessorsOf(installedBundle ocv1alpha1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) { +func SuccessorsOf(installedBundle ocv1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) { var successors successorsPredicateFunc = legacySuccessor if features.OperatorControllerFeatureGate.Enabled(features.ForceSemverUpgradeConstraints) { successors = semverSuccessor @@ -42,9 +42,9 @@ func SuccessorsOf(installedBundle ocv1alpha1.BundleMetadata, channels ...declcfg // successorsPredicateFunc returns a predicate to find successors // for a bundle. Predicate must not include the current version. -type successorsPredicateFunc func(installedBundle ocv1alpha1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) +type successorsPredicateFunc func(installedBundle ocv1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) -func legacySuccessor(installedBundle ocv1alpha1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) { +func legacySuccessor(installedBundle ocv1.BundleMetadata, channels ...declcfg.Channel) (Predicate[declcfg.Bundle], error) { installedBundleVersion, err := bsemver.Parse(installedBundle.Version) if err != nil { return nil, fmt.Errorf("error parsing installed bundle version: %w", err) @@ -88,7 +88,7 @@ func legacySuccessor(installedBundle ocv1alpha1.BundleMetadata, channels ...decl // in a channel entry that is necessary to determine if a bundle is a successor. // A semver range check is the only necessary element. If filtering by channel // membership is necessary, an additional filter for that purpose should be applied. -func semverSuccessor(installedBundle ocv1alpha1.BundleMetadata, _ ...declcfg.Channel) (Predicate[declcfg.Bundle], error) { +func semverSuccessor(installedBundle ocv1.BundleMetadata, _ ...declcfg.Channel) (Predicate[declcfg.Bundle], error) { currentVersion, err := mmsemver.NewVersion(installedBundle.Version) if err != nil { return nil, err diff --git a/internal/catalogmetadata/filter/successors_test.go b/internal/catalogmetadata/filter/successors_test.go index af23725da..caec01509 100644 --- a/internal/catalogmetadata/filter/successors_test.go +++ b/internal/catalogmetadata/filter/successors_test.go @@ -14,7 +14,7 @@ import ( "github.com/operator-framework/operator-registry/alpha/declcfg" "github.com/operator-framework/operator-registry/alpha/property" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/bundleutil" "github.com/operator-framework/operator-controller/internal/catalogmetadata/compare" "github.com/operator-framework/operator-controller/internal/features" @@ -129,7 +129,7 @@ func TestSuccessorsPredicateWithForceSemverUpgradeConstraintsEnabled(t *testing. for _, tt := range []struct { name string - installedBundle ocv1alpha1.BundleMetadata + installedBundle ocv1.BundleMetadata expectedResult []declcfg.Bundle }{ { @@ -162,7 +162,7 @@ func TestSuccessorsPredicateWithForceSemverUpgradeConstraintsEnabled(t *testing. }, { name: "installed bundle not found", - installedBundle: ocv1alpha1.BundleMetadata{ + installedBundle: ocv1.BundleMetadata{ Name: "test-package.v9.0.0", Version: "9.0.0", }, @@ -281,7 +281,7 @@ func TestSuccessorsPredicateWithForceSemverUpgradeConstraintsDisabled(t *testing for _, tt := range []struct { name string - installedBundle ocv1alpha1.BundleMetadata + installedBundle ocv1.BundleMetadata expectedResult []declcfg.Bundle }{ { @@ -319,7 +319,7 @@ func TestSuccessorsPredicateWithForceSemverUpgradeConstraintsDisabled(t *testing }, { name: "installed bundle not found", - installedBundle: ocv1alpha1.BundleMetadata{ + installedBundle: ocv1.BundleMetadata{ Name: "test-package.v9.0.0", Version: "9.0.0", }, @@ -368,7 +368,7 @@ func TestLegacySuccessor(t *testing.T) { }, }, } - installedBundle := ocv1alpha1.BundleMetadata{ + installedBundle := ocv1.BundleMetadata{ Name: "package1.v0.0.1", Version: "0.0.1", } diff --git a/internal/contentmanager/cache/cache_test.go b/internal/contentmanager/cache/cache_test.go index 30b2bc8aa..da4455168 100644 --- a/internal/contentmanager/cache/cache_test.go +++ b/internal/contentmanager/cache/cache_test.go @@ -14,7 +14,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) type mockWatcher struct { @@ -64,7 +64,7 @@ func TestCacheWatch(t *testing.T) { &mockSourcerer{ source: &mockSource{}, }, - &ocv1alpha1.ClusterExtension{}, + &ocv1.ClusterExtension{}, time.Second, ) @@ -81,7 +81,7 @@ func TestCacheWatchInvalidGVK(t *testing.T) { &mockSourcerer{ source: &mockSource{}, }, - &ocv1alpha1.ClusterExtension{}, + &ocv1.ClusterExtension{}, time.Second, ) @@ -94,7 +94,7 @@ func TestCacheWatchSourcererError(t *testing.T) { &mockSourcerer{ err: errors.New("error"), }, - &ocv1alpha1.ClusterExtension{}, + &ocv1.ClusterExtension{}, time.Second, ) @@ -109,7 +109,7 @@ func TestCacheWatchWatcherError(t *testing.T) { &mockSourcerer{ source: &mockSource{}, }, - &ocv1alpha1.ClusterExtension{}, + &ocv1.ClusterExtension{}, time.Second, ) @@ -126,7 +126,7 @@ func TestCacheWatchSourceWaitForSyncError(t *testing.T) { err: errors.New("error"), }, }, - &ocv1alpha1.ClusterExtension{}, + &ocv1.ClusterExtension{}, time.Second, ) @@ -142,7 +142,7 @@ func TestCacheWatchExistingSourceNotPanic(t *testing.T) { &mockSourcerer{ source: &mockSource{}, }, - &ocv1alpha1.ClusterExtension{}, + &ocv1.ClusterExtension{}, time.Second, ) @@ -162,7 +162,7 @@ func TestCacheWatchRemovesStaleSources(t *testing.T) { &mockSourcerer{ source: &mockSource{}, }, - &ocv1alpha1.ClusterExtension{}, + &ocv1.ClusterExtension{}, time.Second, ) @@ -186,7 +186,7 @@ func TestCacheWatchRemovingStaleSourcesError(t *testing.T) { &mockSourcerer{ source: &mockSource{}, }, - &ocv1alpha1.ClusterExtension{}, + &ocv1.ClusterExtension{}, time.Second, ) diff --git a/internal/controllers/clusterextension_admission_test.go b/internal/controllers/clusterextension_admission_test.go index 483a744f7..b7e32c668 100644 --- a/internal/controllers/clusterextension_admission_test.go +++ b/internal/controllers/clusterextension_admission_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) func TestClusterExtensionSourceConfig(t *testing.T) { @@ -36,26 +36,26 @@ func TestClusterExtensionSourceConfig(t *testing.T) { cl := newClient(t) var err error if tc.unionField == "Catalog" { - err = cl.Create(context.Background(), buildClusterExtension(ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + err = cl.Create(context.Background(), buildClusterExtension(ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: tc.sourceType, - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "test-package", }, }, Namespace: "default", - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: "default", }, })) } if tc.unionField == "" { - err = cl.Create(context.Background(), buildClusterExtension(ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + err = cl.Create(context.Background(), buildClusterExtension(ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: tc.sourceType, }, Namespace: "default", - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: "default", }, })) @@ -106,15 +106,15 @@ func TestClusterExtensionAdmissionPackageName(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() cl := newClient(t) - err := cl.Create(context.Background(), buildClusterExtension(ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + err := cl.Create(context.Background(), buildClusterExtension(ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: tc.pkgName, }, }, Namespace: "default", - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: "default", }, })) @@ -203,16 +203,16 @@ func TestClusterExtensionAdmissionVersion(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() cl := newClient(t) - err := cl.Create(context.Background(), buildClusterExtension(ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + err := cl.Create(context.Background(), buildClusterExtension(ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "package", Version: tc.version, }, }, Namespace: "default", - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: "default", }, })) @@ -258,16 +258,16 @@ func TestClusterExtensionAdmissionChannel(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() cl := newClient(t) - err := cl.Create(context.Background(), buildClusterExtension(ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + err := cl.Create(context.Background(), buildClusterExtension(ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "package", Channels: tc.channels, }, }, Namespace: "default", - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: "default", }, })) @@ -312,15 +312,15 @@ func TestClusterExtensionAdmissionInstallNamespace(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() cl := newClient(t) - err := cl.Create(context.Background(), buildClusterExtension(ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + err := cl.Create(context.Background(), buildClusterExtension(ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "package", }, }, Namespace: tc.namespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: "default", }, })) @@ -366,15 +366,15 @@ func TestClusterExtensionAdmissionServiceAccount(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() cl := newClient(t) - err := cl.Create(context.Background(), buildClusterExtension(ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + err := cl.Create(context.Background(), buildClusterExtension(ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "package", }, }, Namespace: "default", - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: tc.serviceAccount, }, })) @@ -393,20 +393,20 @@ func TestClusterExtensionAdmissionInstall(t *testing.T) { testCases := []struct { name string - installConfig *ocv1alpha1.ClusterExtensionInstallConfig + installConfig *ocv1.ClusterExtensionInstallConfig errMsg string }{ { name: "install specified, nothing configured", - installConfig: &ocv1alpha1.ClusterExtensionInstallConfig{}, + installConfig: &ocv1.ClusterExtensionInstallConfig{}, errMsg: oneOfErrMsg, }, { name: "install specified, preflight configured", - installConfig: &ocv1alpha1.ClusterExtensionInstallConfig{ - Preflight: &ocv1alpha1.PreflightConfig{ - CRDUpgradeSafety: &ocv1alpha1.CRDUpgradeSafetyPreflightConfig{ - Enforcement: ocv1alpha1.CRDUpgradeSafetyEnforcementNone, + installConfig: &ocv1.ClusterExtensionInstallConfig{ + Preflight: &ocv1.PreflightConfig{ + CRDUpgradeSafety: &ocv1.CRDUpgradeSafetyPreflightConfig{ + Enforcement: ocv1.CRDUpgradeSafetyEnforcementNone, }, }, }, @@ -425,15 +425,15 @@ func TestClusterExtensionAdmissionInstall(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() cl := newClient(t) - err := cl.Create(context.Background(), buildClusterExtension(ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + err := cl.Create(context.Background(), buildClusterExtension(ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "package", }, }, Namespace: "default", - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: "default", }, Install: tc.installConfig, @@ -448,8 +448,8 @@ func TestClusterExtensionAdmissionInstall(t *testing.T) { } } -func buildClusterExtension(spec ocv1alpha1.ClusterExtensionSpec) *ocv1alpha1.ClusterExtension { - return &ocv1alpha1.ClusterExtension{ +func buildClusterExtension(spec ocv1.ClusterExtensionSpec) *ocv1.ClusterExtension { + return &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "test-extension-", }, diff --git a/internal/controllers/clusterextension_controller.go b/internal/controllers/clusterextension_controller.go index 717900408..ede0a971c 100644 --- a/internal/controllers/clusterextension_controller.go +++ b/internal/controllers/clusterextension_controller.go @@ -49,7 +49,7 @@ import ( helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client" "github.com/operator-framework/operator-registry/alpha/declcfg" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/bundleutil" "github.com/operator-framework/operator-controller/internal/conditionsets" "github.com/operator-framework/operator-controller/internal/contentmanager" @@ -80,11 +80,11 @@ type Applier interface { // Apply applies the content in the provided fs.FS using the configuration of the provided ClusterExtension. // It also takes in a map[string]string to be applied to all applied resources as labels and another // map[string]string used to create a unique identifier for a stored reference to the resources created. - Apply(context.Context, fs.FS, *ocv1alpha1.ClusterExtension, map[string]string, map[string]string) ([]client.Object, string, error) + Apply(context.Context, fs.FS, *ocv1.ClusterExtension, map[string]string, map[string]string) ([]client.Object, string, error) } type InstalledBundleGetter interface { - GetInstalledBundle(ctx context.Context, ext *ocv1alpha1.ClusterExtension) (*InstalledBundle, error) + GetInstalledBundle(ctx context.Context, ext *ocv1.ClusterExtension) (*InstalledBundle, error) } //+kubebuilder:rbac:groups=olm.operatorframework.io,resources=clusterextensions,verbs=get;list;watch;update;patch @@ -105,7 +105,7 @@ func (r *ClusterExtensionReconciler) Reconcile(ctx context.Context, req ctrl.Req l.Info("reconcile starting") defer l.Info("reconcile ending") - existingExt := &ocv1alpha1.ClusterExtension{} + existingExt := &ocv1.ClusterExtension{} if err := r.Client.Get(ctx, req.NamespacedName, existingExt); err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) } @@ -146,7 +146,7 @@ func (r *ClusterExtensionReconciler) Reconcile(ctx context.Context, req ctrl.Req // ensureAllConditionsWithReason checks that all defined condition types exist in the given ClusterExtension, // and assigns a specified reason and custom message to any missing condition. -func ensureAllConditionsWithReason(ext *ocv1alpha1.ClusterExtension, reason v1alpha1.ConditionReason, message string) { +func ensureAllConditionsWithReason(ext *ocv1.ClusterExtension, reason v1alpha1.ConditionReason, message string) { for _, condType := range conditionsets.ConditionTypes { cond := apimeta.FindStatusCondition(ext.Status.Conditions, condType) if cond == nil { @@ -165,8 +165,8 @@ func ensureAllConditionsWithReason(ext *ocv1alpha1.ClusterExtension, reason v1al } // Compare resources - ignoring status & metadata.finalizers -func checkForUnexpectedFieldChange(a, b ocv1alpha1.ClusterExtension) bool { - a.Status, b.Status = ocv1alpha1.ClusterExtensionStatus{}, ocv1alpha1.ClusterExtensionStatus{} +func checkForUnexpectedFieldChange(a, b ocv1.ClusterExtension) bool { + a.Status, b.Status = ocv1.ClusterExtensionStatus{}, ocv1.ClusterExtensionStatus{} a.Finalizers, b.Finalizers = []string{}, []string{} return !equality.Semantic.DeepEqual(a, b) } @@ -187,7 +187,7 @@ func checkForUnexpectedFieldChange(a, b ocv1alpha1.ClusterExtension) bool { 4.3 Apply the release on cluster. */ //nolint:unparam -func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alpha1.ClusterExtension) (ctrl.Result, error) { +func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1.ClusterExtension) (ctrl.Result, error) { l := log.FromContext(ctx) l.Info("handling finalizers") @@ -213,7 +213,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp // run resolution l.Info("resolving bundle") - var bm *ocv1alpha1.BundleMetadata + var bm *ocv1.BundleMetadata if installedBundle != nil { bm = &installedBundle.BundleMetadata } @@ -222,7 +222,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp // Note: We don't distinguish between resolution-specific errors and generic errors setStatusProgressing(ext, err) setInstalledStatusFromBundle(ext, installedBundle) - ensureAllConditionsWithReason(ext, ocv1alpha1.ReasonFailed, err.Error()) + ensureAllConditionsWithReason(ext, ocv1.ReasonFailed, err.Error()) return ctrl.Result{}, err } @@ -267,7 +267,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp } objLbls := map[string]string{ - labels.OwnerKindKey: ocv1alpha1.ClusterExtensionKind, + labels.OwnerKindKey: ocv1.ClusterExtensionKind, labels.OwnerNameKey: ext.GetName(), } @@ -328,7 +328,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp // SetDeprecationStatus will set the appropriate deprecation statuses for a ClusterExtension // based on the provided bundle -func SetDeprecationStatus(ext *ocv1alpha1.ClusterExtension, bundleName string, deprecation *declcfg.Deprecation) { +func SetDeprecationStatus(ext *ocv1.ClusterExtension, bundleName string, deprecation *declcfg.Deprecation) { deprecations := map[string][]declcfg.DeprecationEntry{} channelSet := sets.New[string]() if ext.Spec.Source.Catalog != nil { @@ -340,16 +340,16 @@ func SetDeprecationStatus(ext *ocv1alpha1.ClusterExtension, bundleName string, d for _, entry := range deprecation.Entries { switch entry.Reference.Schema { case declcfg.SchemaPackage: - deprecations[ocv1alpha1.TypePackageDeprecated] = []declcfg.DeprecationEntry{entry} + deprecations[ocv1.TypePackageDeprecated] = []declcfg.DeprecationEntry{entry} case declcfg.SchemaChannel: if channelSet.Has(entry.Reference.Name) { - deprecations[ocv1alpha1.TypeChannelDeprecated] = append(deprecations[ocv1alpha1.TypeChannelDeprecated], entry) + deprecations[ocv1.TypeChannelDeprecated] = append(deprecations[ocv1.TypeChannelDeprecated], entry) } case declcfg.SchemaBundle: if bundleName != entry.Reference.Name { continue } - deprecations[ocv1alpha1.TypeBundleDeprecated] = []declcfg.DeprecationEntry{entry} + deprecations[ocv1.TypeBundleDeprecated] = []declcfg.DeprecationEntry{entry} } } } @@ -357,9 +357,9 @@ func SetDeprecationStatus(ext *ocv1alpha1.ClusterExtension, bundleName string, d // first get ordered deprecation messages that we'll join in the Deprecated condition message var deprecationMessages []string for _, conditionType := range []string{ - ocv1alpha1.TypePackageDeprecated, - ocv1alpha1.TypeChannelDeprecated, - ocv1alpha1.TypeBundleDeprecated, + ocv1.TypePackageDeprecated, + ocv1.TypeChannelDeprecated, + ocv1.TypeBundleDeprecated, } { if entries, ok := deprecations[conditionType]; ok { for _, entry := range entries { @@ -369,12 +369,12 @@ func SetDeprecationStatus(ext *ocv1alpha1.ClusterExtension, bundleName string, d } // next, set the Deprecated condition - status, reason, message := metav1.ConditionFalse, ocv1alpha1.ReasonDeprecated, "" + status, reason, message := metav1.ConditionFalse, ocv1.ReasonDeprecated, "" if len(deprecationMessages) > 0 { - status, reason, message = metav1.ConditionTrue, ocv1alpha1.ReasonDeprecated, strings.Join(deprecationMessages, ";") + status, reason, message = metav1.ConditionTrue, ocv1.ReasonDeprecated, strings.Join(deprecationMessages, ";") } apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{ - Type: ocv1alpha1.TypeDeprecated, + Type: ocv1.TypeDeprecated, Reason: reason, Status: status, Message: message, @@ -383,14 +383,14 @@ func SetDeprecationStatus(ext *ocv1alpha1.ClusterExtension, bundleName string, d // finally, set the individual deprecation conditions for package, channel, and bundle for _, conditionType := range []string{ - ocv1alpha1.TypePackageDeprecated, - ocv1alpha1.TypeChannelDeprecated, - ocv1alpha1.TypeBundleDeprecated, + ocv1.TypePackageDeprecated, + ocv1.TypeChannelDeprecated, + ocv1.TypeBundleDeprecated, } { entries, ok := deprecations[conditionType] - status, reason, message := metav1.ConditionFalse, ocv1alpha1.ReasonDeprecated, "" + status, reason, message := metav1.ConditionFalse, ocv1.ReasonDeprecated, "" if ok { - status, reason = metav1.ConditionTrue, ocv1alpha1.ReasonDeprecated + status, reason = metav1.ConditionTrue, ocv1.ReasonDeprecated for _, entry := range entries { message = fmt.Sprintf("%s\n%s", message, entry.Message) } @@ -408,7 +408,7 @@ func SetDeprecationStatus(ext *ocv1alpha1.ClusterExtension, bundleName string, d // SetupWithManager sets up the controller with the Manager. func (r *ClusterExtensionReconciler) SetupWithManager(mgr ctrl.Manager) error { controller, err := ctrl.NewControllerManagedBy(mgr). - For(&ocv1alpha1.ClusterExtension{}). + For(&ocv1.ClusterExtension{}). Watches(&catalogd.ClusterCatalog{}, crhandler.EnqueueRequestsFromMapFunc(clusterExtensionRequestsForCatalog(mgr.GetClient(), mgr.GetLogger())), builder.WithPredicates(predicate.Funcs{ @@ -438,7 +438,7 @@ func (r *ClusterExtensionReconciler) SetupWithManager(mgr ctrl.Manager) error { return nil } -func wrapErrorWithResolutionInfo(resolved ocv1alpha1.BundleMetadata, err error) error { +func wrapErrorWithResolutionInfo(resolved ocv1.BundleMetadata, err error) error { return fmt.Errorf("%w for resolved bundle %q with version %q", err, resolved.Name, resolved.Version) } @@ -447,7 +447,7 @@ func clusterExtensionRequestsForCatalog(c client.Reader, logger logr.Logger) crh return func(ctx context.Context, _ client.Object) []reconcile.Request { // no way of associating an extension to a catalog so create reconcile requests for everything clusterExtensions := metav1.PartialObjectMetadataList{} - clusterExtensions.SetGroupVersionKind(ocv1alpha1.GroupVersion.WithKind("ClusterExtensionList")) + clusterExtensions.SetGroupVersionKind(ocv1.GroupVersion.WithKind("ClusterExtensionList")) err := c.List(ctx, &clusterExtensions) if err != nil { logger.Error(err, "unable to enqueue cluster extensions for catalog reconcile") @@ -471,11 +471,11 @@ type DefaultInstalledBundleGetter struct { } type InstalledBundle struct { - ocv1alpha1.BundleMetadata + ocv1.BundleMetadata Image string } -func (d *DefaultInstalledBundleGetter) GetInstalledBundle(ctx context.Context, ext *ocv1alpha1.ClusterExtension) (*InstalledBundle, error) { +func (d *DefaultInstalledBundleGetter) GetInstalledBundle(ctx context.Context, ext *ocv1.ClusterExtension) (*InstalledBundle, error) { cl, err := d.ActionClientFor(ctx, ext) if err != nil { return nil, err @@ -494,7 +494,7 @@ func (d *DefaultInstalledBundleGetter) GetInstalledBundle(ctx context.Context, e for _, rel := range relhis { if rel.Info != nil && rel.Info.Status == release.StatusDeployed { return &InstalledBundle{ - BundleMetadata: ocv1alpha1.BundleMetadata{ + BundleMetadata: ocv1.BundleMetadata{ Name: rel.Labels[labels.BundleNameKey], Version: rel.Labels[labels.BundleVersionKey], }, diff --git a/internal/controllers/clusterextension_controller_test.go b/internal/controllers/clusterextension_controller_test.go index c2b7e9820..ab4dc5e18 100644 --- a/internal/controllers/clusterextension_controller_test.go +++ b/internal/controllers/clusterextension_controller_test.go @@ -27,7 +27,7 @@ import ( helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client" "github.com/operator-framework/operator-registry/alpha/declcfg" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/conditionsets" "github.com/operator-framework/operator-controller/internal/controllers" "github.com/operator-framework/operator-controller/internal/finalizers" @@ -50,7 +50,7 @@ func TestClusterExtensionDoesNotExist(t *testing.T) { func TestClusterExtensionResolutionFails(t *testing.T) { pkgName := fmt.Sprintf("non-existent-%s", rand.String(6)) cl, reconciler := newClientAndReconciler(t) - reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1alpha1.ClusterExtension, _ *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { + reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { return nil, nil, nil, fmt.Errorf("no package %q found", pkgName) }) ctx := context.Background() @@ -58,17 +58,17 @@ func TestClusterExtensionResolutionFails(t *testing.T) { t.Log("When the cluster extension specifies a non-existent package") t.Log("By initializing cluster state") - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkgName, }, }, Namespace: "default", - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: "default", }, }, @@ -88,14 +88,14 @@ func TestClusterExtensionResolutionFails(t *testing.T) { require.Empty(t, clusterExtension.Status.Install) t.Log("By checking the expected conditions") - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) require.NotNil(t, cond) require.Equal(t, metav1.ConditionTrue, cond.Status) - require.Equal(t, ocv1alpha1.ReasonRetrying, cond.Reason) + require.Equal(t, ocv1.ReasonRetrying, cond.Reason) require.Equal(t, fmt.Sprintf("no package %q found", pkgName), cond.Message) verifyInvariants(ctx, t, reconciler.Client, clusterExtension) - require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{})) + require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) } func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) { @@ -132,19 +132,19 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) { namespace := fmt.Sprintf("test-ns-%s", rand.String(8)) serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkgName, Version: pkgVer, Channels: []string{pkgChan}, }, }, Namespace: namespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: serviceAccount, }, }, @@ -154,7 +154,7 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) { t.Log("It sets resolution success status") t.Log("By running reconcile") - reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1alpha1.ClusterExtension, _ *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { + reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { v := bsemver.MustParse("1.0.0") return &declcfg.Bundle{ Name: "prometheus.v1.0.0", @@ -174,23 +174,23 @@ func TestClusterExtensionResolutionSuccessfulUnpackFails(t *testing.T) { require.NoError(t, cl.Get(ctx, extKey, clusterExtension)) t.Log("By checking the status fields") - expectedBundleMetadata := ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"} + expectedBundleMetadata := ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"} require.Empty(t, clusterExtension.Status.Install) t.Log("By checking the expected conditions") expectStatus := metav1.ConditionTrue - expectReason := ocv1alpha1.ReasonRetrying + expectReason := ocv1.ReasonRetrying if tc.expectTerminal { expectStatus = metav1.ConditionFalse - expectReason = ocv1alpha1.ReasonBlocked + expectReason = ocv1.ReasonBlocked } - progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) require.NotNil(t, progressingCond) require.Equal(t, expectStatus, progressingCond.Status) require.Equal(t, expectReason, progressingCond.Reason) require.Contains(t, progressingCond.Message, fmt.Sprintf("for resolved bundle %q with version %q", expectedBundleMetadata.Name, expectedBundleMetadata.Version)) - require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{})) + require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) }) } } @@ -214,19 +214,19 @@ func TestClusterExtensionUnpackUnexpectedState(t *testing.T) { namespace := fmt.Sprintf("test-ns-%s", rand.String(8)) serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkgName, Version: pkgVer, Channels: []string{pkgChan}, }, }, Namespace: namespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: serviceAccount, }, }, @@ -236,7 +236,7 @@ func TestClusterExtensionUnpackUnexpectedState(t *testing.T) { t.Log("It sets resolution success status") t.Log("By running reconcile") - reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1alpha1.ClusterExtension, _ *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { + reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { v := bsemver.MustParse("1.0.0") return &declcfg.Bundle{ Name: "prometheus.v1.0.0", @@ -249,7 +249,7 @@ func TestClusterExtensionUnpackUnexpectedState(t *testing.T) { _, _ = reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: extKey}) }, "reconciliation should panic on unknown unpack state") - require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{})) + require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) } func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T) { @@ -272,19 +272,19 @@ func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T) namespace := fmt.Sprintf("test-ns-%s", rand.String(8)) serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkgName, Version: pkgVer, Channels: []string{pkgChan}, }, }, Namespace: namespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: serviceAccount, }, }, @@ -294,7 +294,7 @@ func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T) t.Log("It sets resolution success status") t.Log("By running reconcile") - reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1alpha1.ClusterExtension, _ *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { + reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { v := bsemver.MustParse("1.0.0") return &declcfg.Bundle{ Name: "prometheus.v1.0.0", @@ -313,23 +313,23 @@ func TestClusterExtensionResolutionAndUnpackSuccessfulApplierFails(t *testing.T) require.NoError(t, cl.Get(ctx, extKey, clusterExtension)) t.Log("By checking the status fields") - expectedBundleMetadata := ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"} + expectedBundleMetadata := ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"} require.Empty(t, clusterExtension.Status.Install) t.Log("By checking the expected installed conditions") - installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) require.NotNil(t, installedCond) require.Equal(t, metav1.ConditionFalse, installedCond.Status) - require.Equal(t, ocv1alpha1.ReasonFailed, installedCond.Reason) + require.Equal(t, ocv1.ReasonFailed, installedCond.Reason) t.Log("By checking the expected progressing conditions") - progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) require.NotNil(t, progressingCond) require.Equal(t, metav1.ConditionTrue, progressingCond.Status) - require.Equal(t, ocv1alpha1.ReasonRetrying, progressingCond.Reason) + require.Equal(t, ocv1.ReasonRetrying, progressingCond.Reason) require.Contains(t, progressingCond.Message, fmt.Sprintf("for resolved bundle %q with version %q", expectedBundleMetadata.Name, expectedBundleMetadata.Version)) - require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{})) + require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) } func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) { @@ -352,19 +352,19 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) { namespace := fmt.Sprintf("test-ns-%s", rand.String(8)) serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkgName, Version: pkgVer, Channels: []string{pkgChan}, }, }, Namespace: namespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: serviceAccount, }, }, @@ -374,7 +374,7 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) { t.Log("It sets resolution success status") t.Log("By running reconcile") - reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1alpha1.ClusterExtension, _ *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { + reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { v := bsemver.MustParse("1.0.0") return &declcfg.Bundle{ Name: "prometheus.v1.0.0", @@ -388,7 +388,7 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) { } reconciler.InstalledBundleGetter = &MockInstalledBundleGetter{ bundle: &controllers.InstalledBundle{ - BundleMetadata: ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, + BundleMetadata: ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, Image: "quay.io/operatorhubio/prometheus@fake1.0.0", }, } @@ -412,23 +412,23 @@ func TestClusterExtensionApplierFailsWithBundleInstalled(t *testing.T) { require.NoError(t, cl.Get(ctx, extKey, clusterExtension)) t.Log("By checking the status fields") - expectedBundleMetadata := ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"} + expectedBundleMetadata := ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"} require.Equal(t, expectedBundleMetadata, clusterExtension.Status.Install.Bundle) t.Log("By checking the expected installed conditions") - installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) require.NotNil(t, installedCond) require.Equal(t, metav1.ConditionTrue, installedCond.Status) - require.Equal(t, ocv1alpha1.ReasonSucceeded, installedCond.Reason) + require.Equal(t, ocv1.ReasonSucceeded, installedCond.Reason) t.Log("By checking the expected progressing conditions") - progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) require.NotNil(t, progressingCond) require.Equal(t, metav1.ConditionTrue, progressingCond.Status) - require.Equal(t, ocv1alpha1.ReasonRetrying, progressingCond.Reason) + require.Equal(t, ocv1.ReasonRetrying, progressingCond.Reason) require.Contains(t, progressingCond.Message, fmt.Sprintf("for resolved bundle %q with version %q", expectedBundleMetadata.Name, expectedBundleMetadata.Version)) - require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{})) + require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) } func TestClusterExtensionManagerFailed(t *testing.T) { @@ -451,19 +451,19 @@ func TestClusterExtensionManagerFailed(t *testing.T) { namespace := fmt.Sprintf("test-ns-%s", rand.String(8)) serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkgName, Version: pkgVer, Channels: []string{pkgChan}, }, }, Namespace: namespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: serviceAccount, }, }, @@ -473,7 +473,7 @@ func TestClusterExtensionManagerFailed(t *testing.T) { t.Log("It sets resolution success status") t.Log("By running reconcile") - reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1alpha1.ClusterExtension, _ *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { + reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { v := bsemver.MustParse("1.0.0") return &declcfg.Bundle{ Name: "prometheus.v1.0.0", @@ -495,21 +495,21 @@ func TestClusterExtensionManagerFailed(t *testing.T) { require.NoError(t, cl.Get(ctx, extKey, clusterExtension)) t.Log("By checking the status fields") - require.Equal(t, ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle) + require.Equal(t, ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle) t.Log("By checking the expected installed conditions") - installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) require.NotNil(t, installedCond) require.Equal(t, metav1.ConditionTrue, installedCond.Status) - require.Equal(t, ocv1alpha1.ReasonSucceeded, installedCond.Reason) + require.Equal(t, ocv1.ReasonSucceeded, installedCond.Reason) t.Log("By checking the expected progressing conditions") - progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) require.NotNil(t, progressingCond) require.Equal(t, metav1.ConditionTrue, progressingCond.Status) - require.Equal(t, ocv1alpha1.ReasonRetrying, progressingCond.Reason) + require.Equal(t, ocv1.ReasonRetrying, progressingCond.Reason) - require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{})) + require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) } func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) { @@ -532,20 +532,20 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) { installNamespace := fmt.Sprintf("test-ns-%s", rand.String(8)) serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ - SourceType: ocv1alpha1.SourceTypeCatalog, + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ + SourceType: ocv1.SourceTypeCatalog, - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkgName, Version: pkgVer, Channels: []string{pkgChan}, }, }, Namespace: installNamespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: serviceAccount, }, }, @@ -555,7 +555,7 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) { t.Log("It sets resolution success status") t.Log("By running reconcile") - reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1alpha1.ClusterExtension, _ *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { + reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { v := bsemver.MustParse("1.0.0") return &declcfg.Bundle{ Name: "prometheus.v1.0.0", @@ -579,21 +579,21 @@ func TestClusterExtensionManagedContentCacheWatchFail(t *testing.T) { require.NoError(t, cl.Get(ctx, extKey, clusterExtension)) t.Log("By checking the status fields") - require.Equal(t, ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle) + require.Equal(t, ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle) t.Log("By checking the expected installed conditions") - installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) require.NotNil(t, installedCond) require.Equal(t, metav1.ConditionTrue, installedCond.Status) - require.Equal(t, ocv1alpha1.ReasonSucceeded, installedCond.Reason) + require.Equal(t, ocv1.ReasonSucceeded, installedCond.Reason) t.Log("By checking the expected progressing conditions") - progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) require.NotNil(t, progressingCond) require.Equal(t, metav1.ConditionTrue, progressingCond.Status) - require.Equal(t, ocv1alpha1.ReasonRetrying, progressingCond.Reason) + require.Equal(t, ocv1.ReasonRetrying, progressingCond.Reason) - require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{})) + require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) } func TestClusterExtensionInstallationSucceeds(t *testing.T) { @@ -616,19 +616,19 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) { namespace := fmt.Sprintf("test-ns-%s", rand.String(8)) serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkgName, Version: pkgVer, Channels: []string{pkgChan}, }, }, Namespace: namespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: serviceAccount, }, }, @@ -638,7 +638,7 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) { t.Log("It sets resolution success status") t.Log("By running reconcile") - reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1alpha1.ClusterExtension, _ *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { + reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { v := bsemver.MustParse("1.0.0") return &declcfg.Bundle{ Name: "prometheus.v1.0.0", @@ -660,21 +660,21 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) { require.NoError(t, cl.Get(ctx, extKey, clusterExtension)) t.Log("By checking the status fields") - require.Equal(t, ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle) + require.Equal(t, ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle) t.Log("By checking the expected installed conditions") - installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) require.NotNil(t, installedCond) require.Equal(t, metav1.ConditionTrue, installedCond.Status) - require.Equal(t, ocv1alpha1.ReasonSucceeded, installedCond.Reason) + require.Equal(t, ocv1.ReasonSucceeded, installedCond.Reason) t.Log("By checking the expected progressing conditions") - progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) require.NotNil(t, progressingCond) require.Equal(t, metav1.ConditionTrue, progressingCond.Status) - require.Equal(t, ocv1alpha1.ReasonSucceeded, progressingCond.Reason) + require.Equal(t, ocv1.ReasonSucceeded, progressingCond.Reason) - require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{})) + require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) } func TestClusterExtensionDeleteFinalizerFails(t *testing.T) { @@ -697,19 +697,19 @@ func TestClusterExtensionDeleteFinalizerFails(t *testing.T) { namespace := fmt.Sprintf("test-ns-%s", rand.String(8)) serviceAccount := fmt.Sprintf("test-sa-%s", rand.String(8)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkgName, Version: pkgVer, Channels: []string{pkgChan}, }, }, Namespace: namespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: serviceAccount, }, }, @@ -718,7 +718,7 @@ func TestClusterExtensionDeleteFinalizerFails(t *testing.T) { require.NoError(t, err) t.Log("It sets resolution success status") t.Log("By running reconcile") - reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1alpha1.ClusterExtension, _ *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { + reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { v := bsemver.MustParse("1.0.0") return &declcfg.Bundle{ Name: "prometheus.v1.0.0", @@ -736,7 +736,7 @@ func TestClusterExtensionDeleteFinalizerFails(t *testing.T) { } reconciler.InstalledBundleGetter = &MockInstalledBundleGetter{ bundle: &controllers.InstalledBundle{ - BundleMetadata: ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, + BundleMetadata: ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, Image: "quay.io/operatorhubio/prometheus@fake1.0.0", }, } @@ -756,37 +756,37 @@ func TestClusterExtensionDeleteFinalizerFails(t *testing.T) { t.Log("By fetching updated cluster extension after first reconcile") require.NoError(t, cl.Get(ctx, extKey, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) - expectedBundleMetadata := ocv1alpha1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"} + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) + expectedBundleMetadata := ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"} require.Equal(t, expectedBundleMetadata, clusterExtension.Status.Install.Bundle) require.NotNil(t, cond) require.Equal(t, metav1.ConditionTrue, cond.Status) - require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{})) + require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) res, err = reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: extKey}) require.Error(t, err, res) t.Log("By fetching updated cluster extension after second reconcile") require.NoError(t, cl.Get(ctx, extKey, clusterExtension)) - cond = apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + cond = apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) require.Equal(t, expectedBundleMetadata, clusterExtension.Status.Install.Bundle) require.NotNil(t, cond) require.Equal(t, metav1.ConditionTrue, cond.Status) require.Equal(t, fakeFinalizer, clusterExtension.Finalizers[0]) - cond = apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond = apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) require.NotNil(t, cond) require.Equal(t, metav1.ConditionTrue, cond.Status) require.Contains(t, cond.Message, finalizersMessage) } -func verifyInvariants(ctx context.Context, t *testing.T, c client.Client, ext *ocv1alpha1.ClusterExtension) { +func verifyInvariants(ctx context.Context, t *testing.T, c client.Client, ext *ocv1.ClusterExtension) { key := client.ObjectKeyFromObject(ext) require.NoError(t, c.Get(ctx, key, ext)) verifyConditionsInvariants(t, ext) } -func verifyConditionsInvariants(t *testing.T, ext *ocv1alpha1.ClusterExtension) { +func verifyConditionsInvariants(t *testing.T, ext *ocv1.ClusterExtension) { // Expect that the cluster extension's set of conditions contains all defined // condition types for the ClusterExtension API. Every reconcile should always // ensure every condition type's status/reason/message reflects the state @@ -804,48 +804,48 @@ func verifyConditionsInvariants(t *testing.T, ext *ocv1alpha1.ClusterExtension) func TestSetDeprecationStatus(t *testing.T) { for _, tc := range []struct { name string - clusterExtension *ocv1alpha1.ClusterExtension - expectedClusterExtension *ocv1alpha1.ClusterExtension + clusterExtension *ocv1.ClusterExtension + expectedClusterExtension *ocv1.ClusterExtension bundle *declcfg.Bundle deprecation *declcfg.Deprecation }{ { name: "no deprecations, all deprecation statuses set to False", - clusterExtension: &ocv1alpha1.ClusterExtension{ + clusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{}, }, }, - expectedClusterExtension: &ocv1alpha1.ClusterExtension{ + expectedClusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{ { - Type: ocv1alpha1.TypeDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypePackageDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypePackageDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeChannelDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeChannelDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeBundleDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeBundleDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, @@ -857,53 +857,53 @@ func TestSetDeprecationStatus(t *testing.T) { }, { name: "deprecated channel, but no channel specified, all deprecation statuses set to False", - clusterExtension: &ocv1alpha1.ClusterExtension{ + clusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{}, + Catalog: &ocv1.CatalogSource{}, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{}, }, }, - expectedClusterExtension: &ocv1alpha1.ClusterExtension{ + expectedClusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{}, + Catalog: &ocv1.CatalogSource{}, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{ { - Type: ocv1alpha1.TypeDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypePackageDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypePackageDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeChannelDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeChannelDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeBundleDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeBundleDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, @@ -922,57 +922,57 @@ func TestSetDeprecationStatus(t *testing.T) { }, { name: "deprecated channel, but a non-deprecated channel specified, all deprecation statuses set to False", - clusterExtension: &ocv1alpha1.ClusterExtension{ + clusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"nondeprecated"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{}, }, }, - expectedClusterExtension: &ocv1alpha1.ClusterExtension{ + expectedClusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"nondeprecated"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{ { - Type: ocv1alpha1.TypeDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypePackageDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypePackageDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeChannelDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeChannelDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeBundleDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeBundleDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, @@ -993,57 +993,57 @@ func TestSetDeprecationStatus(t *testing.T) { }, { name: "deprecated channel specified, ChannelDeprecated and Deprecated status set to true, others set to false", - clusterExtension: &ocv1alpha1.ClusterExtension{ + clusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{}, }, }, - expectedClusterExtension: &ocv1alpha1.ClusterExtension{ + expectedClusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{ { - Type: ocv1alpha1.TypeDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypePackageDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypePackageDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeChannelDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeChannelDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeBundleDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeBundleDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, @@ -1065,57 +1065,57 @@ func TestSetDeprecationStatus(t *testing.T) { }, { name: "deprecated package and channel specified, deprecated bundle, all deprecation statuses set to true", - clusterExtension: &ocv1alpha1.ClusterExtension{ + clusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{}, }, }, - expectedClusterExtension: &ocv1alpha1.ClusterExtension{ + expectedClusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{ { - Type: ocv1alpha1.TypeDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypePackageDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypePackageDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeChannelDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeChannelDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeBundleDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeBundleDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, @@ -1150,57 +1150,57 @@ func TestSetDeprecationStatus(t *testing.T) { }, { name: "deprecated channel specified, deprecated bundle, all deprecation statuses set to true, all deprecation statuses set to true except PackageDeprecated", - clusterExtension: &ocv1alpha1.ClusterExtension{ + clusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{}, }, }, - expectedClusterExtension: &ocv1alpha1.ClusterExtension{ + expectedClusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{ { - Type: ocv1alpha1.TypeDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypePackageDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypePackageDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeChannelDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeChannelDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeBundleDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeBundleDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, @@ -1229,57 +1229,57 @@ func TestSetDeprecationStatus(t *testing.T) { }, { name: "deprecated package and channel specified, all deprecation statuses set to true except BundleDeprecated", - clusterExtension: &ocv1alpha1.ClusterExtension{ + clusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{}, }, }, - expectedClusterExtension: &ocv1alpha1.ClusterExtension{ + expectedClusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{ { - Type: ocv1alpha1.TypeDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypePackageDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypePackageDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeChannelDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeChannelDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeBundleDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeBundleDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, @@ -1307,57 +1307,57 @@ func TestSetDeprecationStatus(t *testing.T) { }, { name: "deprecated channels specified, ChannelDeprecated and Deprecated status set to true, others set to false", - clusterExtension: &ocv1alpha1.ClusterExtension{ + clusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel", "anotherbadchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{}, }, }, - expectedClusterExtension: &ocv1alpha1.ClusterExtension{ + expectedClusterExtension: &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Generation: 1, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ Channels: []string{"badchannel", "anotherbadchannel"}, }, }, }, - Status: ocv1alpha1.ClusterExtensionStatus{ + Status: ocv1.ClusterExtensionStatus{ Conditions: []metav1.Condition{ { - Type: ocv1alpha1.TypeDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypePackageDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypePackageDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeChannelDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeChannelDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionTrue, ObservedGeneration: 1, }, { - Type: ocv1alpha1.TypeBundleDeprecated, - Reason: ocv1alpha1.ReasonDeprecated, + Type: ocv1.TypeBundleDeprecated, + Reason: ocv1.ReasonDeprecated, Status: metav1.ConditionFalse, ObservedGeneration: 1, }, @@ -1434,7 +1434,7 @@ func (mag *MockActionGetter) Reconcile(rel *release.Release) error { func TestGetInstalledBundleHistory(t *testing.T) { getter := controllers.DefaultInstalledBundleGetter{} - ext := ocv1alpha1.ClusterExtension{ + ext := ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Name: "test-ext", }, @@ -1473,7 +1473,7 @@ func TestGetInstalledBundleHistory(t *testing.T) { }, nil, &controllers.InstalledBundle{ - BundleMetadata: ocv1alpha1.BundleMetadata{ + BundleMetadata: ocv1.BundleMetadata{ Name: "test-ext", Version: "1.0", }, @@ -1508,7 +1508,7 @@ func TestGetInstalledBundleHistory(t *testing.T) { }, nil, &controllers.InstalledBundle{ - BundleMetadata: ocv1alpha1.BundleMetadata{ + BundleMetadata: ocv1.BundleMetadata{ Name: "test-ext", Version: "1.0", }, diff --git a/internal/controllers/common_controller.go b/internal/controllers/common_controller.go index f320052df..7cee10c10 100644 --- a/internal/controllers/common_controller.go +++ b/internal/controllers/common_controller.go @@ -24,11 +24,11 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/reconcile" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) // setInstalledStatusFromBundle sets the installed status based on the given installedBundle. -func setInstalledStatusFromBundle(ext *ocv1alpha1.ClusterExtension, installedBundle *InstalledBundle) { +func setInstalledStatusFromBundle(ext *ocv1.ClusterExtension, installedBundle *InstalledBundle) { // Nothing is installed if installedBundle == nil { setInstallStatus(ext, nil) @@ -36,7 +36,7 @@ func setInstalledStatusFromBundle(ext *ocv1alpha1.ClusterExtension, installedBun return } // Something is installed - installStatus := &ocv1alpha1.ClusterExtensionInstallStatus{ + installStatus := &ocv1.ClusterExtensionInstallStatus{ Bundle: installedBundle.BundleMetadata, } setInstallStatus(ext, installStatus) @@ -44,59 +44,59 @@ func setInstalledStatusFromBundle(ext *ocv1alpha1.ClusterExtension, installedBun } // setInstalledStatusConditionSuccess sets the installed status condition to success. -func setInstalledStatusConditionSuccess(ext *ocv1alpha1.ClusterExtension, message string) { +func setInstalledStatusConditionSuccess(ext *ocv1.ClusterExtension, message string) { apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{ - Type: ocv1alpha1.TypeInstalled, + Type: ocv1.TypeInstalled, Status: metav1.ConditionTrue, - Reason: ocv1alpha1.ReasonSucceeded, + Reason: ocv1.ReasonSucceeded, Message: message, ObservedGeneration: ext.GetGeneration(), }) } // setInstalledStatusConditionFailed sets the installed status condition to failed. -func setInstalledStatusConditionFailed(ext *ocv1alpha1.ClusterExtension, message string) { +func setInstalledStatusConditionFailed(ext *ocv1.ClusterExtension, message string) { apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{ - Type: ocv1alpha1.TypeInstalled, + Type: ocv1.TypeInstalled, Status: metav1.ConditionFalse, - Reason: ocv1alpha1.ReasonFailed, + Reason: ocv1.ReasonFailed, Message: message, ObservedGeneration: ext.GetGeneration(), }) } // setInstalledStatusConditionUnknown sets the installed status condition to unknown. -func setInstalledStatusConditionUnknown(ext *ocv1alpha1.ClusterExtension, message string) { +func setInstalledStatusConditionUnknown(ext *ocv1.ClusterExtension, message string) { apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{ - Type: ocv1alpha1.TypeInstalled, + Type: ocv1.TypeInstalled, Status: metav1.ConditionUnknown, - Reason: ocv1alpha1.ReasonFailed, + Reason: ocv1.ReasonFailed, Message: message, ObservedGeneration: ext.GetGeneration(), }) } -func setInstallStatus(ext *ocv1alpha1.ClusterExtension, installStatus *ocv1alpha1.ClusterExtensionInstallStatus) { +func setInstallStatus(ext *ocv1.ClusterExtension, installStatus *ocv1.ClusterExtensionInstallStatus) { ext.Status.Install = installStatus } -func setStatusProgressing(ext *ocv1alpha1.ClusterExtension, err error) { +func setStatusProgressing(ext *ocv1.ClusterExtension, err error) { progressingCond := metav1.Condition{ - Type: ocv1alpha1.TypeProgressing, + Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, - Reason: ocv1alpha1.ReasonSucceeded, + Reason: ocv1.ReasonSucceeded, Message: "desired state reached", ObservedGeneration: ext.GetGeneration(), } if err != nil { - progressingCond.Reason = ocv1alpha1.ReasonRetrying + progressingCond.Reason = ocv1.ReasonRetrying progressingCond.Message = err.Error() } if errors.Is(err, reconcile.TerminalError(nil)) { progressingCond.Status = metav1.ConditionFalse - progressingCond.Reason = ocv1alpha1.ReasonBlocked + progressingCond.Reason = ocv1.ReasonBlocked } apimeta.SetStatusCondition(&ext.Status.Conditions, progressingCond) diff --git a/internal/controllers/common_controller_test.go b/internal/controllers/common_controller_test.go index fefd2f682..7b644172d 100644 --- a/internal/controllers/common_controller_test.go +++ b/internal/controllers/common_controller_test.go @@ -11,53 +11,53 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/reconcile" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) func TestSetStatusProgressing(t *testing.T) { for _, tc := range []struct { name string err error - clusterExtension *ocv1alpha1.ClusterExtension + clusterExtension *ocv1.ClusterExtension expected metav1.Condition }{ { name: "non-nil ClusterExtension, nil error, Progressing condition has status True with reason Success", err: nil, - clusterExtension: &ocv1alpha1.ClusterExtension{}, + clusterExtension: &ocv1.ClusterExtension{}, expected: metav1.Condition{ - Type: ocv1alpha1.TypeProgressing, + Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, - Reason: ocv1alpha1.ReasonSucceeded, + Reason: ocv1.ReasonSucceeded, Message: "desired state reached", }, }, { name: "non-nil ClusterExtension, non-terminal error, Progressing condition has status True with reason Retrying", err: errors.New("boom"), - clusterExtension: &ocv1alpha1.ClusterExtension{}, + clusterExtension: &ocv1.ClusterExtension{}, expected: metav1.Condition{ - Type: ocv1alpha1.TypeProgressing, + Type: ocv1.TypeProgressing, Status: metav1.ConditionTrue, - Reason: ocv1alpha1.ReasonRetrying, + Reason: ocv1.ReasonRetrying, Message: "boom", }, }, { name: "non-nil ClusterExtension, terminal error, Progressing condition has status False with reason Blocked", err: reconcile.TerminalError(errors.New("boom")), - clusterExtension: &ocv1alpha1.ClusterExtension{}, + clusterExtension: &ocv1.ClusterExtension{}, expected: metav1.Condition{ - Type: ocv1alpha1.TypeProgressing, + Type: ocv1.TypeProgressing, Status: metav1.ConditionFalse, - Reason: ocv1alpha1.ReasonBlocked, + Reason: ocv1.ReasonBlocked, Message: "terminal error: boom", }, }, } { t.Run(tc.name, func(t *testing.T) { setStatusProgressing(tc.clusterExtension, tc.err) - progressingCond := meta.FindStatusCondition(tc.clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + progressingCond := meta.FindStatusCondition(tc.clusterExtension.Status.Conditions, ocv1.TypeProgressing) require.NotNil(t, progressingCond, "progressing condition should be set but was not") diff := cmp.Diff(*progressingCond, tc.expected, cmpopts.IgnoreFields(metav1.Condition{}, "LastTransitionTime", "ObservedGeneration")) require.Empty(t, diff, "difference between actual and expected Progressing conditions") diff --git a/internal/controllers/suite_test.go b/internal/controllers/suite_test.go index 4ceae3a19..52fd8900a 100644 --- a/internal/controllers/suite_test.go +++ b/internal/controllers/suite_test.go @@ -35,7 +35,7 @@ import ( helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/contentmanager" cmcache "github.com/operator-framework/operator-controller/internal/contentmanager/cache" "github.com/operator-framework/operator-controller/internal/controllers" @@ -65,7 +65,7 @@ func newClient(t *testing.T) client.Client { // TODO: this is a live client, which behaves differently than a cache client. // We may want to use a caching client instead to get closer to real behavior. sch := runtime.NewScheme() - require.NoError(t, ocv1alpha1.AddToScheme(sch)) + require.NoError(t, ocv1.AddToScheme(sch)) cl, err := client.New(config, client.Options{Scheme: sch}) require.NoError(t, err) require.NotNil(t, cl) @@ -80,7 +80,7 @@ func (m *MockInstalledBundleGetter) SetBundle(bundle *controllers.InstalledBundl m.bundle = bundle } -func (m *MockInstalledBundleGetter) GetInstalledBundle(ctx context.Context, ext *ocv1alpha1.ClusterExtension) (*controllers.InstalledBundle, error) { +func (m *MockInstalledBundleGetter) GetInstalledBundle(ctx context.Context, ext *ocv1.ClusterExtension) (*controllers.InstalledBundle, error) { return m.bundle, nil } @@ -92,7 +92,7 @@ type MockApplier struct { state string } -func (m *MockApplier) Apply(_ context.Context, _ fs.FS, _ *ocv1alpha1.ClusterExtension, _ map[string]string, _ map[string]string) ([]client.Object, string, error) { +func (m *MockApplier) Apply(_ context.Context, _ fs.FS, _ *ocv1.ClusterExtension, _ map[string]string, _ map[string]string) ([]client.Object, string, error) { if m.err != nil { return nil, m.state, m.err } @@ -107,14 +107,14 @@ type MockManagedContentCacheManager struct { cache cmcache.Cache } -func (m *MockManagedContentCacheManager) Get(_ context.Context, _ *ocv1alpha1.ClusterExtension) (cmcache.Cache, error) { +func (m *MockManagedContentCacheManager) Get(_ context.Context, _ *ocv1.ClusterExtension) (cmcache.Cache, error) { if m.err != nil { return nil, m.err } return m.cache, nil } -func (m *MockManagedContentCacheManager) Delete(_ *ocv1alpha1.ClusterExtension) error { +func (m *MockManagedContentCacheManager) Delete(_ *ocv1.ClusterExtension) error { return m.err } diff --git a/internal/resolve/catalog.go b/internal/resolve/catalog.go index 8d2efc07c..859771055 100644 --- a/internal/resolve/catalog.go +++ b/internal/resolve/catalog.go @@ -18,7 +18,7 @@ import ( catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" "github.com/operator-framework/operator-registry/alpha/declcfg" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/bundleutil" "github.com/operator-framework/operator-controller/internal/catalogmetadata/compare" "github.com/operator-framework/operator-controller/internal/catalogmetadata/filter" @@ -38,7 +38,7 @@ type foundBundle struct { } // Resolve returns a Bundle from a catalog that needs to get installed on the cluster. -func (r *CatalogResolver) Resolve(ctx context.Context, ext *ocv1alpha1.ClusterExtension, installedBundle *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { +func (r *CatalogResolver) Resolve(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { packageName := ext.Spec.Source.Catalog.PackageName versionRange := ext.Spec.Source.Catalog.Version channels := ext.Spec.Source.Catalog.Channels @@ -89,7 +89,7 @@ func (r *CatalogResolver) Resolve(ctx context.Context, ext *ocv1alpha1.ClusterEx predicates = append(predicates, filter.InMastermindsSemverRange(versionRangeConstraints)) } - if ext.Spec.Source.Catalog.UpgradeConstraintPolicy != ocv1alpha1.UpgradeConstraintPolicySelfCertified && installedBundle != nil { + if ext.Spec.Source.Catalog.UpgradeConstraintPolicy != ocv1.UpgradeConstraintPolicySelfCertified && installedBundle != nil { successorPredicate, err := filter.SuccessorsOf(*installedBundle, packageFBC.Channels...) if err != nil { return fmt.Errorf("error finding upgrade edges: %w", err) @@ -187,7 +187,7 @@ type resolutionError struct { PackageName string Version string Channels []string - InstalledBundle *ocv1alpha1.BundleMetadata + InstalledBundle *ocv1.BundleMetadata ResolvedBundles []foundBundle } diff --git a/internal/resolve/catalog_test.go b/internal/resolve/catalog_test.go index 4a5a4d0e3..b59733e70 100644 --- a/internal/resolve/catalog_test.go +++ b/internal/resolve/catalog_test.go @@ -20,14 +20,14 @@ import ( "github.com/operator-framework/operator-registry/alpha/declcfg" "github.com/operator-framework/operator-registry/alpha/property" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/features" ) func TestInvalidClusterExtensionVersionRange(t *testing.T) { r := CatalogResolver{} pkgName := randPkg() - ce := buildFooClusterExtension(pkgName, []string{}, "foobar", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "foobar", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) assert.EqualError(t, err, `desired version range "foobar" is invalid: improper constraint: foobar`) } @@ -37,7 +37,7 @@ func TestErrorWalkingCatalogs(t *testing.T) { return fmt.Errorf("fake error") }} pkgName := randPkg() - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) assert.EqualError(t, err, "error walking catalogs: fake error") } @@ -50,7 +50,7 @@ func TestErrorGettingPackage(t *testing.T) { } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} pkgName := randPkg() - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) assert.EqualError(t, err, fmt.Sprintf(`error walking catalogs: error getting package %q from catalog "a": fake error`, pkgName)) } @@ -69,7 +69,7 @@ func TestPackageDoesNotExist(t *testing.T) { } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} pkgName := randPkg() - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) assert.EqualError(t, err, fmt.Sprintf(`no bundles found for package %q`, pkgName)) } @@ -88,7 +88,7 @@ func TestPackageExists(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) assert.Equal(t, genBundle(pkgName, "3.0.0"), *gotBundle) @@ -117,7 +117,7 @@ func TestValidationFailed(t *testing.T) { }, }, } - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) require.Error(t, err) } @@ -136,7 +136,7 @@ func TestVersionDoesNotExist(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "4.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "4.0.0", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) assert.EqualError(t, err, fmt.Sprintf(`no bundles found for package %q matching version "4.0.0"`, pkgName)) } @@ -155,7 +155,7 @@ func TestVersionExists(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <2.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <2.0.0", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) assert.Equal(t, genBundle(pkgName, "1.0.2"), *gotBundle) @@ -177,7 +177,7 @@ func TestChannelDoesNotExist(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{"stable"}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{"stable"}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) assert.EqualError(t, err, fmt.Sprintf(`no bundles found for package %q in channels [stable]`, pkgName)) } @@ -196,7 +196,7 @@ func TestChannelExists(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{"beta"}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{"beta"}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) assert.Equal(t, genBundle(pkgName, "1.0.2"), *gotBundle) @@ -218,7 +218,7 @@ func TestChannelExistsButNotVersion(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{"beta"}, "3.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{"beta"}, "3.0.0", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) assert.EqualError(t, err, fmt.Sprintf(`no bundles found for package %q matching version "3.0.0" in channels [beta]`, pkgName)) } @@ -237,7 +237,7 @@ func TestVersionExistsButNotChannel(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{"stable"}, "1.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{"stable"}, "1.0.0", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) assert.EqualError(t, err, fmt.Sprintf(`no bundles found for package %q matching version "1.0.0" in channels [stable]`, pkgName)) } @@ -256,7 +256,7 @@ func TestChannelAndVersionExist(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{"alpha"}, "0.1.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{"alpha"}, "0.1.0", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) assert.Equal(t, genBundle(pkgName, "0.1.0"), *gotBundle) @@ -278,7 +278,7 @@ func TestPreferNonDeprecated(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, ">=0.1.0 <=1.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=0.1.0 <=1.0.0", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) assert.Equal(t, genBundle(pkgName, "0.1.0"), *gotBundle) @@ -300,7 +300,7 @@ func TestAcceptDeprecated(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.1", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.1", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) assert.Equal(t, genBundle(pkgName, "1.0.1"), *gotBundle) @@ -383,7 +383,7 @@ func TestPackageVariationsBetweenCatalogs(t *testing.T) { r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} t.Run("when bundle candidates for a package are deprecated in all but one catalog", func(t *testing.T) { - ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.3", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.3", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) // We choose the only non-deprecated package @@ -393,7 +393,7 @@ func TestPackageVariationsBetweenCatalogs(t *testing.T) { }) t.Run("when bundle candidates are found and deprecated in multiple catalogs", func(t *testing.T) { - ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.1", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.1", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.Error(t, err) // We will not make a decision on which catalog to use @@ -404,7 +404,7 @@ func TestPackageVariationsBetweenCatalogs(t *testing.T) { }) t.Run("when bundle candidates are found and not deprecated in multiple catalogs", func(t *testing.T) { - ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.4", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.4", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.Error(t, err) // We will not make a decision on which catalog to use @@ -415,7 +415,7 @@ func TestPackageVariationsBetweenCatalogs(t *testing.T) { }) t.Run("highest semver bundle is chosen when candidates are all from the same catalog", func(t *testing.T) { - ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.4 <=1.0.5", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.4 <=1.0.5", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) // Bundles within one catalog for a package will be sorted by semver and deprecation and the best is returned @@ -440,8 +440,8 @@ func TestUpgradeFoundLegacy(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) - installedBundle := &ocv1alpha1.BundleMetadata{ + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) + installedBundle := &ocv1.BundleMetadata{ Name: bundleName(pkgName, "0.1.0"), Version: "0.1.0", } @@ -468,8 +468,8 @@ func TestUpgradeNotFoundLegacy(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "<1.0.0 >=2.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) - installedBundle := &ocv1alpha1.BundleMetadata{ + ce := buildFooClusterExtension(pkgName, []string{}, "<1.0.0 >=2.0.0", ocv1.UpgradeConstraintPolicyCatalogProvided) + installedBundle := &ocv1.BundleMetadata{ Name: bundleName(pkgName, "0.1.0"), Version: "0.1.0", } @@ -493,8 +493,8 @@ func TestUpgradeFoundSemver(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) - installedBundle := &ocv1alpha1.BundleMetadata{ + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) + installedBundle := &ocv1.BundleMetadata{ Name: bundleName(pkgName, "1.0.0"), Version: "1.0.0", } @@ -523,8 +523,8 @@ func TestUpgradeNotFoundSemver(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "!=0.1.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) - installedBundle := &ocv1alpha1.BundleMetadata{ + ce := buildFooClusterExtension(pkgName, []string{}, "!=0.1.0", ocv1.UpgradeConstraintPolicyCatalogProvided) + installedBundle := &ocv1.BundleMetadata{ Name: bundleName(pkgName, "0.1.0"), Version: "0.1.0", } @@ -548,8 +548,8 @@ func TestDowngradeFound(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "<1.0.2", ocv1alpha1.UpgradeConstraintPolicySelfCertified) - installedBundle := &ocv1alpha1.BundleMetadata{ + ce := buildFooClusterExtension(pkgName, []string{}, "<1.0.2", ocv1.UpgradeConstraintPolicySelfCertified) + installedBundle := &ocv1.BundleMetadata{ Name: bundleName(pkgName, "1.0.2"), Version: "1.0.2", } @@ -576,8 +576,8 @@ func TestDowngradeNotFound(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, ">0.1.0 <1.0.0", ocv1alpha1.UpgradeConstraintPolicySelfCertified) - installedBundle := &ocv1alpha1.BundleMetadata{ + ce := buildFooClusterExtension(pkgName, []string{}, ">0.1.0 <1.0.0", ocv1.UpgradeConstraintPolicySelfCertified) + installedBundle := &ocv1.BundleMetadata{ Name: bundleName(pkgName, "1.0.2"), Version: "1.0.2", } @@ -640,17 +640,17 @@ func TestCatalogWalker(t *testing.T) { }) } -func buildFooClusterExtension(pkg string, channels []string, version string, upgradeConstraintPolicy ocv1alpha1.UpgradeConstraintPolicy) *ocv1alpha1.ClusterExtension { - return &ocv1alpha1.ClusterExtension{ +func buildFooClusterExtension(pkg string, channels []string, version string, upgradeConstraintPolicy ocv1.UpgradeConstraintPolicy) *ocv1.ClusterExtension { + return &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Name: pkg, }, - Spec: ocv1alpha1.ClusterExtensionSpec{ + Spec: ocv1.ClusterExtensionSpec{ Namespace: "default", - ServiceAccount: ocv1alpha1.ServiceAccountReference{Name: "default"}, - Source: ocv1alpha1.SourceConfig{ + ServiceAccount: ocv1.ServiceAccountReference{Name: "default"}, + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: pkg, Version: version, Channels: channels, @@ -760,13 +760,13 @@ func genPackage(pkg string) *declcfg.DeclarativeConfig { func TestInvalidClusterExtensionCatalogMatchExpressions(t *testing.T) { r := CatalogResolver{} - ce := &ocv1alpha1.ClusterExtension{ + ce := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ - Catalog: &ocv1alpha1.CatalogSource{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ + Catalog: &ocv1.CatalogSource{ PackageName: "foo", Selector: &metav1.LabelSelector{ MatchExpressions: []metav1.LabelSelectorRequirement{ @@ -792,13 +792,13 @@ func TestInvalidClusterExtensionCatalogMatchLabelsName(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := &ocv1alpha1.ClusterExtension{ + ce := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ - Catalog: &ocv1alpha1.CatalogSource{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ + Catalog: &ocv1.CatalogSource{ PackageName: "foo", Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{"": "value"}, @@ -818,13 +818,13 @@ func TestInvalidClusterExtensionCatalogMatchLabelsValue(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := &ocv1alpha1.ClusterExtension{ + ce := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ - Catalog: &ocv1alpha1.CatalogSource{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ + Catalog: &ocv1.CatalogSource{ PackageName: "foo", Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{"name": "&value"}, @@ -849,7 +849,7 @@ func TestClusterExtensionMatchLabel(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) ce.Spec.Source.Catalog.Selector = &metav1.LabelSelector{ MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": "b"}, } @@ -870,7 +870,7 @@ func TestClusterExtensionNoMatchLabel(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) ce.Spec.Source.Catalog.Selector = &metav1.LabelSelector{ MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": "a"}, } @@ -914,7 +914,7 @@ func TestUnequalPriority(t *testing.T) { } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) _, gotVersion, _, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) require.Equal(t, bsemver.MustParse("1.0.0"), *gotVersion) @@ -935,7 +935,7 @@ func TestMultiplePriority(t *testing.T) { } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.1", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0 <=1.0.1", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.Error(t, err) require.ErrorContains(t, err, "in multiple catalogs with the same priority [a b c]") @@ -958,7 +958,7 @@ func TestMultipleChannels(t *testing.T) { }, } r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs} - ce := buildFooClusterExtension(pkgName, []string{"beta", "alpha"}, "", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{"beta", "alpha"}, "", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, gotDeprecation, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) assert.Equal(t, genBundle(pkgName, "2.0.0"), *gotBundle) @@ -991,7 +991,7 @@ func TestAllCatalogsDisabled(t *testing.T) { WalkCatalogsFunc: CatalogWalker(listCatalogs, getPackage), } - ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0", ocv1.UpgradeConstraintPolicyCatalogProvided) _, _, _, err := r.Resolve(context.Background(), ce, nil) require.Error(t, err) assert.Contains(t, err.Error(), "no bundles found for package") @@ -1031,7 +1031,7 @@ func TestSomeCatalogsDisabled(t *testing.T) { WalkCatalogsFunc: CatalogWalker(listCatalogs, getPackage), } - ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided) + ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0", ocv1.UpgradeConstraintPolicyCatalogProvided) gotBundle, gotVersion, _, err := r.Resolve(context.Background(), ce, nil) require.NoError(t, err) require.NotNil(t, gotBundle) diff --git a/internal/resolve/resolver.go b/internal/resolve/resolver.go index 927763690..625111d63 100644 --- a/internal/resolve/resolver.go +++ b/internal/resolve/resolver.go @@ -7,15 +7,15 @@ import ( "github.com/operator-framework/operator-registry/alpha/declcfg" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) type Resolver interface { - Resolve(ctx context.Context, ext *ocv1alpha1.ClusterExtension, installedBundle *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) + Resolve(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) } -type Func func(ctx context.Context, ext *ocv1alpha1.ClusterExtension, installedBundle *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) +type Func func(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) -func (f Func) Resolve(ctx context.Context, ext *ocv1alpha1.ClusterExtension, installedBundle *ocv1alpha1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { +func (f Func) Resolve(ctx context.Context, ext *ocv1.ClusterExtension, installedBundle *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { return f(ctx, ext, installedBundle) } diff --git a/internal/scheme/scheme.go b/internal/scheme/scheme.go index b1d0e5b30..f247d9e7e 100644 --- a/internal/scheme/scheme.go +++ b/internal/scheme/scheme.go @@ -9,14 +9,14 @@ import ( catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) var Scheme = runtime.NewScheme() func init() { utilruntime.Must(clientgoscheme.AddToScheme(Scheme)) - utilruntime.Must(ocv1alpha1.AddToScheme(Scheme)) + utilruntime.Must(ocv1.AddToScheme(Scheme)) utilruntime.Must(catalogd.AddToScheme(Scheme)) utilruntime.Must(appsv1.AddToScheme(Scheme)) utilruntime.Must(corev1.AddToScheme(Scheme)) diff --git a/test/e2e/cluster_extension_install_test.go b/test/e2e/cluster_extension_install_test.go index 0548846bc..d590ee789 100644 --- a/test/e2e/cluster_extension_install_test.go +++ b/test/e2e/cluster_extension_install_test.go @@ -30,7 +30,7 @@ import ( catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) const ( @@ -192,7 +192,7 @@ func createClusterRoleAndBindingForSA(ctx context.Context, name string, sa *core return nil } -func testInit(t *testing.T) (*ocv1alpha1.ClusterExtension, *catalogd.ClusterCatalog, *corev1.ServiceAccount, *corev1.Namespace) { +func testInit(t *testing.T) (*ocv1.ClusterExtension, *catalogd.ClusterCatalog, *corev1.ServiceAccount, *corev1.Namespace) { var err error clusterExtensionName := fmt.Sprintf("clusterextension-%s", rand.String(8)) @@ -200,7 +200,7 @@ func testInit(t *testing.T) (*ocv1alpha1.ClusterExtension, *catalogd.ClusterCata ns, err := createNamespace(context.Background(), clusterExtensionName) require.NoError(t, err) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Name: clusterExtensionName, }, @@ -249,7 +249,7 @@ func ensureNoExtensionResources(t *testing.T, clusterExtensionName string) { }, 2*pollDuration, pollInterval) } -func testCleanup(t *testing.T, cat *catalogd.ClusterCatalog, clusterExtension *ocv1alpha1.ClusterExtension, sa *corev1.ServiceAccount, ns *corev1.Namespace) { +func testCleanup(t *testing.T, cat *catalogd.ClusterCatalog, clusterExtension *ocv1.ClusterExtension, sa *corev1.ServiceAccount, ns *corev1.Namespace) { t.Logf("By deleting ClusterCatalog %q", cat.Name) require.NoError(t, c.Delete(context.Background(), cat)) require.Eventually(t, func() bool { @@ -260,7 +260,7 @@ func testCleanup(t *testing.T, cat *catalogd.ClusterCatalog, clusterExtension *o t.Logf("By deleting ClusterExtension %q", clusterExtension.Name) require.NoError(t, c.Delete(context.Background(), clusterExtension)) require.Eventually(t, func() bool { - err := c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, &ocv1alpha1.ClusterExtension{}) + err := c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, &ocv1.ClusterExtension{}) return errors.IsNotFound(err) }, pollDuration, pollInterval) @@ -308,10 +308,10 @@ func TestClusterExtensionInstallRegistry(t *testing.T) { defer testCleanup(t, extensionCatalog, clusterExtension, sa, ns) defer getArtifactsOutput(t) - clusterExtension.Spec = ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + clusterExtension.Spec = ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: tc.packageName, Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": extensionCatalog.Name}, @@ -319,7 +319,7 @@ func TestClusterExtensionInstallRegistry(t *testing.T) { }, }, Namespace: ns.Name, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, } @@ -335,20 +335,20 @@ func TestClusterExtensionInstallRegistry(t *testing.T) { t.Log("By eventually reporting progressing as True") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) t.Log("By eventually installing the package successfully") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) assert.Contains(ct, cond.Message, "Installed bundle") assert.NotEmpty(ct, clusterExtension.Status.Install.Bundle) } @@ -364,15 +364,15 @@ func TestClusterExtensionInstallRegistryMultipleBundles(t *testing.T) { defer testCleanup(t, extensionCatalog, clusterExtension, sa, ns) defer getArtifactsOutput(t) - clusterExtension.Spec = ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + clusterExtension.Spec = ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "prometheus", }, }, Namespace: ns.Name, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, } @@ -388,10 +388,10 @@ func TestClusterExtensionInstallRegistryMultipleBundles(t *testing.T) { t.Log("By eventually reporting Progressing == True and Reason Retrying") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonRetrying, cond.Reason) + assert.Equal(ct, ocv1.ReasonRetrying, cond.Reason) assert.Contains(ct, cond.Message, "in multiple catalogs with the same priority [operatorhubio test-catalog]") } }, pollDuration, pollInterval) @@ -406,17 +406,17 @@ func TestClusterExtensionBlockInstallNonSuccessorVersion(t *testing.T) { defer getArtifactsOutput(t) t.Log("By creating an ClusterExtension at a specified version") - clusterExtension.Spec = ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + clusterExtension.Spec = ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "prometheus", Version: "1.0.0", // No Selector since this is an exact version match }, }, Namespace: ns.Name, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, } @@ -425,17 +425,17 @@ func TestClusterExtensionBlockInstallNonSuccessorVersion(t *testing.T) { require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) assert.Equal(ct, - &ocv1alpha1.ClusterExtensionInstallStatus{Bundle: ocv1alpha1.BundleMetadata{ + &ocv1.ClusterExtensionInstallStatus{Bundle: ocv1.BundleMetadata{ Name: "prometheus-operator.1.0.0", Version: "1.0.0", }}, clusterExtension.Status.Install, ) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) @@ -452,9 +452,9 @@ func TestClusterExtensionBlockInstallNonSuccessorVersion(t *testing.T) { t.Log("By eventually reporting Progressing == True and Reason Retrying") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { - assert.Equal(ct, ocv1alpha1.ReasonRetrying, cond.Reason) + assert.Equal(ct, ocv1.ReasonRetrying, cond.Reason) assert.Equal(ct, "error upgrading from currently installed version \"1.0.0\": no bundles found for package \"prometheus\" matching version \"1.2.0\"", cond.Message) } }, pollDuration, pollInterval) @@ -469,16 +469,16 @@ func TestClusterExtensionForceInstallNonSuccessorVersion(t *testing.T) { defer getArtifactsOutput(t) t.Log("By creating an ClusterExtension at a specified version") - clusterExtension.Spec = ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + clusterExtension.Spec = ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "prometheus", Version: "1.0.0", }, }, Namespace: ns.Name, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, } @@ -486,10 +486,10 @@ func TestClusterExtensionForceInstallNonSuccessorVersion(t *testing.T) { t.Log("By eventually reporting a successful resolution") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) @@ -497,15 +497,15 @@ func TestClusterExtensionForceInstallNonSuccessorVersion(t *testing.T) { t.Log("By updating the ClusterExtension resource to a non-successor version") // 1.2.0 does not replace/skip/skipRange 1.0.0. clusterExtension.Spec.Source.Catalog.Version = "1.2.0" - clusterExtension.Spec.Source.Catalog.UpgradeConstraintPolicy = ocv1alpha1.UpgradeConstraintPolicySelfCertified + clusterExtension.Spec.Source.Catalog.UpgradeConstraintPolicy = ocv1.UpgradeConstraintPolicySelfCertified require.NoError(t, c.Update(context.Background(), clusterExtension)) t.Log("By eventually reporting a satisfiable resolution") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) } @@ -518,16 +518,16 @@ func TestClusterExtensionInstallSuccessorVersion(t *testing.T) { defer getArtifactsOutput(t) t.Log("By creating an ClusterExtension at a specified version") - clusterExtension.Spec = ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + clusterExtension.Spec = ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "prometheus", Version: "1.0.0", }, }, Namespace: ns.Name, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, } @@ -535,10 +535,10 @@ func TestClusterExtensionInstallSuccessorVersion(t *testing.T) { t.Log("By eventually reporting a successful resolution") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) @@ -550,10 +550,10 @@ func TestClusterExtensionInstallSuccessorVersion(t *testing.T) { t.Log("By eventually reporting a successful resolution and bundle path") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) } @@ -565,10 +565,10 @@ func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) { defer testCleanup(t, extensionCatalog, clusterExtension, sa, ns) defer getArtifactsOutput(t) - clusterExtension.Spec = ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + clusterExtension.Spec = ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "prometheus", Selector: &metav1.LabelSelector{ MatchExpressions: []metav1.LabelSelectorRequirement{ @@ -582,7 +582,7 @@ func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) { }, }, Namespace: ns.Name, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, } @@ -593,10 +593,10 @@ func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) { t.Log("By reporting a successful resolution and bundle path") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) @@ -617,10 +617,10 @@ func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) { t.Log("By eventually reporting a successful resolution and bundle path") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) } @@ -640,7 +640,7 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) { extensionCatalog, err := createTestCatalog(context.Background(), testCatalogName, latestCatalogImage) require.NoError(t, err) clusterExtensionName := fmt.Sprintf("clusterextension-%s", rand.String(8)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Name: clusterExtensionName, }, @@ -652,10 +652,10 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) { defer testCleanup(t, extensionCatalog, clusterExtension, sa, ns) defer getArtifactsOutput(t) - clusterExtension.Spec = ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + clusterExtension.Spec = ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "prometheus", Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": extensionCatalog.Name}, @@ -663,7 +663,7 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) { }, }, Namespace: ns.Name, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, } @@ -674,10 +674,10 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) { t.Log("By reporting a successful resolution and bundle path") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) @@ -698,10 +698,10 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) { t.Log("By eventually reporting a successful resolution and bundle path") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) } @@ -713,10 +713,10 @@ func TestClusterExtensionInstallReResolvesWhenManagedContentChanged(t *testing.T defer testCleanup(t, extensionCatalog, clusterExtension, sa, ns) defer getArtifactsOutput(t) - clusterExtension.Spec = ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + clusterExtension.Spec = ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "prometheus", Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": extensionCatalog.Name}, @@ -724,7 +724,7 @@ func TestClusterExtensionInstallReResolvesWhenManagedContentChanged(t *testing.T }, }, Namespace: ns.Name, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, } @@ -735,10 +735,10 @@ func TestClusterExtensionInstallReResolvesWhenManagedContentChanged(t *testing.T t.Log("By reporting a successful installation") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) assert.Contains(ct, cond.Message, "Installed bundle") } }, pollDuration, pollInterval) @@ -776,10 +776,10 @@ func TestClusterExtensionRecoversFromInitialInstallFailedWhenFailureFixed(t *tes defer testCleanup(t, extensionCatalog, clusterExtension, sa, ns) defer getArtifactsOutput(t) - clusterExtension.Spec = ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + clusterExtension.Spec = ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: "prometheus", Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": extensionCatalog.Name}, @@ -787,7 +787,7 @@ func TestClusterExtensionRecoversFromInitialInstallFailedWhenFailureFixed(t *tes }, }, Namespace: ns.Name, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, } @@ -803,20 +803,20 @@ func TestClusterExtensionRecoversFromInitialInstallFailedWhenFailureFixed(t *tes t.Log("By eventually reporting Progressing == True with Reason Retrying") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonRetrying, cond.Reason) + assert.Equal(ct, ocv1.ReasonRetrying, cond.Reason) } }, pollDuration, pollInterval) t.Log("By eventually failing to install the package successfully due to insufficient ServiceAccount permissions") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionFalse, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonFailed, cond.Reason) + assert.Equal(ct, ocv1.ReasonFailed, cond.Reason) assert.Equal(ct, "No bundle installed", cond.Message) } }, pollDuration, pollInterval) @@ -831,10 +831,10 @@ func TestClusterExtensionRecoversFromInitialInstallFailedWhenFailureFixed(t *tes t.Log("By eventually installing the package successfully") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) assert.Contains(ct, cond.Message, "Installed bundle") assert.NotEmpty(ct, clusterExtension.Status.Install) } @@ -843,10 +843,10 @@ func TestClusterExtensionRecoversFromInitialInstallFailedWhenFailureFixed(t *tes t.Log("By eventually reporting Progressing == True with Reason Success") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: clusterExtension.Name}, clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeProgressing) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) if assert.NotNil(ct, cond) { assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) } }, pollDuration, pollInterval) } @@ -882,7 +882,7 @@ func getArtifactsOutput(t *testing.T) { } // get all cluster extensions save them to the artifact path. - clusterExtensions := ocv1alpha1.ClusterExtensionList{} + clusterExtensions := ocv1.ClusterExtensionList{} if err := c.List(context.Background(), &clusterExtensions, client.InNamespace("")); err != nil { fmt.Printf("Failed to list cluster extensions: %v", err) } diff --git a/test/extension-developer-e2e/extension_developer_test.go b/test/extension-developer-e2e/extension_developer_test.go index 81bf5042a..1ee2fffe4 100644 --- a/test/extension-developer-e2e/extension_developer_test.go +++ b/test/extension-developer-e2e/extension_developer_test.go @@ -20,7 +20,7 @@ import ( catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) func TestExtensionDeveloper(t *testing.T) { @@ -30,7 +30,7 @@ func TestExtensionDeveloper(t *testing.T) { scheme := runtime.NewScheme() require.NoError(t, catalogd.AddToScheme(scheme)) - require.NoError(t, ocv1alpha1.AddToScheme(scheme)) + require.NoError(t, ocv1.AddToScheme(scheme)) require.NoError(t, corev1.AddToScheme(scheme)) require.NoError(t, rbacv1.AddToScheme(scheme)) @@ -64,19 +64,19 @@ func TestExtensionDeveloper(t *testing.T) { } require.NoError(t, c.Create(ctx, sa)) - clusterExtension := &ocv1alpha1.ClusterExtension{ + clusterExtension := &ocv1.ClusterExtension{ ObjectMeta: metav1.ObjectMeta{ Name: "registryv1", }, - Spec: ocv1alpha1.ClusterExtensionSpec{ - Source: ocv1alpha1.SourceConfig{ + Spec: ocv1.ClusterExtensionSpec{ + Source: ocv1.SourceConfig{ SourceType: "Catalog", - Catalog: &ocv1alpha1.CatalogSource{ + Catalog: &ocv1.CatalogSource{ PackageName: os.Getenv("REG_PKG_NAME"), }, }, Namespace: installNamespace, - ServiceAccount: ocv1alpha1.ServiceAccountReference{ + ServiceAccount: ocv1.ServiceAccountReference{ Name: sa.Name, }, }, @@ -200,14 +200,14 @@ func TestExtensionDeveloper(t *testing.T) { require.NoError(t, c.Create(context.Background(), clusterExtension)) t.Log("It should have a status condition type of Installed with a status of True and a reason of Success") require.EventuallyWithT(t, func(ct *assert.CollectT) { - ext := &ocv1alpha1.ClusterExtension{} + ext := &ocv1.ClusterExtension{} assert.NoError(ct, c.Get(context.Background(), client.ObjectKeyFromObject(clusterExtension), ext)) - cond := meta.FindStatusCondition(ext.Status.Conditions, ocv1alpha1.TypeInstalled) + cond := meta.FindStatusCondition(ext.Status.Conditions, ocv1.TypeInstalled) if !assert.NotNil(ct, cond) { return } assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) }, 2*time.Minute, time.Second) require.NoError(t, c.Delete(context.Background(), catalog)) require.NoError(t, c.Delete(context.Background(), clusterExtension)) diff --git a/test/upgrade-e2e/post_upgrade_test.go b/test/upgrade-e2e/post_upgrade_test.go index 8d0930573..d6f46ca94 100644 --- a/test/upgrade-e2e/post_upgrade_test.go +++ b/test/upgrade-e2e/post_upgrade_test.go @@ -20,7 +20,7 @@ import ( catalogdv1alpha1 "github.com/operator-framework/catalogd/api/core/v1alpha1" - ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1" + ocv1 "github.com/operator-framework/operator-controller/api/v1" ) func TestClusterExtensionAfterOLMUpgrade(t *testing.T) { @@ -76,15 +76,15 @@ func TestClusterExtensionAfterOLMUpgrade(t *testing.T) { }, time.Minute, time.Second) t.Log("Checking that the ClusterExtension is installed") - var clusterExtension ocv1alpha1.ClusterExtension + var clusterExtension ocv1.ClusterExtension require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(ctx, types.NamespacedName{Name: testClusterExtensionName}, &clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) if !assert.NotNil(ct, cond) { return } assert.Equal(ct, metav1.ConditionTrue, cond.Status) - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) assert.Contains(ct, cond.Message, "Installed bundle") if assert.NotNil(ct, clusterExtension.Status.Install) { assert.NotEmpty(ct, clusterExtension.Status.Install.Bundle.Version) @@ -101,13 +101,13 @@ func TestClusterExtensionAfterOLMUpgrade(t *testing.T) { t.Log("Checking that the ClusterExtension installs successfully") require.EventuallyWithT(t, func(ct *assert.CollectT) { assert.NoError(ct, c.Get(ctx, types.NamespacedName{Name: testClusterExtensionName}, &clusterExtension)) - cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled) + cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) if !assert.NotNil(ct, cond) { return } - assert.Equal(ct, ocv1alpha1.ReasonSucceeded, cond.Reason) + assert.Equal(ct, ocv1.ReasonSucceeded, cond.Reason) assert.Contains(ct, cond.Message, "Installed bundle") - assert.Equal(ct, ocv1alpha1.BundleMetadata{Name: "prometheus-operator.1.0.1", Version: "1.0.1"}, clusterExtension.Status.Install.Bundle) + assert.Equal(ct, ocv1.BundleMetadata{Name: "prometheus-operator.1.0.1", Version: "1.0.1"}, clusterExtension.Status.Install.Bundle) assert.NotEqual(ct, previousVersion, clusterExtension.Status.Install.Bundle.Version) }, time.Minute, time.Second) }