Skip to content

Conversation

@pawicao-ibm
Copy link
Contributor

@pawicao-ibm pawicao-ibm commented Aug 2, 2022

This PR is a follow-up of #969 and is being worked on simultaneously with openshift/oc-mirror#497

Description of the change:
The discussion on the diff logic started with openshift/oc-mirror#453 issue where the defaultChannels for operators where invalid while using minVersion/maxVersion.

Further work and discussions on adding the Priority property (see #969) resulted in a conclusion to migrate the entirety of diff logic to oc-mirror.

This work has been prepared in the following PR: openshift/oc-mirror#497

Some changes in the operator-registry have to be done though together with the migration (e.g. changing schema variables to public or adding properties to a channel model), in order for oc-mirror's diff to be able to take advantage of needed operator-registry structures.

Lastly this migration results in changes to opm diff. See here for the latest thoughts on deprecating this command

Motivation for the change:

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

@openshift-ci openshift-ci bot requested review from dinhxuanvu and kevinrizza August 2, 2022 08:50
@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 2, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 2, 2022

Hi @pawicao-ibm. Thanks for your PR.

I'm waiting for a operator-framework member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@dinhxuanvu
Copy link
Member

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 8, 2022
@dinhxuanvu
Copy link
Member

Please do not merge this PR until the oc-mirror PR is merged. I will put a hold here just in case.
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 8, 2022
@dinhxuanvu
Copy link
Member

dinhxuanvu commented Aug 8, 2022

I would like to ask you @pawicao-ibm to squash the commits to reduce the noises here. Grouping the commits together based on their purposes to reduce maybe 2 main commits (one for adding channel properties and one for removing the diff logic).
I would prefer having the two proposed commits to be 2 separate PRs given they are not necessarily linked together but I'll let others chime in.
@joelanford FYI

@codecov
Copy link

codecov bot commented Aug 8, 2022

Codecov Report

Merging #1006 (1096598) into master (33ed9ea) will decrease coverage by 1.19%.
The diff coverage is 85.71%.

@@            Coverage Diff             @@
##           master    #1006      +/-   ##
==========================================
- Coverage   52.87%   51.67%   -1.20%     
==========================================
  Files         104      101       -3     
  Lines        9468     8961     -507     
==========================================
- Hits         5006     4631     -375     
+ Misses       3529     3450      -79     
+ Partials      933      880      -53     
Impacted Files Coverage Δ
alpha/declcfg/declcfg.go 100.00% <ø> (ø)
alpha/declcfg/load.go 78.65% <66.66%> (ø)
alpha/declcfg/model_to_declcfg.go 100.00% <100.00%> (ø)
pkg/registry/query.go 61.45% <0.00%> (-0.53%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@dinhxuanvu
Copy link
Member

One a second look, in fact there is already a PR for priority channel which is linked here (#969) so I recommend to move all commits associated to that PR out of this PR and squash the rest into one.

@pawicao-ibm pawicao-ibm force-pushed the oskarpawica/diff-pr-enhancements branch from 5cbe3fa to 112f173 Compare August 9, 2022 14:04
@pawicao-ibm
Copy link
Contributor Author

It made sense and I followed your suggestion. This PR now includes the migration of the diff logic to oc-mirror, #969 includes only adding the channel priority.

There are two things to note here:

  1. Unfortunately it is not that easy to just wait for oc-mirror PR to be merged first as it also depends on changes we are making here - refactoring some variables to public in order for them to be accessible from other projects (schemas mostly)
  2. The question here is what would be done with opm alpha diff. This PR deletes it completely. Should it stay here, have a dependency to diff from oc-mirror and be left with a deprecation notice for some time? Or is the complete removal okay?

@dinhxuanvu
Copy link
Member

It made sense and I followed your suggestion. This PR now includes the migration of the diff logic to oc-mirror, #969 includes only adding the channel priority.

There are two things to note here:

  1. Unfortunately it is not that easy to just wait for oc-mirror PR to be merged first as it also depends on changes we are making here - refactoring some variables to public in order for them to be accessible from other projects (schemas mostly)
  2. The question here is what would be done with opm alpha diff. This PR deletes it completely. Should it stay here, have a dependency to diff from oc-mirror and be left with a deprecation notice for some time? Or is the complete removal okay?

If you remove the diff code, then alpha diff command on opm will need to get removed as well.

@pawicao-ibm
Copy link
Contributor Author

If you remove the diff code, then alpha diff command on opm will need to get removed as well.

yes and that's exactly how it is prepared now. I was asking if for sure you are okay with that

@dinhxuanvu
Copy link
Member

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 18, 2022
@dinhxuanvu
Copy link
Member

@pawicao-ibm Hey Oskar, do me a favor and do a few things for this PR:

  • Rebase against master
  • Run make vendor and ensure the sanity check pass
  • Sign your commit

Thanks.

Signed-off-by: Oskar Pawica <Oskar.Pawica@ibm.com>
Signed-off-by: Oskar Pawica <Oskar.Pawica@ibm.com>
@pawicao-ibm pawicao-ibm force-pushed the oskarpawica/diff-pr-enhancements branch from ed15fac to 1096598 Compare August 19, 2022 11:45
@pawicao-ibm
Copy link
Contributor Author

@pawicao-ibm Hey Oskar, do me a favor and do a few things for this PR:

* Rebase against master

* Run `make vendor` and ensure the `sanity` check pass

* Sign your commit

Thanks.

Is it okay now?

Copy link
Member

@dinhxuanvu dinhxuanvu left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 19, 2022
@dinhxuanvu
Copy link
Member

@joelanford Can you please take a look and give it a lgtm if everything is good? Thanks.

Copy link
Contributor

@grokspawn grokspawn left a comment

Choose a reason for hiding this comment

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

Appreciate it if we can run to ground the new exports before concluding this. Unless required by an API consumer not represented here, we'd like to minimize exports when possible.

@dinhxuanvu
Copy link
Member

Appreciate it if we can run to ground the new exports before concluding this. Unless required by an API consumer not represented here, we'd like to minimize exports when possible.

I'm pretty sure the diff code uses them. Now the diff code is moving out of the package, these variables and functions need to be exportable so they can be used on mirror repo.

@dinhxuanvu
Copy link
Member

@pawicao-ibm Can you confirm that you need those variables and the func to be exportable for mirror usage? Or there is another reason for it?

@pawicao-ibm
Copy link
Contributor Author

Now that I look into that, they are used but within tests of the diff logic, while creating DeclarativeConfigs. They are also used here: https://github.com/openshift/oc-mirror/blob/a1440e623b1f6c9652c3053ec78661bfe223ecae/pkg/operator/diff/internal/diff.go#L542 - this function is called for comparing bundles. Maybe there would be a way around that tho

@dinhxuanvu
Copy link
Member

Now that I look into that, they are used but within tests of the diff logic, while creating DeclarativeConfigs. They are also used here: https://github.com/openshift/oc-mirror/blob/a1440e623b1f6c9652c3053ec78661bfe223ecae/pkg/operator/diff/internal/diff.go#L542 - this function is called for comparing bundles. Maybe there would be a way around that tho

I see. The main question is if these changes are needed. If they ain't, we should reverse them. I personally don't mind the changes but let keep the changes to the minimum and avoid unnecessary ones.

@pawicao-ibm
Copy link
Contributor Author

I am looking into that

@pawicao-ibm
Copy link
Contributor Author

Now that I look into that, they are used but within tests of the diff logic, while creating DeclarativeConfigs. They are also used here: https://github.com/openshift/oc-mirror/blob/a1440e623b1f6c9652c3053ec78661bfe223ecae/pkg/operator/diff/internal/diff.go#L542 - this function is called for comparing bundles. Maybe there would be a way around that tho

I see. The main question is if these changes are needed. If they ain't, we should reverse them. I personally don't mind the changes but let keep the changes to the minimum and avoid unnecessary ones.

These changes are needed if we want to have the diff functions in oc-mirror and not have redundant duplications of these schemas. I see some possibility of manouvering functions here and there. For example some of the internal diff functions (https://github.com/openshift/oc-mirror/blob/a1440e623b1f6c9652c3053ec78661bfe223ecae/pkg/operator/diff/internal/diff.go#L542:L629) could go to operator-registry - model.go or model_to_declcfg.go yet in the end they would have to be exported anyway

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 25, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dinhxuanvu, grokspawn, pawicao-ibm

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 [dinhxuanvu,grokspawn]

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

@grokspawn
Copy link
Contributor

Appreciate the diligence, folks.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 25, 2022
@openshift-merge-robot openshift-merge-robot merged commit d166a49 into operator-framework:master Aug 25, 2022
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. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants