Skip to content

ci: Add support for configuring the global catalog namespace #2825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ TEST := $(shell go run ./test/e2e/split/... -chunks $(E2E_TEST_NUM_CHUNKS) -prin
endif
E2E_OPTS ?= $(if $(E2E_SEED),-seed '$(E2E_SEED)') $(if $(SKIP), -skip '$(SKIP)') $(if $(TEST),-focus '$(TEST)') $(if $(ARTIFACT_DIR), -output-dir $(ARTIFACT_DIR) -junit-report junit_e2e.xml) -flake-attempts $(E2E_FLAKE_ATTEMPTS) -nodes $(E2E_NODES) -timeout $(E2E_TIMEOUT) -v -randomize-suites -race -trace -progress
E2E_INSTALL_NS ?= operator-lifecycle-manager
E2E_CATALOG_NS ?= $(E2E_INSTALL_NS)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this to the same value as the OLM installation namespace is intention. This seemed like the best approach to reduce the amount of variables that needed to be overridden between the e2e and e2e-local targets. For upstream environments, you may only need to run make e2e E2E_CATALOG_NS=olm for clusters that were already created, and for the e2e-local target, it should be a no-op but there's no integration tests that can easily test all these configuration permutations.

E2E_TEST_NS ?= operators

e2e:
$(GINKGO) $(E2E_OPTS) $(or $(run), ./test/e2e) $< -- -namespace=$(E2E_TEST_NS) -olmNamespace=$(E2E_INSTALL_NS) -dummyImage=bitnami/nginx:latest $(or $(extra_args), -kubeconfig=${KUBECONFIG})
$(GINKGO) $(E2E_OPTS) $(or $(run), ./test/e2e) $< -- -namespace=$(E2E_TEST_NS) -olmNamespace=$(E2E_INSTALL_NS) -catalogNamespace=$(E2E_CATALOG_NS) -dummyImage=bitnami/nginx:latest $(or $(extra_args), -kubeconfig=${KUBECONFIG})

# See workflows/e2e-tests.yml See test/e2e/README.md for details.
.PHONY: e2e-local
Expand Down
13 changes: 1 addition & 12 deletions test/e2e/catalog_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,6 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
})

It("global update triggers subscription sync", func() {
globalNS := operatorNamespace

// Determine which namespace is global. Should be `openshift-marketplace` for OCP 4.2+.
// Locally it is `olm`
namespaces, _ := c.KubernetesInterface().CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{})
for _, ns := range namespaces.Items {
if ns.GetName() == "openshift-marketplace" {
globalNS = "openshift-marketplace"
}
}

mainPackageName := genName("nginx-")

mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName)
Expand Down Expand Up @@ -179,7 +168,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
}

// Create the initial catalog source
cs, cleanup := createInternalCatalogSource(c, crc, mainCatalogName, globalNS, mainManifests, []apiextensions.CustomResourceDefinition{mainCRD}, []v1alpha1.ClusterServiceVersion{mainCSV})
cs, cleanup := createInternalCatalogSource(c, crc, mainCatalogName, globalCatalogNamespace, mainManifests, []apiextensions.CustomResourceDefinition{mainCRD}, []v1alpha1.ClusterServiceVersion{mainCSV})
defer cleanup()

// Attempt to get the catalog source before creating install plan
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/catalog_exclusion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
globalCatalog := &v1alpha1.CatalogSource{
ObjectMeta: metav1.ObjectMeta{
Name: genName("bad-global-catalog-"),
Namespace: operatorNamespace,
Namespace: globalCatalogNamespace,
},
Spec: v1alpha1.CatalogSourceSpec{
DisplayName: "Broken Global Catalog Source",
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var (
olmNamespace = flag.String(
"olmNamespace", "", "namespace where olm is running")

catalogNamespace = flag.String(
"catalogNamespace", "", "namespace where the global catalog content is stored")

communityOperators = flag.String(
"communityOperators",
"quay.io/operator-framework/upstream-community-operators@sha256:098457dc5e0b6ca9599bd0e7a67809f8eca397907ca4d93597380511db478fec",
Expand Down Expand Up @@ -54,6 +57,7 @@ var (
testNamespace = ""
operatorNamespace = ""
communityOperatorsImage = ""
globalCatalogNamespace = ""
junitDir = "junit"
)

Expand Down Expand Up @@ -82,6 +86,7 @@ var _ = BeforeSuite(func() {
testNamespace = *namespace
operatorNamespace = *olmNamespace
communityOperatorsImage = *communityOperators
globalCatalogNamespace = *catalogNamespace
testdataDir = *testdataPath
deprovision = ctx.MustProvision(ctx.Ctx())
ctx.MustInstall(ctx.Ctx())
Expand Down