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

Bug 1880501: Adding overwrite-latest flag to index add #448

Merged

Conversation

gallettilance
Copy link
Member

@gallettilance gallettilance commented Sep 18, 2020

Description of the change:

Allow index maintainers to overwrite the latest bundle in a package on opm index add by adding an --overwrite-latest option.

Caveats

  • valid only when using replaces mode
  • each overwrite pulls all images for the package in order to rebuild the graph

Benefits

  • image pulls are parallelized
  • supports overwrites of the update graph

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

Sorry, something went wrong.

@gallettilance gallettilance changed the title Adding overwrite-latest flag to index add WIP: Adding overwrite-latest flag to index add Sep 18, 2020
@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 Sep 18, 2020
@gallettilance gallettilance force-pushed the force-bundle branch 2 times, most recently from c76b413 to 91b4d82 Compare September 18, 2020 16:47
@dinhxuanvu
Copy link
Member

Can we have a description/summary on what we are trying to accomplish with this? Perhaps mentioning the use case/issue here would be helpful.

@gallettilance gallettilance changed the title WIP: Adding overwrite-latest flag to index add Bug 1880501: Adding overwrite-latest flag to index add Sep 18, 2020
@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 Sep 18, 2020
@openshift-ci-robot
Copy link

@gallettilance: This pull request references Bugzilla bug 1880501, 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.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1880501: Adding overwrite-latest flag to index add

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 added bugzilla/severity-urgent Referenced Bugzilla bug's severity is urgent for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Sep 18, 2020
@gallettilance gallettilance force-pushed the force-bundle branch 2 times, most recently from 301a859 to f283a55 Compare September 18, 2020 20:59
@openshift-ci-robot
Copy link

@gallettilance: This pull request references Bugzilla bug 1880501, which is valid.

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

In response to this:

Bug 1880501: Adding overwrite-latest flag to index add

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.

@njhale
Copy link
Member

njhale commented Sep 18, 2020

/retest

@gallettilance gallettilance force-pushed the force-bundle branch 3 times, most recently from f789745 to 78f4fda Compare September 20, 2020 22:14
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 22, 2020
@gallettilance gallettilance force-pushed the force-bundle branch 2 times, most recently from 32cc1e4 to a4b1169 Compare September 22, 2020 14:38
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 22, 2020
@gallettilance gallettilance force-pushed the force-bundle branch 4 times, most recently from 7346a0f to f3c5dbb Compare September 22, 2020 21:14
@gallettilance
Copy link
Member Author

/test unit

@@ -16,9 +16,9 @@ type ImageInput struct {
metadataDir string
to image.Reference
from string
annotationsFile *AnnotationsFile
AnnotationsFile *AnnotationsFile
Copy link
Member

Choose a reason for hiding this comment

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

same: why did these become public?

Copy link
Member Author

Choose a reason for hiding this comment

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

same as #448 (comment)

@@ -119,28 +167,38 @@ func (i *DirectoryPopulator) loadManifests(imagesToAdd []*ImageInput, mode Mode)
// same package linearly.
var err error
var validImagesToAdd []*ImageInput

for pkg := range i.overwriteDirMap {
err := i.loader.RemovePackage(pkg)
Copy link
Member

Choose a reason for hiding this comment

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

I think we want the remove / add to happen in a single transaction.

It would also be nice to not need to thread through the "overwriteImages" separately everywhere. is there a way we can we push the overwrite option down to loadManifestReplaces (or call loadManifestsReplaceOverwrite if overwrite is set, etc), so that we only need to worry about overwriting when we try to insert and it fails because it already exists?

Copy link
Member Author

Choose a reason for hiding this comment

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

we can but that requires exposing the image registry package to the registry package which today can't easily be done because of cyclic imports...

Copy link
Member

Choose a reason for hiding this comment

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

I think you could avoid importing the image/registry package with a ReplacePackage(pkg string, bundle ...Bundle) method on the loader -- still getting a single transaction at the DB level.

However, I do think that at this point, we should prioritize getting something working and merged over long-term support; partly b/c the declarative index config will supersede this work in the near future.

graphLoader: graphLoader,
querier: querier,
imageDirMap: imageDirMap,
overwriteDirMap: overwriteDirMap,
Copy link
Member

Choose a reason for hiding this comment

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

do we need to distinguish which ones are "overwrites" up front?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I think it makes sense to do it upfront so we only pull the images when we need to. I think more of the registry package needs to be made public in order to make that possible but it shouldn't be too bad

Copy link
Member Author

Choose a reason for hiding this comment

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

it reduces the amount of unit tests we can do though...

@maneeshmehra
Copy link

@gallettilance had already marked the bugzilla item linked to this PR as critical. Asking all reviewers to review this with highest priority as it blocks our operator verification pipelines. TIA.

@openshift-ci-robot
Copy link

@gallettilance: This pull request references Bugzilla bug 1880501, which is valid.

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

In response to this:

Bug 1880501: Adding overwrite-latest flag to index add

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.

@njhale
Copy link
Member

njhale commented Sep 23, 2020

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gallettilance, njhale

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 Sep 23, 2020
@gallettilance
Copy link
Member Author

/restest

@gallettilance
Copy link
Member Author

/retest

This adds the ability to overwrite the latest bundle during index add
in order to avoid having to remove all the bundles from the index and
re-add them before being able to add the updated bundle.
@njhale
Copy link
Member

njhale commented Sep 23, 2020

All pending comments addressed offline.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 23, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit f634a5a into operator-framework:master Sep 24, 2020
@openshift-ci-robot
Copy link

@gallettilance: All pull requests linked via external trackers have merged:

Bugzilla bug 1880501 has been moved to the MODIFIED state.

In response to this:

Bug 1880501: Adding overwrite-latest flag to index add

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/severity-urgent Referenced Bugzilla bug's severity is urgent for the branch this PR is targeting. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants