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

Image digests for referencing bundles #99

Closed
wants to merge 2 commits into from

Conversation

anik120
Copy link
Contributor

@anik120 anik120 commented Oct 15, 2019

Description of the change:

  • Change schema of OperatorBundle table to include field 'bundlepath'.
  • Extend API to allow querying of the new bundlepath field.
  • Modify API to return empty struct instead of an error while querying empty bundle

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
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: anik120
To complete the pull request process, please assign ecordell
You can assign the PR to them by writing /assign @ecordell in a comment when ready.

The full list of commands accepted by this bot can be found 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 15, 2019
@anik120 anik120 changed the title Image digests for referencing bundles [WIP] Image digests for referencing bundles Oct 15, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 15, 2019
@ecordell
Copy link
Member

@anik120 I like this approach and think it will give us a good transition path on the client side.

Couple of things to think about:

@anik120
Copy link
Contributor Author

anik120 commented Oct 16, 2019

@ecordell thank you for your feedback.

  • I've looked at Database migration initialization #90 and looks like we still don't need to migrate our database as we're at ground zero with storing image-digests. Once we have long lived clusters with image digests stored in the registry and there needs to be a change in the schema, that is when we'll need to migrate the db.
  • I've included a API test to test querying a bundle path(currently it just checks for an empty path as all bundlePath values are set to null). Also, seems like at some point we should refactor the API tests to mock a database instead of using an actual database which seems more like integration tests?

@anik120 anik120 changed the title [WIP] Image digests for referencing bundles Image digests for referencing bundles Oct 16, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 16, 2019
@ecordell
Copy link
Member

Also, seems like at some point we should refactor the API tests to mock a database instead of using an actual database which seems more like integration tests?

It would be good to have two layers, but sqlite is often used as a mock sql database anyway, so IMO it's low on the list of priorities.

@ecordell
Copy link
Member

/hold

I missed some things on my initial review.

There are multiple API calls in OLM that will need to have Paths returned to them. See the querier: https://github.com/operator-framework/operator-lifecycle-manager/blob/master/pkg/controller/registry/resolver/querier.go

(the source in that package is the grpc client to the registry server)

Because there are multiple places that we need to return this, could we extend the Bundle struct itself? We could add a new field path, and then clients can prefer the path field if it exists?

@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 Oct 18, 2019
@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 21, 2019
@dinhxuanvu dinhxuanvu removed the request for review from alecmerdler October 22, 2019 08:48
if err != nil {
return err
}
defer migrator.CleanUpMigrator()
Copy link
Member

Choose a reason for hiding this comment

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

probably shouldn't defer this, it won't get run until the server exits (which could be never)

Migrate older database to new schema.
Extend API to allow querying of the new `bundlepath` field.
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 22, 2019
@anik120
Copy link
Contributor Author

anik120 commented Oct 23, 2019

There are multiple API calls in OLM that will need to have Paths returned to them. See the querier: https://github.com/operator-framework/operator-lifecycle-manager/blob/master/pkg/controller/registry/resolver/querier.go

(the source in that package is the grpc client to the registry server)

Because there are multiple places that we need to return this, could we extend the Bundle struct itself? We could add a new field path, and then clients can prefer the path field if it exists?

@ecordell that is actually a very good point. I've opened another PR where I've extended the Bundle struct and GetBundle API instead of adding a new API. I'll go ahead and close this PR if that looks good.

@anik120
Copy link
Contributor Author

anik120 commented Oct 25, 2019

Closing in favor of #103

@anik120 anik120 closed this Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants