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
Bug 1847540: resolve only default channels #1583
Conversation
@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
In response to this:
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. |
There was a problem hiding this 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.
if _, ok := defChannels[e.PackageName]; !ok { | ||
defChannel, err := rc.getDefaultPackageChannel(ctx, e.PackageName) | ||
if err != nil { | ||
return nil, err |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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).
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 |
There was a problem hiding this comment.
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?
@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. |
/retest |
2 similar comments
/retest |
/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.
/retest |
/test e2e-aws-console-olm |
/retest |
/test e2e-aws-console-olm |
/test e2e-aws-olm |
/retest |
1 similar comment
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[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 |
/retest |
@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:
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. |
/cherry-pick release-4.5 |
@kevinrizza: new pull request created: #1585 In response to this:
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. |
/cherry-pick release-4.4 |
@kevinrizza: #1583 failed to apply on top of branch "release-4.4":
In response to this:
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. |
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.