Skip to content
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

Handle channelName #172

Merged
merged 6 commits into from
Apr 21, 2023
Merged

Handle channelName #172

merged 6 commits into from
Apr 21, 2023

Conversation

tmshort
Copy link
Contributor

@tmshort tmshort commented Apr 18, 2023

Adds backend support for channelName

Fixes #170
Fixes OPRUN-2917

Signed-off-by: Todd Short <tshort@redhat.com>
Signed-off-by: Todd Short <tshort@redhat.com>
@tmshort
Copy link
Contributor Author

tmshort commented Apr 18, 2023

I am a bit concerned about item 6 in #163:

  1. Edit the Operator object and change the channel to strimzi-0.33.x

This channel name doesn't match what was merged in #171, so I might need to update the regex.

@grokspawn
Copy link
Contributor

grokspawn commented Apr 18, 2023

I am a bit concerned about item 6 in #163:

  1. Edit the Operator object and change the channel to strimzi-0.33.x

This channel name doesn't match what was merged in #171, so I might need to update the regex.

It looks like opm would have an issue with the regex w.r.t. semver catalog template generating minor version channels: https://olm.operatorframework.io/docs/reference/catalog-templates/#example-1 (actually, the last output block).

For e.g.

---
entries:
  - name: testoperator.v1.0.1
name: fast-v1.0
package: testoperator
schema: olm.channel
---
entries:
  - name: testoperator.v1.1.0
    replaces: testoperator.v1.0.1
name: fast-v1.1
package: testoperator
schema: olm.channel
---
entries:
  - name: testoperator.v1.0.1
name: stable-v1.0
package: testoperator
schema: olm.channel

Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

Just a few (hopefully small) suggestions, but I think this looks good overall.

I opened a follow-up issue (#176) that captures (as best I can) the topic I brought up in the WG meeting about avoiding putting channel metadata into bundle entities. That's definitely out of scope for this milestone though, so I don't want to distract from the task at hand.

BeforeEach(func() {
By("initializing cluster state")
pkgName = "prometheus"
pkgVer = "0.47.0"
Copy link
Member

Choose a reason for hiding this comment

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

Should we leave the version unset for the base spec.channel tests so we can isolate the behavior we're expecting and avoid side effects from setting the version?

(We should probably also have tests where both are set to test for interactions, but I think that's outside the scope of this PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's easy enough to copy/paste the test w/o the package version.

Expect(cond).NotTo(BeNil())
Expect(cond.Status).To(Equal(metav1.ConditionFalse))
Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonResolutionFailed))
Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' at version '%s' not found", pkgName, pkgVer)))
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a confusing message. The version exists, but just not in this channel. Do we need to update the notFoundError() in required_package.go to make the error more clear?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I though the message ought to include the channel as well, that might require updating other tests.

Copy link
Member

Choose a reason for hiding this comment

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

Based on how notFoundError() appears to work currently, the version aspect of the error only shows up when the version is set. I figure we can do a similar thing for channels.

We should handle both being set as well and try to come up with a coherent message in that case, but again, not super concerned with that in this particular PR. Do it if it's easy, but if handling it seems hard or contentious, then add a TODO comment and GH issue and move on without it. My two cents at least.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Todd Short <tshort@redhat.com>
Signed-off-by: Todd Short <tshort@redhat.com>
Signed-off-by: Todd Short <tshort@redhat.com>
Expect(cond).NotTo(BeNil())
Expect(cond.Status).To(Equal(metav1.ConditionUnknown))
Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonInstallationStatusUnknown))
Expect(cond.Message).To(ContainSubstring("waiting for BundleDeployment"))
Copy link
Member

@joelanford joelanford Apr 19, 2023

Choose a reason for hiding this comment

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

For the success cases, can we also fetch the expected Bundle Deployment and check the .spec.source.image.ref?

Signed-off-by: Todd Short <tshort@redhat.com>
@tmshort
Copy link
Contributor Author

tmshort commented Apr 19, 2023

The channel name regex is now this:

^[a-z0-9]+([\.-][a-z0-9]+)*$

Which out to allow for the channel names, but might be too flexible?

Copy link
Contributor

@perdasilva perdasilva left a comment

Choose a reason for hiding this comment

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

Nice one, thank you!!

@perdasilva
Copy link
Contributor

The channel name regex is now this:

^[a-z0-9]+([\.-][a-z0-9]+)*$

Which out to allow for the channel names, but might be too flexible?

I think this fine to start with. We'll probably have to have a few discussions around channels and what they ought to look like in v1. Looking at the tests, I think this is a great start. If we find we need to lock it down further, once we know what we want, we can just revisit this. Really nice PR! Thank you ^^

@perdasilva
Copy link
Contributor

@tmshort maybe wait on @joelanford or @grokspawn to sign off before merging? Just in case I've missed something =S

@tmshort
Copy link
Contributor Author

tmshort commented Apr 20, 2023

@joelanford @grokspawn you good with this?
I grabbed the demo script from @perdasilva and modified it to work with channel names per #163

Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

🚀

@tmshort tmshort merged commit 4cd2f82 into operator-framework:main Apr 21, 2023
@tmshort tmshort deleted the issue-170 branch April 21, 2023 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Operator-Controller resolution considers spec.channel
4 participants