Skip to content

Commit db08a62

Browse files
authored
Remove the final bits of references to the old catalogd Package and BundleMetadata APIs (#372)
Signed-off-by: Joe Lanford <[email protected]>
1 parent 9d07bb1 commit db08a62

File tree

5 files changed

+7
-55
lines changed

5 files changed

+7
-55
lines changed

config/rbac/role.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ rules:
1818
verbs:
1919
- list
2020
- watch
21-
- apiGroups:
22-
- catalogd.operatorframework.io
23-
resources:
24-
- packages
25-
verbs:
26-
- list
27-
- watch
2821
- apiGroups:
2922
- core.rukpak.io
3023
resources:

internal/controllers/operator_controller.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ type OperatorReconciler struct {
6262

6363
//+kubebuilder:rbac:groups=core.rukpak.io,resources=bundledeployments,verbs=get;list;watch;create;update;patch
6464

65-
//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=packages,verbs=list;watch
6665
//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=catalogs,verbs=list;watch
6766
//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=catalogmetadata,verbs=list;watch
6867

test/e2e/e2e_suite_test.go

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,15 @@ var _ = BeforeSuite(func() {
6868
operatorCatalog, err = createTestCatalog(ctx, testCatalogName, getCatalogImageRef())
6969
Expect(err).ToNot(HaveOccurred())
7070

71+
// TODO: REMOVE THIS. This should not be necessary if we have idiomatic APIs. Kubernetes is supposed
72+
// to be eventually consistent. Waits for preconditions like this hide bugs.
7173
Eventually(func(g Gomega) {
7274
err := c.Get(ctx, types.NamespacedName{Name: operatorCatalog.Name}, operatorCatalog)
7375
g.Expect(err).ToNot(HaveOccurred())
7476
cond := apimeta.FindStatusCondition(operatorCatalog.Status.Conditions, catalogd.TypeUnpacked)
7577
g.Expect(cond).ToNot(BeNil())
7678
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
7779
g.Expect(cond.Reason).To(Equal(catalogd.ReasonUnpackSuccessful))
78-
79-
// Ensure some packages exist before continuing so the
80-
// operators don't get stuck in a bad state
81-
pList := &catalogd.PackageList{}
82-
err = c.List(ctx, pList)
83-
g.Expect(err).ToNot(HaveOccurred())
84-
g.Expect(pList.Items).To(HaveLen(2))
8580
}).Should(Succeed())
8681
})
8782

@@ -95,23 +90,13 @@ var _ = AfterSuite(func() {
9590
}).Should(Succeed())
9691

9792
// speed up delete without waiting for gc
98-
Expect(c.DeleteAllOf(ctx, &catalogd.Package{})).To(Succeed())
99-
Expect(c.DeleteAllOf(ctx, &catalogd.BundleMetadata{})).To(Succeed())
10093
Expect(c.DeleteAllOf(ctx, &catalogd.CatalogMetadata{})).To(Succeed())
10194

10295
Eventually(func(g Gomega) {
10396
// ensure resource cleanup
104-
packages := &catalogd.PackageList{}
105-
g.Expect(c.List(ctx, packages)).To(Succeed())
106-
g.Expect(packages.Items).To(BeEmpty())
107-
108-
bmd := &catalogd.BundleMetadataList{}
109-
g.Expect(c.List(ctx, bmd)).To(Succeed())
110-
g.Expect(bmd.Items).To(BeEmpty())
111-
11297
cmd := &catalogd.CatalogMetadataList{}
11398
g.Expect(c.List(ctx, cmd)).To(Succeed())
114-
g.Expect(bmd.Items).To(BeEmpty())
99+
g.Expect(cmd.Items).To(BeEmpty())
115100
}).Should(Succeed())
116101
})
117102

test/e2e/install_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
. "github.com/onsi/ginkgo/v2"
88
. "github.com/onsi/gomega"
99
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
10+
"github.com/operator-framework/operator-registry/alpha/declcfg"
1011
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
1112
"k8s.io/apimachinery/pkg/api/errors"
1213
apimeta "k8s.io/apimachinery/pkg/api/meta"
@@ -127,7 +128,7 @@ var _ = Describe("Operator Install", func() {
127128

128129
Eventually(func(g Gomega) {
129130
// target package should not be present on cluster
130-
err := c.Get(ctx, types.NamespacedName{Name: pkgName}, &catalogd.Package{})
131+
err := c.Get(ctx, types.NamespacedName{Name: fmt.Sprintf("%s-%s-%s", operatorCatalog.Name, declcfg.SchemaPackage, pkgName)}, &catalogd.CatalogMetadata{})
131132
g.Expect(errors.IsNotFound(err)).To(BeTrue())
132133
}).Should(Succeed())
133134

test/operator-framework-e2e/operator_framework_test.go

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -825,14 +825,8 @@ func createCatalogCheckResources(operatorCatalog *catalogd.Catalog, catalogDInfo
825825
g.Expect(err).ToNot(HaveOccurred())
826826
}, 2*time.Minute, 1).Should(Succeed())
827827

828-
// checking if the packages are created
829-
Eventually(func(g Gomega) {
830-
err = validatePackageCreation(operatorCatalog, catalogDInfo.operatorName)
831-
g.Expect(err).ToNot(HaveOccurred())
832-
}, 2*time.Minute, 1).Should(Succeed())
833-
834-
// checking if the bundle metadatas are created
835-
By("Eventually checking if bundle metadata is created")
828+
// checking if the catalog metadatas are created
829+
By("Eventually checking if catalog metadata is created")
836830
Eventually(func(g Gomega) {
837831
validateCatalogMetadataCreation(g, operatorCatalog, catalogDInfo.operatorName, bundleVersions)
838832
}).Should(Succeed())
@@ -866,26 +860,6 @@ func checkOperatorOperationsSuccess(operator *operatorv1alpha1.Operator, pkgName
866860
}).Should(Succeed())
867861
}
868862

869-
// Checks if the packages are created from the catalog and returns error if not.
870-
// The expected pkgName is taken as input and is compared against the packages collected whose catalog name
871-
// matches the catalog under consideration.
872-
func validatePackageCreation(operatorCatalog *catalogd.Catalog, pkgName string) error {
873-
var pkgCollected string
874-
pList := &catalogd.PackageList{}
875-
if err := c.List(ctx, pList); err != nil {
876-
return fmt.Errorf("Error retrieving the packages after %v catalog instance creation: %v", operatorCatalog.Name, err)
877-
}
878-
for _, pack := range pList.Items {
879-
if pack.Spec.Catalog.Name == operatorCatalog.Name {
880-
pkgCollected = pack.Spec.Name
881-
}
882-
}
883-
if pkgCollected != pkgName {
884-
return fmt.Errorf("Package %v for the catalog %v is not created", pkgName, operatorCatalog.Name)
885-
}
886-
return nil
887-
}
888-
889863
// Checks if the CatalogMetadata was created from the catalog and returns error if not.
890864
// The expected pkgNames and their versions are taken as input. This is then compared against the collected bundle versions.
891865
// The collected bundle versions are formed by reading the version from "olm.package" property type whose catalog name

0 commit comments

Comments
 (0)