Skip to content

Explicitly override the global catalog namespace #345

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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ e2e/operator-registry: ## Run e2e registry tests
$(MAKE) e2e WHAT=operator-registry

e2e/olm: ## Run e2e olm tests
$(MAKE) e2e WHAT=operator-lifecycle-manager E2E_INSTALL_NS=openshift-operator-lifecycle-manager E2E_TEST_NS=openshift-operators E2E_TIMEOUT=120m KUBECTL=oc
$(MAKE) e2e WHAT=operator-lifecycle-manager E2E_CATALOG_NS=openshift-marketplace E2E_INSTALL_NS=openshift-operator-lifecycle-manager E2E_TEST_NS=openshift-operators E2E_TIMEOUT=120m KUBECTL=oc

.PHONY: vendor
vendor:
Expand Down
3 changes: 2 additions & 1 deletion staging/operator-lifecycle-manager/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)
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 staging/operator-lifecycle-manager/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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,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 Expand Up @@ -105,7 +105,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
When("the operator group is annotated with olm.operatorframework.io/exclude-global-namespace-resolution=true", func() {
// Note: this test flakes on openshift CI but passes running on a local openshift cluster
// For some reason, the subscription does not transition to a failed state in time
It("[FLAKE] the broken subscription should resolve and have state AtLatest", func() {
It("the broken subscription should resolve and have state AtLatest", func() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this was massaged into the original commit that downstreaming the global catalog exclusion work from upstream. This was added as a downstream-only change that I missed when originally opening the PR.

By("checking that the subscription is not resolving and has a condition with type ResolutionFailed")
EventuallyResource(subscription, 5*time.Minute).Should(ContainSubscriptionConditionOfType(v1alpha1.SubscriptionResolutionFailed))

Expand Down
5 changes: 5 additions & 0 deletions staging/operator-lifecycle-manager/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