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

scorecard,generate-csv: consider api "group" while checking for known types #3334

Merged
merged 1 commit into from
Jul 24, 2020

Conversation

avalluri
Copy link
Contributor

@avalluri avalluri commented Jul 2, 2020

Description of the change:
Comparing only "kind" of the resource might lead to conflict where two resources might have same kind but in different api groups.

For example an operator could provide a custom resource with name "Deployment" in it's own group. On generating csv for this operator might not consider the provided CR for filling 'alm-examples'

Motivation for the change:

Observed this issue while integrating PMEM-CSI operator which provides Deployment CRD in pmem-csi.intel.com API group.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

@tengqm
Copy link
Contributor

tengqm commented Jul 2, 2020

LGTM

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Really thank you for your contribution.
It shows ok for me.
Please just give the space in the fragment and let's see what @estroz and @jmccormick2001 think about these changes as well.

Otherwise, it is /lgtm /approve.

@camilamacedo86 camilamacedo86 requested a review from estroz July 6, 2020 08:09
internal/generate/collector/collect.go Outdated Show resolved Hide resolved
internal/generate/collector/collect.go Outdated Show resolved Hide resolved
internal/generate/collector/collect.go Outdated Show resolved Hide resolved
internal/generate/collector/collect.go Outdated Show resolved Hide resolved
internal/generate/collector/collect.go Outdated Show resolved Hide resolved
internal/generate/collector/collect.go Outdated Show resolved Hide resolved
internal/generate/collector/collect.go Outdated Show resolved Hide resolved
internal/generate/collector/collect.go Outdated Show resolved Hide resolved
@@ -359,6 +359,37 @@ var _ = Describe("Generating a ClusterServiceVersion", func() {
Expect(csv).To(Equal(upgradeCSV(newCSV, g.OperatorName, g.Version)))
})
})

Context("generate ClusterServiceVersion", func() {
Copy link
Member

Choose a reason for hiding this comment

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

Tests for the functionality added in this PR should be in internal/generate/collector, not here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, there are no unit tests exist specific to internal/generate/collector functionality. The clusterserviceversion_test.go also covers collector functionality, hence I add a new case to test this new change.

Copy link
Member

Choose a reason for hiding this comment

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

Well you can add a test to internal/generate/collector so specific tests exist 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@estroz Added a test for chagne in collector package.

Copy link
Member

Choose a reason for hiding this comment

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

@avalluri thanks! Can you also remove this test, since the new functionality is being tested elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@estroz Thanks for your review time. I intentionally left the test in clustersevice_version.go as the test also ensures the alm-examples annotations filled properly even for CRs with core type names. I made changes to test such that it makes sure the generated alm-examples matches with found CRs.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 16, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 20, 2020
@avalluri avalluri force-pushed the fix-deployments branch 2 times, most recently from b67b2d7 to 4e2a5ff Compare July 21, 2020 13:50
@estroz
Copy link
Member

estroz commented Jul 22, 2020

This PR is a good first step towards a (potential) larger refactor needed to support #3494.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2020
… types

Comparing only "kind" of the resource might lead to conflict where two
resources might have same kind but in different api groups.

For example an operator could provide a custom resource with name
"Deployment" in it's own group. On generating csv for this operator
might not consider the provided CR for filling 'alm-examples'.
Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 24, 2020
@estroz estroz merged commit 9db3ee8 into operator-framework:master Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants