-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix(olm): remove dependency on marketplace-provided content #26993
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,25 +240,25 @@ var _ = g.Describe("[sig-operator] an end user can use OLM", func() { | |
| oc = exutil.NewCLI("olm-23440") | ||
|
|
||
| buildPruningBaseDir = exutil.FixturePath("testdata", "olm") | ||
| operatorGroup = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") | ||
| sub = filepath.Join(buildPruningBaseDir, "subscription.yaml") | ||
| ogPath = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") | ||
| subPath = filepath.Join(buildPruningBaseDir, "subscription.yaml") | ||
| catalogPath = filepath.Join(buildPruningBaseDir, "catalogsource.yaml") | ||
| ) | ||
|
|
||
| files := []string{sub} | ||
| g.It("can subscribe to the operator", func() { | ||
| g.By("Cluster-admin user subscribe the operator resource") | ||
|
|
||
| // skip test if redhat-operators is not present or disabled | ||
| ok, err := hasRedHatOperatorsSource(oc) | ||
| // Configure OperatorGroup before tests | ||
| og, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", ogPath, "-p", "NAME=test-operator", fmt.Sprintf("NAMESPACE=%s", oc.Namespace())).OutputToFile("og.json") | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-f", og).Execute() | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| if !ok { | ||
| g.Skip("redhat-operators source not found in enabled sources") | ||
| } | ||
|
|
||
| // configure OperatorGroup before tests | ||
| configFile, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", operatorGroup, "-p", "NAME=test-operator", fmt.Sprintf("NAMESPACE=%s", oc.Namespace())).OutputToFile("config.json") | ||
| // Configure CatalogSource before tests | ||
| const image = "registry.redhat.io/redhat/redhat-operator-index:v4.10" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is going to be a source of bit-rot someday. can we identify the clusterversion and pick the version tag based on that, dynamically?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or pull the value in from elsewhere? (i know we also have the challenge that the day we start v4.12, there may not be a v4.12 catalog published, so that could be a problem too... maybe n-1 is the tag to use)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've asked the same questions before and I think the long-term solution is for the catalog fixture to be built as a part of the test setup.
I like this, but it seems like we'd just be shifting the problem over one release; i.e. when we're testing 4.12, if we grabbed the n-1 tag, we'd be assuming the same image name and convention were carried over from 4.10 to 4.11 (since the test in 4.11 points at the image in 4.10) -- moreover, we'd still inherit the primary issue of today's tests: there's no guarantee that the content we're using as a fixture hasn't changed.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah i guess maybe pinning to 4.10 and if someday that breaks on a v4.16 cluster, we can bump it at that point, is the most straightforward answer for now. not ideal, but not worth holding this up over. |
||
| catalog, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", catalogPath, "-p", "NAME=test-catalog", fmt.Sprintf("NAMESPACE=%s", oc.Namespace()), fmt.Sprintf("IMAGE=%s", image)).OutputToFile("catalog.json") | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-f", configFile).Execute() | ||
| err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-f", catalog).Execute() | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| o.Eventually(func() []string { | ||
|
|
@@ -286,12 +286,10 @@ var _ = g.Describe("[sig-operator] an end user can use OLM", func() { | |
| return parsed.Status.Namespaces | ||
| }, 5*time.Minute, time.Second).Should(o.Equal([]string{""})) | ||
|
|
||
| for _, v := range files { | ||
| configFile, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", v, "-p", "NAME=test-operator", fmt.Sprintf("NAMESPACE=%s", oc.Namespace()), "SOURCENAME=redhat-operators", "SOURCENAMESPACE=openshift-marketplace", "PACKAGE=cluster-logging", "CHANNEL=stable").OutputToFile("config.json") | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-f", configFile).Execute() | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| } | ||
| sub, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", subPath, "-p", "NAME=test-operator", fmt.Sprintf("NAMESPACE=%s", oc.Namespace()), "SOURCENAME=test-catalog", fmt.Sprintf("SOURCENAMESPACE=%s", oc.Namespace()), "PACKAGE=cluster-logging", "CHANNEL=stable").OutputToFile("sub.json") | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-f", sub).Execute() | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| var current string | ||
| o.Eventually(func() string { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| apiVersion: template.openshift.io/v1 | ||
| kind: Template | ||
| metadata: | ||
| name: catalogsource-template | ||
| objects: | ||
| - apiVersion: operators.coreos.com/v1alpha1 | ||
| kind: CatalogSource | ||
| metadata: | ||
| name: "${NAME}" | ||
| namespace: "${NAMESPACE}" | ||
| spec: | ||
| sourceType: grpc | ||
| image: "${IMAGE}" | ||
| parameters: | ||
| - name: NAME | ||
| - name: NAMESPACE | ||
| - name: IMAGE | ||
|
njhale marked this conversation as resolved.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be concerned that this check was not working? Does that mean we're not actually disabling some aspect of the redhat-operators source when marketplace is not enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was testing the OperatorHub API, which still exists as part of a separate problem that I'm currently tracking -- I'll post a PR here when there are more updates.