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

⚠️ API updates based on external review #443

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

everettraven
Copy link
Collaborator

No description provided.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 22, 2024
Comment on lines 194 to 195
// +kubebuilder:validation:XValidation:rule="isURL(self.base)",message="base must be a valid URL"
// +kubebuilder:validation:XValidation:rule="url(self.base).getScheme() == \"http\" || url(self.base).getScheme == \"https\"",message="scheme must be one of [http, https]"
Copy link
Member

Choose a reason for hiding this comment

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

Can these go on the Base string definition instead of the struct?

Copy link
Member

Choose a reason for hiding this comment

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

Depending on where these validations end up, also be cognizant of the message. For example:

  • If the validation is on the ClusterCatalogURLs struct, then the message needs to reference the field base by name.
  • If the validation is on the Base string field, then the apiserver will construct a prefix on our message that includes the base field name. Therefore we don't need to repeat base in the message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe they have to go on the struct for CEL validations.

Copy link
Collaborator Author

@everettraven everettraven Oct 28, 2024

Choose a reason for hiding this comment

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

I will update all the CEL messages to have a reference to the field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Turns out that you can do this and I totally overlooked that it could. I'm happy to move all CEL validations to the individual fields , where it makes sense, if that is preferred.

//
// When omitted, the image will not be polled for new content.
// +kubebuilder:validation:Format:=duration
// +kubebuilder:validation:Minimum:=1
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we want to start off with a higher minimum? 1 minute feels very frequent.

Copy link
Member

Choose a reason for hiding this comment

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

The higher we go, the longer our operator-controller e2e test for "do we automatically upgrade when a catalog poll finds new content?" will take.

If we can come up with a way to make that test execute faster, I could see increasing this minimum.

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 82.22222% with 8 lines in your changes missing coverage. Please review.

Project coverage is 38.23%. Comparing base (9cf2e70) to head (6d09548).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/core/v1alpha1/zz_generated.deepcopy.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #443      +/-   ##
==========================================
+ Coverage   37.83%   38.23%   +0.40%     
==========================================
  Files          15       15              
  Lines        1208     1224      +16     
==========================================
+ Hits          457      468      +11     
- Misses        701      706       +5     
  Partials       50       50              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@everettraven everettraven changed the title wip: first pass at API changes from external review ⚠️ API updates based on external review Nov 5, 2024
@everettraven everettraven marked this pull request as ready for review November 6, 2024 17:04
@everettraven everettraven requested a review from a team as a code owner November 6, 2024 17:04
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 6, 2024
// These on-cluster components may do a variety of things with this information, such as
// presenting the content in a GUI dashboard or installing content from the catalog on the cluster.
// The catalog source must contain catalog metadata in the File-Based Catalog (FBC) format.
// For more information on FBC, see https://olm.operatorframework.io/docs/reference/file-based-catalogs/#docs.
Copy link
Member

Choose a reason for hiding this comment

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

I hope that we have a way to know when these URL links break.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't. I'm not sure it is the end of the world if they do break, but we control that docs site.

api/core/v1alpha1/clustercatalog_types.go Outdated Show resolved Hide resolved
@everettraven
Copy link
Collaborator Author

Note: go-apidiff and upgrade-e2e are expected to fail as we've made breaking changes to the API

joelanford
joelanford previously approved these changes Nov 6, 2024
// base is a cluster-internal URL that provides endpoints for
// accessing the content of the catalog.
//
// It is expected that client append the path for the endpoint they wish
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// It is expected that client append the path for the endpoint they wish
// It is expected that clients append the path for the endpoint they wish

// It is expected that client append the path for the endpoint they wish
// to access.
//
// Currently, only a single version of the is served and is accessible at the path
Copy link
Member

@joelanford joelanford Nov 6, 2024

Choose a reason for hiding this comment

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

Suggested change
// Currently, only a single version of the is served and is accessible at the path
// Currently, only a single API is served and is accessible at the path

// Currently, only a single version of the is served and is accessible at the path
// /api/v1.
//
// The endpoints served for v1 of the are:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// The endpoints served for v1 of the are:
// The endpoints served for the v1 API are:

joelanford
joelanford previously approved these changes Nov 6, 2024
Signed-off-by: everettraven <[email protected]>
Signed-off-by: Mikalai Radchuk <[email protected]>
m1kola
m1kola previously approved these changes Nov 7, 2024
Copy link
Member

@m1kola m1kola left a comment

Choose a reason for hiding this comment

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

make generate is missing it seems. Also we need to squash the commits. Other than that - I think it is ready to go.

@m1kola m1kola dismissed stale reviews from joelanford and themself via 6d09548 November 7, 2024 10:22
Copy link
Member

@m1kola m1kola left a comment

Choose a reason for hiding this comment

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

Did make generate and 22 squashed commits into 1.

@m1kola m1kola added this pull request to the merge queue Nov 7, 2024
Merged via the queue into operator-framework:main with commit 20acf03 Nov 7, 2024
13 of 15 checks passed
@m1kola
Copy link
Member

m1kola commented Nov 7, 2024

v0.36.0 includes this PR

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.

5 participants