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-1835: manifestclient: allow listing only cluster-scoped-resources #1888

Merged

Conversation

p0lyn0mial
Copy link
Contributor

@p0lyn0mial p0lyn0mial commented Nov 21, 2024

a best effort to allowlist only cluster-scoped resources.

xref: openshift/multi-operator-manager#49

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 21, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Nov 21, 2024

@p0lyn0mial: This pull request references API-1835 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "4.18.0" version, but no target version was set.

In response to this:

a best effort to allowlist only cluster-scoped resources.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Nov 21, 2024

@p0lyn0mial: This pull request references API-1835 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "4.18.0" version, but no target version was set.

In response to this:

a best effort to allowlist only cluster-scoped resources.

xref: openshift/multi-operator-manager#49

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 21, 2024
@@ -241,7 +241,7 @@ func allPossibleListFileLocations(sourceFS fs.FS, requestInfo *apirequest.Reques

namespaces, err := allNamespacesWithData(sourceFS)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a not found error in your case? If so, how about we ignore only that error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eh, it turns out that we already have a test that lists cluster-scoped-resources without the namespace directory.

The test works because cluster-scoped-resources are expected to be nested in a directory.

For example: cluster-scoped-resources/operator.openshift.io/authentications/cluster.yaml
NOT: cluster-scoped-resources/operator.openshift.io/authentications.yaml

I copy-pasted the directory structure from MOM, which apparently requires a fix. I will issue a separate PR for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

heh, okay, actually both are valid and can be found in a must-gather dir.

Copy link
Contributor

openshift-ci bot commented Nov 22, 2024

@p0lyn0mial: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Copy link
Member

@bertinatto bertinatto left a comment

Choose a reason for hiding this comment

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

/lgtm

switch {
case errors.Is(err, fs.ErrNotExist):
return allPossibleListFileLocations, nil
case err != nil:
Copy link
Member

Choose a reason for hiding this comment

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

Makes sense to me. So IIRC this branch takes all possible file locations for all resources, namespaced or not.
Previously, we scraped cluster-scoped-resources and then tried to scrape all existing namespace directories. If the namespace directories didn’t exist, it would throw an error and stop. Now, it just returns all the file locations it knows about so far without failing.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 22, 2024
Copy link
Contributor

openshift-ci bot commented Nov 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bertinatto, p0lyn0mial

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [bertinatto,p0lyn0mial]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 2b6ec56 into openshift:master Nov 22, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants