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 1732579: Best-effort loading #69

Merged
merged 5 commits into from
Aug 9, 2019

Conversation

njhale
Copy link
Member

@njhale njhale commented Aug 6, 2019

This PR represents a more concise attempt to make appregistry-server more permissive of errors by allowing more operations to be best-effort; allowing loading to progress while aggregating errors (instead of stopping immediately). In lieu of simple logging, error aggregation is necessary to preserve the strict behavior of the configmap-server and initializer commands since appregistry-server uses both underlying load methods (configmap and directory) in various scenarios.

@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 Aug 6, 2019
@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 6, 2019
@ecordell ecordell changed the title WIP: Best-effort loading Bug 1737586 WIP: Best-effort loading Aug 6, 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 Aug 6, 2019
@ecordell ecordell changed the title Bug 1737586 WIP: Best-effort loading Bug 1737586: WIP: Best-effort loading Aug 6, 2019
@openshift-ci-robot openshift-ci-robot added the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Aug 6, 2019
@openshift-ci-robot
Copy link

@njhale: This pull request references an invalid Bugzilla bug:

  • expected dependent Bugzilla bug to be in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), but it is POST 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 1737586: WIP: Best-effort loading

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.

@ecordell
Copy link
Member

ecordell commented Aug 6, 2019

/bugzilla refresh

@openshift-ci-robot
Copy link

@ecordell: This pull request references an invalid Bugzilla bug:

  • expected dependent Bugzilla bug to be in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), but it is POST 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.

@njhale njhale changed the title Bug 1737586: WIP: Best-effort loading Bug 1737586: Best-effort loading Aug 7, 2019
Copy link
Member

@ecordell ecordell left a comment

Choose a reason for hiding this comment

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

Looks good! A couple of foods for thought

}

if err := s.addProvidedAPIs(tx, channelEntryCSV, currentID); err != nil {
return err
errs = append(errs, err)
break
Copy link
Member

Choose a reason for hiding this comment

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

We should be able to continue processing even if the provided apis can't be added. It just means the registry won't be able to answer dependency questions about this particular bundle.

}

skips, err := channelEntryCSV.GetSkips()
if err != nil {
return err
errs = append(errs, err)
break
Copy link
Member

Choose a reason for hiding this comment

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

We should be able to continue processing even if we can't find the skips

@ecordell ecordell changed the title Bug 1737586: Best-effort loading Bug 1732579: Best-effort loading Aug 8, 2019
@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Aug 8, 2019
@openshift-ci-robot
Copy link

@njhale: This pull request references a valid Bugzilla bug. The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Bug 1732579: Best-effort loading

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 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 Aug 8, 2019
@ecordell
Copy link
Member

ecordell commented Aug 8, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 8, 2019
openshift-merge-robot and others added 4 commits August 8, 2019 16:03

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Support `oc` command
Make package loading best-effort by aggregating errors and continuing
where applicable.
Make package and bundle loading best effort by aggregating errors and
continuing where applicable.
Make package and bundle loading best effort by aggregating errors and continuing where applicable.
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 8, 2019
}

if replaces == "" {
// we've walked the channel until there was no replacement
break
}

replaced, err := s.getCSV(tx, replaces)
replacedChannelEntry, err := addChannelEntry.Exec(c.Name, manifest.PackageName, replaces, depth)
Copy link
Member

Choose a reason for hiding this comment

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

I would like to understand why the order of this changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

The change in ordering lets us add a channel entry for a "missing" replaced CSV.

logger.WithError(err).Warn("error loading app registry manifests")
}
if store == nil {
logger.Fatal("store failed to initialize")
Copy link
Member

Choose a reason for hiding this comment

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

If there are no bundles that are valid this will crash loop correct? Wondering if it makes sense to expose an empty catalog instead?

Copy link
Member Author

@njhale njhale Aug 8, 2019

Choose a reason for hiding this comment

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

If there are no bundles, the store will not be nil. It should only be nil when there is an issue parsing the source and package names given in the command options. That signifies a misconfiguration of operator-registry itself, which I think should be fatal. I do think that option validation should be more explicit and done before Load is called, but the appregistry code should be going away soon anyway, and the objective was to make this PR slim.

All that being said, my previous PR exposes an "Empty" Query implementation. If you think it's best I can pull in that into this PR too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added the empty querier just to be safe.

@njhale
Copy link
Member Author

njhale commented Aug 8, 2019

/retest

Copy link
Member

@ecordell ecordell left a comment

Choose a reason for hiding this comment

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

/lgtm

"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v2"
Copy link
Member

Choose a reason for hiding this comment

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

Can we either:

  • Do this with the currently imported yaml library (ghodss) or the kube decoders
  • Remove the currently imported libraries (ghodss) and replace with this one?

Copy link
Member Author

Choose a reason for hiding this comment

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

At a cursory glance, there was no encoder to match the decoder in the k8s package.

I didn't look into the ghodss package. Will follow-up soon.

}
}
return tx.Commit()

if err := tx.Commit(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

We should revisit this, and probably have more granular transactions. This one failing would nullify a lot of the work above to load as much as possible.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 8, 2019
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 8, 2019
@ecordell
Copy link
Member

ecordell commented Aug 8, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 8, 2019
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ecordell, 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-merge-robot openshift-merge-robot merged commit 7b704fe into operator-framework:master Aug 9, 2019
@njhale njhale deleted the best-effort branch August 9, 2019 11:23
@njhale njhale restored the best-effort branch August 9, 2019 20:04
@njhale
Copy link
Member Author

njhale commented Aug 14, 2019

/cherry-pick release-4.1

@openshift-cherrypick-robot

@njhale: #69 failed to apply on top of branch "release-4.1":

error: Failed to merge in the changes.
Using index info to reconstruct a base tree...
M	pkg/sqlite/load.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/sqlite/load.go
CONFLICT (content): Merge conflict in pkg/sqlite/load.go
Patch failed at 0001 feat(sqlite): make package loading best-effort

In response to this:

/cherry-pick release-4.1

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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants