Skip to content

bug 1827748: feature: opm (index|registry) prune command #243

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

Merged
merged 1 commit into from
Apr 25, 2020

Conversation

djzager
Copy link
Contributor

@djzager djzager commented Mar 31, 2020

Description of the change:

This makes it possible for a user to take an index image or a database
referencing a large collection of operator bundles to filter down the
collection.

Motivation for the change:

Make it possible to scale down operator collections.

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-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 31, 2020
@openshift-ci-robot
Copy link

Hi @djzager. 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.

Copy link
Member

@mhrivnak mhrivnak left a comment

Choose a reason for hiding this comment

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

Great start. I do think that in order to be useful, it needs the ability to specify the channel with a package. The input could be a file of such pairs as CSV (comma-separated-values in this case), or this command could take positional args on the command line where the package and channel have some designated separator (maybe still a comma).

if err := indexCmd.MarkFlagRequired("from-index"); err != nil {
logrus.Panic("Failed to set required `from-index` flag for `index filter`")
}
indexCmd.Flags().StringSliceP("operators", "o", nil, "comma separated list of operators to filter")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe "packages" would work well here. That would especially prevent confusion around -o being so heavily associated with output in k8s and other contexts.

Though probably the best option is to replace this with a way to specify a list of package:channel pairs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that "packages" may be the least confusing. The problem for me is that I took these flags off of cmd/opm/index/delete.go and so I'm hesitant to 1) mess with what already exists 2) change flags just for the filter command.

@ecordell
Copy link
Member

/ok-to-test

@openshift-ci-robot openshift-ci-robot 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 Mar 31, 2020
@djzager djzager changed the title feature: opm (index|registry) filter command feature: opm (index|registry) prune command Apr 16, 2020
@djzager djzager force-pushed the filtercmd branch 2 times, most recently from a28056d to f193cfc Compare April 16, 2020 13:14
@djzager
Copy link
Contributor Author

djzager commented Apr 16, 2020

/retest

@djzager
Copy link
Contributor Author

djzager commented Apr 16, 2020

/retest

1 similar comment
@djzager
Copy link
Contributor Author

djzager commented Apr 16, 2020

/retest

Copy link

@rwsu rwsu left a comment

Choose a reason for hiding this comment

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

lgtm. There is a more SQL way to query which packages to delete from sqlite that might result in cleaner code. But not a biggie.


// get all the packages
lister := sqlite.NewSQLLiteQuerierFromDb(db)
packages, err := lister.ListPackages(context.TODO())
Copy link

Choose a reason for hiding this comment

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

The other way to do this would be to write a query to select all packages with a NOT IN in place of selecting all packages. Then convert this list of package names into a comma separated string that can used in a single call tosqlite.NewSQLRemoverForPackages(dbLoader, pkg).

@djzager
Copy link
Contributor Author

djzager commented Apr 17, 2020

/assign @ecordell @njhale

@djzager djzager force-pushed the filtercmd branch 2 times, most recently from 5ec19da to 5876c1d Compare April 17, 2020 01:50
@djzager
Copy link
Contributor Author

djzager commented Apr 21, 2020

/hold

I broke something. Will fix and add appropriate testcase.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 21, 2020
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 21, 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 Apr 21, 2020
This makes it possible for a user to prune an index image or an operator
database referencing a large collection of operator bundles.
@djzager
Copy link
Contributor Author

djzager commented Apr 21, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 21, 2020
@djzager
Copy link
Contributor Author

djzager commented Apr 21, 2020

/retest

@ecordell
Copy link
Member

/lgtm

Thanks for the wait @djzager!

This looks good modulo some refactoring that we need to do across the entire indexer.

Just so you know, we have to either file a BZ for this or wait for master to open (because we currently build upstream and downstream from this repo).

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 24, 2020
@djzager djzager changed the title feature: opm (index|registry) prune command bug 1827748: feature: opm (index|registry) prune command Apr 24, 2020
@openshift-ci-robot openshift-ci-robot added bugzilla/low bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Apr 24, 2020
@openshift-ci-robot
Copy link

@djzager: This pull request references Bugzilla bug 1827748, which is invalid:

  • expected the bug to target the "4.5.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

bug 1827748: feature: opm (index|registry) prune command

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.

@djzager
Copy link
Contributor Author

djzager commented Apr 24, 2020

/bugzilla refresh

@openshift-ci-robot
Copy link

@djzager: This pull request references Bugzilla bug 1827748, which is invalid:

  • expected the bug to target the "4.5.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

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.

@jmrodri
Copy link
Member

jmrodri commented Apr 24, 2020

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Apr 24, 2020
@openshift-ci-robot
Copy link

@jmrodri: This pull request references Bugzilla bug 1827748, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

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.

@openshift-ci-robot openshift-ci-robot removed the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Apr 24, 2020
@ecordell
Copy link
Member

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: djzager, ecordell, mhrivnak

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:

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 25, 2020
@openshift-merge-robot openshift-merge-robot merged commit 6e6a14d into operator-framework:master Apr 25, 2020
@openshift-ci-robot
Copy link

@djzager: All pull requests linked via external trackers have merged: operator-framework/operator-registry#243. Bugzilla bug 1827748 has been moved to the MODIFIED state.

In response to this:

bug 1827748: feature: opm (index|registry) prune command

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.

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. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. 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.

8 participants