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 1847540: resolve only default channels #1583

Merged

Conversation

kevinrizza
Copy link
Member

Non deterministic behavior was introduced where, in some cases, the
dependency resolver would select a channel entry from the registry
that was not part of the default channel and create a subscription
on that channel. This bugfix updates the registry client's filter
function to ignore non default channel entries.

@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. label Jun 17, 2020
@openshift-ci-robot
Copy link
Collaborator

@kevinrizza: This pull request references Bugzilla bug 1847540, 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 ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1847540: resolve only default channels

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 the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Jun 17, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 17, 2020
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.

Thanks Kevin. Looking good. A few changes requested. Also I wonder if we can have a test for this. You can modify the existing e2e test case to cover this corner case or a new test. Testing this on e2e is easier to be honest.

pkg/controller/registry/registry_client.go Show resolved Hide resolved
if _, ok := defChannels[e.PackageName]; !ok {
defChannel, err := rc.getDefaultPackageChannel(ctx, e.PackageName)
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why we don't use a continue here? If there is a bad gRPC call or a bad package that causes an error here, it doesn't mean the other packages are bad. We can simply skip this iteration and continue to the next. There is a reason that I avoided returning in error before reaching EOF (as you can see that I could just pick the first item that meets the requirement and break but instead I add all items in the list and pick the first one on the list later). This is a gRPC connection stream, break the stream before it is done may potentially add overhead on the gRPC server to clean up the hanging/open stream connection. I would prefer if we don't do so.

}
entries = append(entries, entry)
}
}

if entries != nil {
Copy link
Contributor

@benluddy benluddy Jun 17, 2020

Choose a reason for hiding this comment

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

Nit: I will sleep better if this becomes a length-based condition, since entries can always be a non-nil but empty slice (I see that it shouldn't be, but it's the kind of thing that could be inadvertently changed later).

Comment on lines 148 to 154
var defChan string
if pkg != nil {
defChan = pkg.DefaultChannelName
} else {
return "", fmt.Errorf("package %s not found in registry", pkgName)
}
return nil
return defChan, nil
Copy link
Contributor

@benluddy benluddy Jun 17, 2020

Choose a reason for hiding this comment

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

This separate declaration and assignment looks vestigal. Can you change this to return the error if pkg == nil, drop the else, and return pkg.DefaultChannelName, nil to make the control flow a little clearer?

@kevinrizza
Copy link
Member Author

@benluddy @ecordell @dinhxuanvu addressed everyone's comments.

Also, at this point I think I give up. I haven't been able to reproduce any of the failures in the e2e tests, so my guess is they're just flaky. I updated the subscription e2e test to explicitly check that we're creating a sub with the default channel.

@dinhxuanvu
Copy link
Member

/retest

2 similar comments
@dinhxuanvu
Copy link
Member

/retest

@dinhxuanvu
Copy link
Member

/retest

Non deterministic behavior was introduced where, in some cases, the
dependency resolver would select a channel entry from the registry
that was not part of the default channel and create a subscription
on that channel. This bugfix updates the registry client's filter
function to ignore non default channel entries.
@kevinrizza
Copy link
Member Author

/retest

@kevinrizza
Copy link
Member Author

/test e2e-aws-console-olm

@kevinrizza
Copy link
Member Author

/retest

@kevinrizza
Copy link
Member Author

/test e2e-aws-console-olm

@kevinrizza
Copy link
Member Author

/test e2e-aws-olm

@kevinrizza
Copy link
Member Author

/retest

1 similar comment
@kevinrizza
Copy link
Member Author

/retest

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.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 18, 2020
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dinhxuanvu, kevinrizza

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

@dinhxuanvu
Copy link
Member

/retest

@openshift-merge-robot openshift-merge-robot merged commit d6908e1 into operator-framework:master Jun 18, 2020
@openshift-ci-robot
Copy link
Collaborator

@kevinrizza: All pull requests linked via external trackers have merged: operator-framework/operator-lifecycle-manager#1583. Bugzilla bug 1847540 has been moved to the MODIFIED state.

In response to this:

Bug 1847540: resolve only default channels

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.

@kevinrizza
Copy link
Member Author

/cherry-pick release-4.5

@openshift-cherrypick-robot

@kevinrizza: new pull request created: #1585

In response to this:

/cherry-pick release-4.5

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.

@kevinrizza
Copy link
Member Author

/cherry-pick release-4.4

@openshift-cherrypick-robot

@kevinrizza: #1583 failed to apply on top of branch "release-4.4":

error: Failed to merge in the changes.
Using index info to reconstruct a base tree...
M	test/e2e/subscription_e2e_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/subscription_e2e_test.go
CONFLICT (content): Merge conflict in test/e2e/subscription_e2e_test.go
Patch failed at 0001 Bug 1847540: resolve only default channels

In response to this:

/cherry-pick release-4.4

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-high Referenced Bugzilla bug's severity is high 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

7 participants