diff --git a/README.md b/README.md index 60714e98..3621ff13 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A ```sh $ kubectl apply -f - << EOF - apiVersion: olm.operatorframework.io/v1alpha1 + apiVersion: olm.operatorframework.io/v1 kind: ClusterCatalog metadata: name: operatorhubio @@ -42,13 +42,13 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A Namespace: Labels: Annotations: - API Version: olm.operatorframework.io/v1alpha1 + API Version: olm.operatorframework.io/v1 Kind: ClusterCatalog Metadata: Creation Timestamp: 2023-06-23T18:35:13Z Generation: 1 Managed Fields: - API Version: olm.operatorframework.io/v1alpha1 + API Version: olm.operatorframework.io/v1 Fields Type: FieldsV1 fieldsV1: f:metadata: @@ -66,7 +66,7 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A Manager: kubectl-client-side-apply Operation: Update Time: 2023-06-23T18:35:13Z - API Version: olm.operatorframework.io/v1alpha1 + API Version: olm.operatorframework.io/v1 Fields Type: FieldsV1 fieldsV1: f:status: diff --git a/api/core/v1alpha1/clustercatalog_types.go b/api/core/v1/clustercatalog_types.go similarity index 99% rename from api/core/v1alpha1/clustercatalog_types.go rename to api/core/v1/clustercatalog_types.go index ab9469a6..69fc1093 100644 --- a/api/core/v1alpha1/clustercatalog_types.go +++ b/api/core/v1/clustercatalog_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/api/core/v1alpha1/clustercatalog_types_test.go b/api/core/v1/clustercatalog_types_test.go similarity index 98% rename from api/core/v1alpha1/clustercatalog_types_test.go rename to api/core/v1/clustercatalog_types_test.go index 8e617b20..c96bd79d 100644 --- a/api/core/v1alpha1/clustercatalog_types_test.go +++ b/api/core/v1/clustercatalog_types_test.go @@ -1,4 +1,4 @@ -package v1alpha1 +package v1 import ( "context" @@ -22,7 +22,7 @@ import ( func TestPollIntervalCELValidationRules(t *testing.T) { validators := fieldValidatorsFromFile(t, "../../../config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml") pth := "openAPIV3Schema.properties.spec" - validator, found := validators["v1alpha1"][pth] + validator, found := validators["v1"][pth] assert.True(t, found) for name, tc := range map[string]struct { diff --git a/api/core/v1alpha1/groupversion_info.go b/api/core/v1/groupversion_info.go similarity index 89% rename from api/core/v1alpha1/groupversion_info.go rename to api/core/v1/groupversion_info.go index cbc9b6b2..adb650eb 100644 --- a/api/core/v1alpha1/groupversion_info.go +++ b/api/core/v1/groupversion_info.go @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group +// Package v1 contains API Schema definitions for the core v1 API group // +kubebuilder:object:generate=true // +groupName=olm.operatorframework.io -package v1alpha1 +package v1 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -26,7 +26,7 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "olm.operatorframework.io", Version: "v1alpha1"} + GroupVersion = schema.GroupVersion{Group: "olm.operatorframework.io", Version: "v1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/api/core/v1alpha1/zz_generated.deepcopy.go b/api/core/v1/zz_generated.deepcopy.go similarity index 97% rename from api/core/v1alpha1/zz_generated.deepcopy.go rename to api/core/v1/zz_generated.deepcopy.go index b68da00a..d3f4831d 100644 --- a/api/core/v1alpha1/zz_generated.deepcopy.go +++ b/api/core/v1/zz_generated.deepcopy.go @@ -18,10 +18,10 @@ limitations under the License. // Code generated by controller-gen. DO NOT EDIT. -package v1alpha1 +package v1 import ( - "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -125,7 +125,7 @@ func (in *ClusterCatalogStatus) DeepCopyInto(out *ClusterCatalogStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) + *out = make([]metav1.Condition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -153,7 +153,7 @@ func (in *ImageSource) DeepCopyInto(out *ImageSource) { *out = *in if in.PollInterval != nil { in, out := &in.PollInterval, &out.PollInterval - *out = new(v1.Duration) + *out = new(metav1.Duration) **out = **in } } diff --git a/cmd/manager/main.go b/cmd/manager/main.go index ff7c102f..8fad4162 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -40,7 +40,7 @@ import ( metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" crwebhook "sigs.k8s.io/controller-runtime/pkg/webhook" - "github.com/operator-framework/catalogd/api/core/v1alpha1" + "github.com/operator-framework/catalogd/api/core/v1" corecontrollers "github.com/operator-framework/catalogd/internal/controllers/core" "github.com/operator-framework/catalogd/internal/features" "github.com/operator-framework/catalogd/internal/garbagecollection" @@ -62,7 +62,7 @@ const storageDir = "catalogs" func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(v1alpha1.AddToScheme(scheme)) + utilruntime.Must(v1.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } diff --git a/config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml b/config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml index 62771fac..5fb7ebbe 100644 --- a/config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml +++ b/config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml @@ -21,7 +21,7 @@ spec: - jsonPath: .metadata.creationTimestamp name: Age type: date - name: v1alpha1 + name: v1 schema: openAPIV3Schema: description: ClusterCatalog is the Schema for the ClusterCatalogs API diff --git a/config/base/default/clustercatalogs/default-catalogs.yaml b/config/base/default/clustercatalogs/default-catalogs.yaml index 98386e0f..95ac4468 100644 --- a/config/base/default/clustercatalogs/default-catalogs.yaml +++ b/config/base/default/clustercatalogs/default-catalogs.yaml @@ -1,4 +1,4 @@ -apiVersion: olm.operatorframework.io/v1alpha1 +apiVersion: olm.operatorframework.io/v1 kind: ClusterCatalog metadata: name: operatorhubio diff --git a/config/base/manager/webhook/manifests.yaml b/config/base/manager/webhook/manifests.yaml index bd133c05..55be456c 100644 --- a/config/base/manager/webhook/manifests.yaml +++ b/config/base/manager/webhook/manifests.yaml @@ -10,14 +10,14 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-olm-operatorframework-io-v1alpha1-clustercatalog + path: /mutate-olm-operatorframework-io-v1-clustercatalog failurePolicy: Fail name: inject-metadata-name.olm.operatorframework.io rules: - apiGroups: - olm.operatorframework.io apiVersions: - - v1alpha1 + - v1F operations: - CREATE - UPDATE diff --git a/config/samples/core_v1alpha1_clustercatalog.yaml b/config/samples/core_v1_clustercatalog.yaml similarity index 79% rename from config/samples/core_v1alpha1_clustercatalog.yaml rename to config/samples/core_v1_clustercatalog.yaml index 980b7afb..74373855 100644 --- a/config/samples/core_v1alpha1_clustercatalog.yaml +++ b/config/samples/core_v1_clustercatalog.yaml @@ -1,4 +1,4 @@ -apiVersion: olm.operatorframework.io/v1alpha1 +apiVersion: olm.operatorframework.io/v1 kind: ClusterCatalog metadata: name: operatorhubio diff --git a/docs/fetching-catalog-contents.md b/docs/fetching-catalog-contents.md index d94bd687..612ca890 100644 --- a/docs/fetching-catalog-contents.md +++ b/docs/fetching-catalog-contents.md @@ -146,7 +146,7 @@ This section outlines a way of exposing the `Catalogd` Service's endpoints outsi ```sh $ kubectl apply -f - << EOF - apiVersion: olm.operatorframework.io/v1alpha1 + apiVersion: olm.operatorframework.io/v1 kind: ClusterCatalog metadata: name: operatorhubio diff --git a/hack/scripts/demo-script.sh b/hack/scripts/demo-script.sh index 34495c73..1fa989a2 100755 --- a/hack/scripts/demo-script.sh +++ b/hack/scripts/demo-script.sh @@ -15,7 +15,7 @@ sleep 10 kubectl get crds -A # create a catalog -kubectl apply -f config/samples/core_v1alpha1_catalog.yaml +kubectl apply -f config/samples/core_v1_clustercatalog.yaml # shows catalog-sample kubectl get catalog -A # waiting for catalog to report ready status diff --git a/internal/controllers/core/clustercatalog_controller.go b/internal/controllers/core/clustercatalog_controller.go index 926ce55f..bbff8810 100644 --- a/internal/controllers/core/clustercatalog_controller.go +++ b/internal/controllers/core/clustercatalog_controller.go @@ -33,7 +33,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/log" - "github.com/operator-framework/catalogd/api/core/v1alpha1" + "github.com/operator-framework/catalogd/api/core/v1" catalogderrors "github.com/operator-framework/catalogd/internal/errors" "github.com/operator-framework/catalogd/internal/source" "github.com/operator-framework/catalogd/internal/storage" @@ -69,7 +69,7 @@ func (r *ClusterCatalogReconciler) Reconcile(ctx context.Context, req ctrl.Reque // TODO: Where and when should we be logging errors and at which level? _ = log.FromContext(ctx).WithName("catalogd-controller") - existingCatsrc := v1alpha1.ClusterCatalog{} + existingCatsrc := v1.ClusterCatalog{} if err := r.Client.Get(ctx, req.NamespacedName, &existingCatsrc); err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) } @@ -92,7 +92,7 @@ func (r *ClusterCatalogReconciler) Reconcile(ctx context.Context, req ctrl.Reque return res, apimacherrors.NewAggregate([]error{reconcileErr, updateErr}) } } - existingCatsrc.Status, reconciledCatsrc.Status = v1alpha1.ClusterCatalogStatus{}, v1alpha1.ClusterCatalogStatus{} + existingCatsrc.Status, reconciledCatsrc.Status = v1.ClusterCatalogStatus{}, v1.ClusterCatalogStatus{} if !equality.Semantic.DeepEqual(existingCatsrc, reconciledCatsrc) { if updateErr := r.Client.Update(ctx, reconciledCatsrc); updateErr != nil { return res, apimacherrors.NewAggregate([]error{reconcileErr, updateErr}) @@ -104,7 +104,7 @@ func (r *ClusterCatalogReconciler) Reconcile(ctx context.Context, req ctrl.Reque // SetupWithManager sets up the controller with the Manager. func (r *ClusterCatalogReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&v1alpha1.ClusterCatalog{}). + For(&v1.ClusterCatalog{}). Owns(&corev1.Pod{}). Complete(r) } @@ -117,7 +117,7 @@ func (r *ClusterCatalogReconciler) SetupWithManager(mgr ctrl.Manager) error { // to add the ctrl.Result type back as a return value. Adding a comment to ignore // linting from the linter that was fussing about this. // nolint:unparam -func (r *ClusterCatalogReconciler) reconcile(ctx context.Context, catalog *v1alpha1.ClusterCatalog) (ctrl.Result, error) { +func (r *ClusterCatalogReconciler) reconcile(ctx context.Context, catalog *v1.ClusterCatalog) (ctrl.Result, error) { if catalog.DeletionTimestamp.IsZero() && !controllerutil.ContainsFinalizer(catalog, fbcDeletionFinalizer) { controllerutil.AddFinalizer(catalog, fbcDeletionFinalizer) return ctrl.Result{}, nil @@ -172,7 +172,7 @@ func (r *ClusterCatalogReconciler) reconcile(ctx context.Context, catalog *v1alp var requeueAfter time.Duration switch catalog.Spec.Source.Type { - case v1alpha1.SourceTypeImage: + case v1.SourceTypeImage: if catalog.Spec.Source.Image != nil && catalog.Spec.Source.Image.PollInterval != nil { requeueAfter = wait.Jitter(catalog.Spec.Source.Image.PollInterval.Duration, requeueJitterMaxFactor) } @@ -184,72 +184,72 @@ func (r *ClusterCatalogReconciler) reconcile(ctx context.Context, catalog *v1alp } } -func updateStatusUnpackPending(status *v1alpha1.ClusterCatalogStatus, result *source.Result) { +func updateStatusUnpackPending(status *v1.ClusterCatalogStatus, result *source.Result) { status.ResolvedSource = nil meta.SetStatusCondition(&status.Conditions, metav1.Condition{ - Type: v1alpha1.TypeUnpacked, + Type: v1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: v1alpha1.ReasonUnpackPending, + Reason: v1.ReasonUnpackPending, Message: result.Message, }) } -func updateStatusUnpacking(status *v1alpha1.ClusterCatalogStatus, result *source.Result) { +func updateStatusUnpacking(status *v1.ClusterCatalogStatus, result *source.Result) { status.ResolvedSource = nil meta.SetStatusCondition(&status.Conditions, metav1.Condition{ - Type: v1alpha1.TypeUnpacked, + Type: v1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: v1alpha1.ReasonUnpacking, + Reason: v1.ReasonUnpacking, Message: result.Message, }) } -func updateStatusUnpacked(status *v1alpha1.ClusterCatalogStatus, result *source.Result, contentURL string, generation int64, lastUnpacked metav1.Time) { +func updateStatusUnpacked(status *v1.ClusterCatalogStatus, result *source.Result, contentURL string, generation int64, lastUnpacked metav1.Time) { status.ResolvedSource = result.ResolvedSource status.ContentURL = contentURL status.ObservedGeneration = generation status.LastUnpacked = lastUnpacked meta.SetStatusCondition(&status.Conditions, metav1.Condition{ - Type: v1alpha1.TypeUnpacked, + Type: v1.TypeUnpacked, Status: metav1.ConditionTrue, - Reason: v1alpha1.ReasonUnpackSuccessful, + Reason: v1.ReasonUnpackSuccessful, Message: result.Message, }) } -func updateStatusUnpackFailing(status *v1alpha1.ClusterCatalogStatus, err error) error { +func updateStatusUnpackFailing(status *v1.ClusterCatalogStatus, err error) error { status.ResolvedSource = nil meta.SetStatusCondition(&status.Conditions, metav1.Condition{ - Type: v1alpha1.TypeUnpacked, + Type: v1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: v1alpha1.ReasonUnpackFailed, + Reason: v1.ReasonUnpackFailed, Message: err.Error(), }) return err } -func updateStatusStorageError(status *v1alpha1.ClusterCatalogStatus, err error) error { +func updateStatusStorageError(status *v1.ClusterCatalogStatus, err error) error { status.ResolvedSource = nil meta.SetStatusCondition(&status.Conditions, metav1.Condition{ - Type: v1alpha1.TypeUnpacked, + Type: v1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: v1alpha1.ReasonStorageFailed, + Reason: v1.ReasonStorageFailed, Message: fmt.Sprintf("failed to store bundle: %s", err.Error()), }) return err } -func updateStatusStorageDeleteError(status *v1alpha1.ClusterCatalogStatus, err error) error { +func updateStatusStorageDeleteError(status *v1.ClusterCatalogStatus, err error) error { meta.SetStatusCondition(&status.Conditions, metav1.Condition{ - Type: v1alpha1.TypeDelete, + Type: v1.TypeDelete, Status: metav1.ConditionFalse, - Reason: v1alpha1.ReasonStorageDeleteFailed, + Reason: v1.ReasonStorageDeleteFailed, Message: fmt.Sprintf("failed to delete storage: %s", err.Error()), }) return err } -func (r *ClusterCatalogReconciler) needsUnpacking(catalog *v1alpha1.ClusterCatalog) bool { +func (r *ClusterCatalogReconciler) needsUnpacking(catalog *v1.ClusterCatalog) bool { // if ResolvedSource is nil, it indicates that this is the first time we're // unpacking this catalog. if catalog.Status.ResolvedSource == nil { diff --git a/internal/controllers/core/clustercatalog_controller_test.go b/internal/controllers/core/clustercatalog_controller_test.go index ebf7b6d5..35486b18 100644 --- a/internal/controllers/core/clustercatalog_controller_test.go +++ b/internal/controllers/core/clustercatalog_controller_test.go @@ -15,7 +15,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ctrl "sigs.k8s.io/controller-runtime" - catalogdv1alpha1 "github.com/operator-framework/catalogd/api/core/v1alpha1" + catalogdv1 "github.com/operator-framework/catalogd/api/core/v1" "github.com/operator-framework/catalogd/internal/source" "github.com/operator-framework/catalogd/internal/storage" ) @@ -31,7 +31,7 @@ type MockSource struct { shouldError bool } -func (ms *MockSource) Unpack(_ context.Context, _ *catalogdv1alpha1.ClusterCatalog) (*source.Result, error) { +func (ms *MockSource) Unpack(_ context.Context, _ *catalogdv1.ClusterCatalog) (*source.Result, error) { if ms.shouldError { return nil, errors.New("mocksource error") } @@ -39,7 +39,7 @@ func (ms *MockSource) Unpack(_ context.Context, _ *catalogdv1alpha1.ClusterCatal return ms.result, nil } -func (ms *MockSource) Cleanup(_ context.Context, _ *catalogdv1alpha1.ClusterCatalog) error { +func (ms *MockSource) Cleanup(_ context.Context, _ *catalogdv1.ClusterCatalog) error { if ms.shouldError { return errors.New("mocksource error") } @@ -82,9 +82,9 @@ func (m MockStore) ContentExists(_ string) bool { func TestCatalogdControllerReconcile(t *testing.T) { for _, tt := range []struct { name string - catalog *catalogdv1alpha1.ClusterCatalog + catalog *catalogdv1.ClusterCatalog shouldErr bool - expectedCatalog *catalogdv1alpha1.ClusterCatalog + expectedCatalog *catalogdv1.ClusterCatalog source source.Unpacker store storage.Instance }{ @@ -92,34 +92,34 @@ func TestCatalogdControllerReconcile(t *testing.T) { name: "invalid source type, returns error", source: &MockSource{}, store: &MockStore{}, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "invalid", }, }, }, shouldErr: true, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "invalid", }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: catalogdv1alpha1.ReasonUnpackFailed, + Reason: catalogdv1.ReasonUnpackFailed, }, }, }, @@ -131,39 +131,39 @@ func TestCatalogdControllerReconcile(t *testing.T) { result: &source.Result{State: source.StatePending}, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, }, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: catalogdv1alpha1.ReasonUnpackPending, + Reason: catalogdv1.ReasonUnpackPending, }, }, }, @@ -175,39 +175,39 @@ func TestCatalogdControllerReconcile(t *testing.T) { result: &source.Result{State: source.StateUnpacking}, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, }, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: catalogdv1alpha1.ReasonUnpacking, + Reason: catalogdv1.ReasonUnpacking, }, }, }, @@ -220,39 +220,39 @@ func TestCatalogdControllerReconcile(t *testing.T) { result: &source.Result{State: "unknown"}, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, }, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: catalogdv1alpha1.ReasonUnpackFailed, + Reason: catalogdv1.ReasonUnpackFailed, }, }, }, @@ -265,39 +265,39 @@ func TestCatalogdControllerReconcile(t *testing.T) { shouldError: true, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, }, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: catalogdv1alpha1.ReasonUnpackFailed, + Reason: catalogdv1.ReasonUnpackFailed, }, }, }, @@ -312,40 +312,40 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, }, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ ContentURL: "URL", Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionTrue, - Reason: catalogdv1alpha1.ReasonUnpackSuccessful, + Reason: catalogdv1.ReasonUnpackSuccessful, }, }, }, @@ -363,39 +363,39 @@ func TestCatalogdControllerReconcile(t *testing.T) { store: &MockStore{ shouldError: true, }, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, }, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionFalse, - Reason: catalogdv1alpha1.ReasonStorageFailed, + Reason: catalogdv1.ReasonStorageFailed, }, }, }, @@ -405,28 +405,28 @@ func TestCatalogdControllerReconcile(t *testing.T) { name: "storage finalizer not set, storage finalizer gets set", source: &MockSource{}, store: &MockStore{}, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, }, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, @@ -437,31 +437,31 @@ func TestCatalogdControllerReconcile(t *testing.T) { name: "storage finalizer set, catalog deletion timestamp is not zero (or nil), finalizer removed", source: &MockSource{}, store: &MockStore{}, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, DeletionTimestamp: &metav1.Time{Time: time.Date(2023, time.October, 10, 4, 19, 0, 0, time.UTC)}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, }, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{}, DeletionTimestamp: &metav1.Time{Time: time.Date(2023, time.October, 10, 4, 19, 0, 0, time.UTC)}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, @@ -475,41 +475,41 @@ func TestCatalogdControllerReconcile(t *testing.T) { store: &MockStore{ shouldError: true, }, - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, DeletionTimestamp: &metav1.Time{Time: time.Date(2023, time.October, 10, 4, 19, 0, 0, time.UTC)}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, }, - expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ + expectedCatalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, DeletionTimestamp: &metav1.Time{Time: time.Date(2023, time.October, 10, 4, 19, 0, 0, time.UTC)}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeDelete, + Type: catalogdv1.TypeDelete, Status: metav1.ConditionFalse, - Reason: catalogdv1alpha1.ReasonStorageDeleteFailed, + Reason: catalogdv1.ReasonStorageDeleteFailed, }, }, }, @@ -520,8 +520,8 @@ func TestCatalogdControllerReconcile(t *testing.T) { reconciler := &ClusterCatalogReconciler{ Client: nil, Unpacker: source.NewUnpacker( - map[catalogdv1alpha1.SourceType]source.Unpacker{ - catalogdv1alpha1.SourceTypeImage: tt.source, + map[catalogdv1.SourceType]source.Unpacker{ + catalogdv1.SourceTypeImage: tt.source, }, ), Storage: tt.store, @@ -543,19 +543,19 @@ func TestCatalogdControllerReconcile(t *testing.T) { func TestPollingRequeue(t *testing.T) { for name, tc := range map[string]struct { - catalog *catalogdv1alpha1.ClusterCatalog + catalog *catalogdv1.ClusterCatalog expectedRequeueAfter time.Duration }{ "ClusterCatalog with tag based image ref without any poll interval specified, requeueAfter set to 0, ie polling disabled": { - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, @@ -564,15 +564,15 @@ func TestPollingRequeue(t *testing.T) { expectedRequeueAfter: time.Second * 0, }, "ClusterCatalog with tag based image ref with poll interval specified, requeueAfter set to wait.jitter(pollInterval)": { - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", PollInterval: &metav1.Duration{Duration: time.Minute * 5}, }, @@ -586,8 +586,8 @@ func TestPollingRequeue(t *testing.T) { reconciler := &ClusterCatalogReconciler{ Client: nil, Unpacker: source.NewUnpacker( - map[catalogdv1alpha1.SourceType]source.Unpacker{ - catalogdv1alpha1.SourceTypeImage: &MockSource{result: &source.Result{ + map[catalogdv1.SourceType]source.Unpacker{ + catalogdv1.SourceTypeImage: &MockSource{result: &source.Result{ State: source.StateUnpacked, FS: &fstest.MapFS{}, }}, @@ -606,19 +606,19 @@ func TestPollingRequeue(t *testing.T) { func TestPollingReconcilerUnpack(t *testing.T) { for name, tc := range map[string]struct { - catalog *catalogdv1alpha1.ClusterCatalog + catalog *catalogdv1.ClusterCatalog expectedUnpackRun bool }{ "ClusterCatalog being resolved the first time, unpack should run": { - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", PollInterval: &metav1.Duration{Duration: time.Minute * 5}, }, @@ -628,33 +628,33 @@ func TestPollingReconcilerUnpack(t *testing.T) { expectedUnpackRun: true, }, "ClusterCatalog not being resolved the first time, no pollInterval mentioned, unpack should not run": { - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, Generation: 2, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ ContentURL: "URL", Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionTrue, - Reason: catalogdv1alpha1.ReasonUnpackSuccessful, + Reason: catalogdv1.ReasonUnpackSuccessful, }, }, ObservedGeneration: 2, - ResolvedSource: &catalogdv1alpha1.ResolvedCatalogSource{ + ResolvedSource: &catalogdv1.ResolvedCatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ResolvedImageSource{ + Image: &catalogdv1.ResolvedImageSource{ Ref: "someimage:latest", ResolvedRef: "someimage@sha256:asdf123", LastPollAttempt: metav1.Time{Time: time.Now().Add(-time.Minute * 5)}, @@ -665,34 +665,34 @@ func TestPollingReconcilerUnpack(t *testing.T) { expectedUnpackRun: false, }, "ClusterCatalog not being resolved the first time, pollInterval mentioned, \"now\" is before next expected poll time, unpack should not run": { - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, Generation: 2, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", PollInterval: &metav1.Duration{Duration: time.Minute * 7}, }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ ContentURL: "URL", Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionTrue, - Reason: catalogdv1alpha1.ReasonUnpackSuccessful, + Reason: catalogdv1.ReasonUnpackSuccessful, }, }, ObservedGeneration: 2, - ResolvedSource: &catalogdv1alpha1.ResolvedCatalogSource{ + ResolvedSource: &catalogdv1.ResolvedCatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ResolvedImageSource{ + Image: &catalogdv1.ResolvedImageSource{ Ref: "someimage:latest", ResolvedRef: "someimage@sha256:asdf123", LastPollAttempt: metav1.Time{Time: time.Now().Add(-time.Minute * 5)}, @@ -703,34 +703,34 @@ func TestPollingReconcilerUnpack(t *testing.T) { expectedUnpackRun: false, }, "ClusterCatalog not being resolved the first time, pollInterval mentioned, \"now\" is after next expected poll time, unpack should run": { - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, Generation: 2, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someimage:latest", PollInterval: &metav1.Duration{Duration: time.Minute * 3}, }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ ContentURL: "URL", Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionTrue, - Reason: catalogdv1alpha1.ReasonUnpackSuccessful, + Reason: catalogdv1.ReasonUnpackSuccessful, }, }, ObservedGeneration: 2, - ResolvedSource: &catalogdv1alpha1.ResolvedCatalogSource{ + ResolvedSource: &catalogdv1.ResolvedCatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ResolvedImageSource{ + Image: &catalogdv1.ResolvedImageSource{ Ref: "someimage:latest", ResolvedRef: "someimage@sha256:asdf123", LastPollAttempt: metav1.Time{Time: time.Now().Add(-time.Minute * 5)}, @@ -741,34 +741,34 @@ func TestPollingReconcilerUnpack(t *testing.T) { expectedUnpackRun: true, }, "ClusterCatalog not being resolved the first time, pollInterval mentioned, \"now\" is before next expected poll time, spec.image changed, unpack should run": { - catalog: &catalogdv1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, Generation: 3, }, - Spec: catalogdv1alpha1.ClusterCatalogSpec{ - Source: catalogdv1alpha1.CatalogSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ImageSource{ + Image: &catalogdv1.ImageSource{ Ref: "someotherimage:latest", PollInterval: &metav1.Duration{Duration: time.Minute * 7}, }, }, }, - Status: catalogdv1alpha1.ClusterCatalogStatus{ + Status: catalogdv1.ClusterCatalogStatus{ ContentURL: "URL", Conditions: []metav1.Condition{ { - Type: catalogdv1alpha1.TypeUnpacked, + Type: catalogdv1.TypeUnpacked, Status: metav1.ConditionTrue, - Reason: catalogdv1alpha1.ReasonUnpackSuccessful, + Reason: catalogdv1.ReasonUnpackSuccessful, }, }, ObservedGeneration: 2, - ResolvedSource: &catalogdv1alpha1.ResolvedCatalogSource{ + ResolvedSource: &catalogdv1.ResolvedCatalogSource{ Type: "image", - Image: &catalogdv1alpha1.ResolvedImageSource{ + Image: &catalogdv1.ResolvedImageSource{ Ref: "someimage:latest", ResolvedRef: "someimage@sha256:asdf123", LastPollAttempt: metav1.Time{Time: time.Now().Add(-time.Minute * 5)}, diff --git a/internal/garbagecollection/garbage_collector.go b/internal/garbagecollection/garbage_collector.go index b2579748..fde66ecf 100644 --- a/internal/garbagecollection/garbage_collector.go +++ b/internal/garbagecollection/garbage_collector.go @@ -13,7 +13,7 @@ import ( "k8s.io/client-go/metadata" "sigs.k8s.io/controller-runtime/pkg/manager" - "github.com/operator-framework/catalogd/api/core/v1alpha1" + "github.com/operator-framework/catalogd/api/core/v1" ) var _ manager.Runnable = (*GarbageCollector)(nil) @@ -64,7 +64,7 @@ func (gc *GarbageCollector) Start(ctx context.Context) error { } func runGarbageCollection(ctx context.Context, cachePath string, metaClient metadata.Interface) ([]string, error) { - getter := metaClient.Resource(v1alpha1.GroupVersion.WithResource("clustercatalogs")) + getter := metaClient.Resource(v1.GroupVersion.WithResource("clustercatalogs")) metaList, err := getter.List(ctx, metav1.ListOptions{}) if err != nil { return nil, fmt.Errorf("error listing clustercatalogs: %w", err) diff --git a/internal/garbagecollection/garbage_collector_test.go b/internal/garbagecollection/garbage_collector_test.go index 59f045d9..8ec68465 100644 --- a/internal/garbagecollection/garbage_collector_test.go +++ b/internal/garbagecollection/garbage_collector_test.go @@ -12,7 +12,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/metadata/fake" - "github.com/operator-framework/catalogd/api/core/v1alpha1" + "github.com/operator-framework/catalogd/api/core/v1" ) func TestRunGarbageCollection(t *testing.T) { @@ -28,7 +28,7 @@ func TestRunGarbageCollection(t *testing.T) { { TypeMeta: metav1.TypeMeta{ Kind: "ClusterCatalog", - APIVersion: v1alpha1.GroupVersion.String(), + APIVersion: v1.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: "one", @@ -37,7 +37,7 @@ func TestRunGarbageCollection(t *testing.T) { { TypeMeta: metav1.TypeMeta{ Kind: "ClusterCatalog", - APIVersion: v1alpha1.GroupVersion.String(), + APIVersion: v1.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: "two", @@ -48,7 +48,7 @@ func TestRunGarbageCollection(t *testing.T) { { TypeMeta: metav1.TypeMeta{ Kind: "ClusterCatalog", - APIVersion: v1alpha1.GroupVersion.String(), + APIVersion: v1.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: "three", diff --git a/internal/source/image_registry_client.go b/internal/source/image_registry_client.go index 60fd3f77..842810f0 100644 --- a/internal/source/image_registry_client.go +++ b/internal/source/image_registry_client.go @@ -22,7 +22,7 @@ import ( apimacherrors "k8s.io/apimachinery/pkg/util/errors" "sigs.k8s.io/controller-runtime/pkg/log" - catalogdv1alpha1 "github.com/operator-framework/catalogd/api/core/v1alpha1" + catalogdv1 "github.com/operator-framework/catalogd/api/core/v1" catalogderrors "github.com/operator-framework/catalogd/internal/errors" ) @@ -35,10 +35,10 @@ type ImageRegistry struct { const ConfigDirLabel = "operators.operatorframework.io.index.configs.v1" -func (i *ImageRegistry) Unpack(ctx context.Context, catalog *catalogdv1alpha1.ClusterCatalog) (*Result, error) { +func (i *ImageRegistry) Unpack(ctx context.Context, catalog *catalogdv1.ClusterCatalog) (*Result, error) { l := log.FromContext(ctx) - if catalog.Spec.Source.Type != catalogdv1alpha1.SourceTypeImage { - panic(fmt.Sprintf("programmer error: source type %q is unable to handle specified catalog source type %q", catalogdv1alpha1.SourceTypeImage, catalog.Spec.Source.Type)) + if catalog.Spec.Source.Type != catalogdv1.SourceTypeImage { + panic(fmt.Sprintf("programmer error: source type %q is unable to handle specified catalog source type %q", catalogdv1.SourceTypeImage, catalog.Spec.Source.Type)) } if catalog.Spec.Source.Image == nil { @@ -132,16 +132,16 @@ func wrapUnrecoverable(err error, isUnrecoverable bool) error { return err } -func (i *ImageRegistry) Cleanup(_ context.Context, catalog *catalogdv1alpha1.ClusterCatalog) error { +func (i *ImageRegistry) Cleanup(_ context.Context, catalog *catalogdv1.ClusterCatalog) error { return os.RemoveAll(filepath.Join(i.BaseCachePath, catalog.Name)) } -func unpackedResult(fsys fs.FS, catalog *catalogdv1alpha1.ClusterCatalog, ref string, lastUnpacked metav1.Time) *Result { +func unpackedResult(fsys fs.FS, catalog *catalogdv1.ClusterCatalog, ref string, lastUnpacked metav1.Time) *Result { return &Result{ FS: fsys, - ResolvedSource: &catalogdv1alpha1.ResolvedCatalogSource{ - Type: catalogdv1alpha1.SourceTypeImage, - Image: &catalogdv1alpha1.ResolvedImageSource{ + ResolvedSource: &catalogdv1.ResolvedCatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ResolvedImageSource{ Ref: catalog.Spec.Source.Image.Ref, ResolvedRef: ref, LastPollAttempt: metav1.Time{Time: time.Now()}, diff --git a/internal/source/image_registry_client_test.go b/internal/source/image_registry_client_test.go index c2d20042..ef2380e2 100644 --- a/internal/source/image_registry_client_test.go +++ b/internal/source/image_registry_client_test.go @@ -12,7 +12,7 @@ import ( "github.com/google/go-containerregistry/pkg/name" "github.com/google/go-containerregistry/pkg/registry" - v1 "github.com/google/go-containerregistry/pkg/v1" + "github.com/google/go-containerregistry/pkg/v1" "github.com/google/go-containerregistry/pkg/v1/mutate" "github.com/google/go-containerregistry/pkg/v1/random" "github.com/google/go-containerregistry/pkg/v1/remote" @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/operator-framework/catalogd/api/core/v1alpha1" + catalogdv1 "github.com/operator-framework/catalogd/api/core/v1" catalogderrors "github.com/operator-framework/catalogd/internal/errors" "github.com/operator-framework/catalogd/internal/source" ) @@ -32,7 +32,7 @@ func TestImageRegistry(t *testing.T) { // if the Catalog.Spec.Source.Image.Ref field is empty, // one is injected during test runtime to ensure it // points to the registry created for the test - catalog *v1alpha1.ClusterCatalog + catalog *catalogdv1.ClusterCatalog wantErr bool unrecoverable bool image v1.Image @@ -44,13 +44,13 @@ func TestImageRegistry(t *testing.T) { }{ { name: ".spec.source.image is nil", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, Image: nil, }, }, @@ -61,14 +61,14 @@ func TestImageRegistry(t *testing.T) { }, { name: ".spec.source.image.ref is unparsable", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "::)12-as^&8asd789A(::", }, }, @@ -80,14 +80,14 @@ func TestImageRegistry(t *testing.T) { }, { name: "tag based, image is missing required label", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "", }, }, @@ -105,14 +105,14 @@ func TestImageRegistry(t *testing.T) { }, { name: "digest based, image is missing required label", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "", }, }, @@ -131,14 +131,14 @@ func TestImageRegistry(t *testing.T) { }, { name: "image doesn't exist", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "", }, }, @@ -149,14 +149,14 @@ func TestImageRegistry(t *testing.T) { }, { name: "tag based image, digest already exists in cache", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "", }, }, @@ -175,14 +175,14 @@ func TestImageRegistry(t *testing.T) { }, { name: "digest based image, digest already exists in cache", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "", }, }, @@ -201,14 +201,14 @@ func TestImageRegistry(t *testing.T) { }, { name: "old ref is cached", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "", }, }, @@ -235,14 +235,14 @@ func TestImageRegistry(t *testing.T) { }, { name: "tag ref, happy path", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "", }, }, @@ -268,14 +268,14 @@ func TestImageRegistry(t *testing.T) { }, { name: "digest ref, happy path", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "", }, }, @@ -301,14 +301,14 @@ func TestImageRegistry(t *testing.T) { }, { name: "digest ref, insecure specified, happy path", - catalog: &v1alpha1.ClusterCatalog{ + catalog: &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: "", InsecureSkipTLSVerify: true, }, @@ -441,14 +441,14 @@ func TestImageRegistryMissingLabelConsistentFailure(t *testing.T) { err = remote.Write(imgName, image) require.NoError(t, err) - catalog := &v1alpha1.ClusterCatalog{ + catalog := &catalogdv1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.ClusterCatalogSpec{ - Source: v1alpha1.CatalogSource{ - Type: v1alpha1.SourceTypeImage, - Image: &v1alpha1.ImageSource{ + Spec: catalogdv1.ClusterCatalogSpec{ + Source: catalogdv1.CatalogSource{ + Type: catalogdv1.SourceTypeImage, + Image: &catalogdv1.ImageSource{ Ref: imgName.Name(), }, }, diff --git a/internal/source/unpacker.go b/internal/source/unpacker.go index f2ca09a2..b51d3481 100644 --- a/internal/source/unpacker.go +++ b/internal/source/unpacker.go @@ -7,7 +7,7 @@ import ( "os" "path" - catalogdv1alpha1 "github.com/operator-framework/catalogd/api/core/v1alpha1" + catalogdv1 "github.com/operator-framework/catalogd/api/core/v1" ) // TODO: This package is almost entirely copy/pasted from rukpak. We should look @@ -31,8 +31,8 @@ import ( // specifications. A source should treat a catalog root directory as an opaque // file tree and delegate catalog format concerns to catalog parsers. type Unpacker interface { - Unpack(context.Context, *catalogdv1alpha1.ClusterCatalog) (*Result, error) - Cleanup(context.Context, *catalogdv1alpha1.ClusterCatalog) error + Unpack(context.Context, *catalogdv1.ClusterCatalog) (*Result, error) + Cleanup(context.Context, *catalogdv1.ClusterCatalog) error } // Result conveys progress information about unpacking catalog content. @@ -49,7 +49,7 @@ type Result struct { // For example, resolved image sources should reference a container image // digest rather than an image tag, and git sources should reference a // commit hash rather than a branch or tag. - ResolvedSource *catalogdv1alpha1.ResolvedCatalogSource + ResolvedSource *catalogdv1.ResolvedCatalogSource // State is the current state of unpacking the catalog content. State State @@ -76,16 +76,16 @@ const ( ) type unpacker struct { - sources map[catalogdv1alpha1.SourceType]Unpacker + sources map[catalogdv1.SourceType]Unpacker } // NewUnpacker returns a new composite Source that unpacks catalogs using the source // mapping provided by the configured sources. -func NewUnpacker(sources map[catalogdv1alpha1.SourceType]Unpacker) Unpacker { +func NewUnpacker(sources map[catalogdv1.SourceType]Unpacker) Unpacker { return &unpacker{sources: sources} } -func (s *unpacker) Unpack(ctx context.Context, catalog *catalogdv1alpha1.ClusterCatalog) (*Result, error) { +func (s *unpacker) Unpack(ctx context.Context, catalog *catalogdv1.ClusterCatalog) (*Result, error) { source, ok := s.sources[catalog.Spec.Source.Type] if !ok { return nil, fmt.Errorf("source type %q not supported", catalog.Spec.Source.Type) @@ -95,7 +95,7 @@ func (s *unpacker) Unpack(ctx context.Context, catalog *catalogdv1alpha1.Cluster // TODO: Generalize the cleanup logic for the Unpacker so that cleanup // logic isn't specific to individual source types. -func (s *unpacker) Cleanup(ctx context.Context, catalog *catalogdv1alpha1.ClusterCatalog) error { +func (s *unpacker) Cleanup(ctx context.Context, catalog *catalogdv1.ClusterCatalog) error { source, ok := s.sources[catalog.Spec.Source.Type] if !ok { return fmt.Errorf("source type %q not supported", catalog.Spec.Source.Type) @@ -116,8 +116,8 @@ func NewDefaultUnpacker(namespace, cacheDir string) (Unpacker, error) { return nil, fmt.Errorf("creating unpack cache directory: %w", err) } - return NewUnpacker(map[catalogdv1alpha1.SourceType]Unpacker{ - catalogdv1alpha1.SourceTypeImage: &ImageRegistry{ + return NewUnpacker(map[catalogdv1.SourceType]Unpacker{ + catalogdv1.SourceTypeImage: &ImageRegistry{ BaseCachePath: unpackPath, AuthNamespace: namespace, }, diff --git a/internal/webhook/cluster_catalog_webhook.go b/internal/webhook/cluster_catalog_webhook.go index a938673a..35cf579e 100644 --- a/internal/webhook/cluster_catalog_webhook.go +++ b/internal/webhook/cluster_catalog_webhook.go @@ -8,21 +8,21 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/log" - "github.com/operator-framework/catalogd/api/core/v1alpha1" + "github.com/operator-framework/catalogd/api/core/v1" ) -// +kubebuilder:webhook:admissionReviewVersions={v1},failurePolicy=Fail,groups=olm.operatorframework.io,mutating=true,name=inject-metadata-name.olm.operatorframework.io,path=/mutate-olm-operatorframework-io-v1alpha1-clustercatalog,resources=clustercatalogs,verbs=create;update,versions=v1alpha1,sideEffects=None,timeoutSeconds=10 +// +kubebuilder:webhook:admissionReviewVersions={v1},failurePolicy=Fail,groups=olm.operatorframework.io,mutating=true,name=inject-metadata-name.olm.operatorframework.io,path=/mutate-olm-operatorframework-io-v1-clustercatalog,resources=clustercatalogs,verbs=create;update,versions=v1F,sideEffects=None,timeoutSeconds=10 // +kubebuilder:rbac:groups=olm.operatorframework.io,resources=clustercatalogs,verbs=get;list;watch;patch;update -// ClusterCatalog wraps the external v1alpha1.ClusterCatalog type and implements admission.Defaulter +// ClusterCatalog wraps the external v1.ClusterCatalog type and implements admission.Defaulter type ClusterCatalog struct{} // Default is the method that will be called by the webhook to apply defaults. func (r *ClusterCatalog) Default(ctx context.Context, obj runtime.Object) error { log := log.FromContext(ctx) log.Info("Invoking Default method for ClusterCatalog", "object", obj) - catalog, ok := obj.(*v1alpha1.ClusterCatalog) + catalog, ok := obj.(*v1.ClusterCatalog) if !ok { return fmt.Errorf("expected a ClusterCatalog but got a %T", obj) } @@ -31,8 +31,8 @@ func (r *ClusterCatalog) Default(ctx context.Context, obj runtime.Object) error if catalog.Labels == nil { catalog.Labels = map[string]string{} } - catalog.Labels[v1alpha1.MetadataNameLabel] = catalog.GetName() - log.Info("default", v1alpha1.MetadataNameLabel, catalog.Name, "labels", catalog.Labels) + catalog.Labels[v1.MetadataNameLabel] = catalog.GetName() + log.Info("default", v1.MetadataNameLabel, catalog.Name, "labels", catalog.Labels) return nil } @@ -40,7 +40,7 @@ func (r *ClusterCatalog) Default(ctx context.Context, obj runtime.Object) error // SetupWebhookWithManager sets up the webhook with the manager func (r *ClusterCatalog) SetupWebhookWithManager(mgr ctrl.Manager) error { return ctrl.NewWebhookManagedBy(mgr). - For(&v1alpha1.ClusterCatalog{}). + For(&v1.ClusterCatalog{}). WithDefaulter(r). Complete() } diff --git a/internal/webhook/cluster_catalog_webhook_test.go b/internal/webhook/cluster_catalog_webhook_test.go index 50aeb9bb..a81b82e9 100644 --- a/internal/webhook/cluster_catalog_webhook_test.go +++ b/internal/webhook/cluster_catalog_webhook_test.go @@ -8,7 +8,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "github.com/operator-framework/catalogd/api/core/v1alpha1" + "github.com/operator-framework/catalogd/api/core/v1" ) // Define a dummy struct that implements runtime.Object but isn't a ClusterCatalog @@ -29,7 +29,7 @@ func TestClusterCatalogDefaulting(t *testing.T) { errorMessage string }{ "no labels provided, name label added": { - clusterCatalog: &v1alpha1.ClusterCatalog{ + clusterCatalog: &v1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", }, @@ -40,7 +40,7 @@ func TestClusterCatalogDefaulting(t *testing.T) { expectError: false, }, "labels already present, name label added": { - clusterCatalog: &v1alpha1.ClusterCatalog{ + clusterCatalog: &v1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Labels: map[string]string{ @@ -55,7 +55,7 @@ func TestClusterCatalogDefaulting(t *testing.T) { expectError: false, }, "name label already present, no changes": { - clusterCatalog: &v1alpha1.ClusterCatalog{ + clusterCatalog: &v1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Labels: map[string]string{ @@ -96,7 +96,7 @@ func TestClusterCatalogDefaulting(t *testing.T) { } else { assert.NoError(t, err) if tc.expectedLabels != nil { - labels := tc.clusterCatalog.(*v1alpha1.ClusterCatalog).Labels + labels := tc.clusterCatalog.(*v1.ClusterCatalog).Labels assert.Equal(t, tc.expectedLabels, labels) } } diff --git a/pprof/README.md b/pprof/README.md index 9e8b7db5..e782ac60 100644 --- a/pprof/README.md +++ b/pprof/README.md @@ -4,7 +4,7 @@ > This pprof data is based on early versions of catalogd and has not been updated since. The data is likely not accurate anymore. > A decision about removing or updating this data will be made in the future. -This folder contains some profiles that can be read using [pprof](https://github.com/google/pprof) to show how the core kubernetes apiserver and the custom catalogd apiserver CPU & Memory utilization is affected by the creation and reconciliation of the sample `Catalog` CR found at `../config/samples/core_v1alpha1_catalog.yaml`. +This folder contains some profiles that can be read using [pprof](https://github.com/google/pprof) to show how the core kubernetes apiserver and the custom catalogd apiserver CPU & Memory utilization is affected by the creation and reconciliation of the sample `Catalog` CR found at `../config/samples/core_v1_clustercatalog.yaml`. Instead of providing static screenshots and losing the interactivity associated with these `pprof` profiles, each of the files with the extension `.pb` can be used to view the profiles that were the result of running `pprof` against the live processes. @@ -85,7 +85,7 @@ This section is being added as the pprof metrics don't necessarily show the whol This image shows the spike in CPU utilization and the increase in Memory consumption. In this scenario, the command: ``` -kubectl apply -f config/samples/core_v1alpha1_catalog.yaml +kubectl apply -f config/samples/core_v1_clustercatalog.yaml ``` was run right at 1:44 PM. @@ -112,7 +112,7 @@ With this, we can see that without the catalogd apiserver the core kube-apiserve This image shows the spike in CPU utilization and the increase in Memory consumption. In this scenario, the command: ``` -kubectl apply -f config/samples/core_v1alpha1_catalog.yaml +kubectl apply -f config/samples/core_v1_clustercatalog.yaml ``` was run right at 3:06 PM @@ -139,7 +139,7 @@ With this, we can see that with the catalogd apiserver the core kube-apiserver h This image shows the spike in CPU utilization and the increase in Memory consumption. In this scenario, the command: ``` -kubectl apply -f config/samples/core_v1alpha1_catalog.yaml +kubectl apply -f config/samples/core_v1_clustercatalog.yaml ``` was run right at 3:06 PM @@ -174,7 +174,7 @@ Overall, when running both the kube-apiserver and the catalogd apiserver the tot This image shows the spike in CPU utilization and the increase in Memory consumption. In this scenario, the command: ``` -kubectl apply -f config/samples/core_v1alpha1_catalog.yaml +kubectl apply -f config/samples/core_v1_clustercatalog.yaml ``` was run right at 3:06 PM diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 4f2e10f9..249e27b9 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -13,7 +13,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" + catalogd "github.com/operator-framework/catalogd/api/core/v1" ) var ( diff --git a/test/e2e/unpack_test.go b/test/e2e/unpack_test.go index d0f0d201..f89247b2 100644 --- a/test/e2e/unpack_test.go +++ b/test/e2e/unpack_test.go @@ -13,7 +13,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" + catalogd "github.com/operator-framework/catalogd/api/core/v1" ) const ( diff --git a/test/e2e/util.go b/test/e2e/util.go index a5a6ac1d..0239c05f 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -10,7 +10,7 @@ import ( "k8s.io/client-go/kubernetes" "sigs.k8s.io/controller-runtime/pkg/client" - catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" + catalogd "github.com/operator-framework/catalogd/api/core/v1" ) func ReadTestCatalogServerContents(ctx context.Context, catalog *catalogd.ClusterCatalog, c client.Client, kubeClient kubernetes.Interface) ([]byte, error) { diff --git a/test/tools/imageregistry/pre-upgrade-setup.sh b/test/tools/imageregistry/pre-upgrade-setup.sh index c1d74d1e..66005e21 100755 --- a/test/tools/imageregistry/pre-upgrade-setup.sh +++ b/test/tools/imageregistry/pre-upgrade-setup.sh @@ -20,7 +20,7 @@ export TEST_CLUSTER_CATALOG_IMAGE=$1 export TEST_CLUSTER_CATALOG_NAME=$2 kubectl apply -f - << EOF -apiVersion: olm.operatorframework.io/v1alpha1 +apiVersion: olm.operatorframework.io/v1 kind: ClusterCatalog metadata: name: ${TEST_CLUSTER_CATALOG_NAME} diff --git a/test/upgrade/unpack_test.go b/test/upgrade/unpack_test.go index 83dcaba4..58cfa6d2 100644 --- a/test/upgrade/unpack_test.go +++ b/test/upgrade/unpack_test.go @@ -12,7 +12,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" + catalogd "github.com/operator-framework/catalogd/api/core/v1" "github.com/operator-framework/catalogd/test/e2e" ) diff --git a/test/upgrade/upgrade_suite_test.go b/test/upgrade/upgrade_suite_test.go index a7d332ae..03a9ea9b 100644 --- a/test/upgrade/upgrade_suite_test.go +++ b/test/upgrade/upgrade_suite_test.go @@ -14,7 +14,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" + catalogd "github.com/operator-framework/catalogd/api/core/v1" ) const (