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

Improve CatalogSource controller error handling #34

Conversation

rashmigottipati
Copy link
Member

  • IF the unpack Job can not be created, update the CatalogSource resource status indicating the unpack failure

  • IF the unpack Job’s Pod’s logs can not be read, update the CatalogSource resource status indicating the unpack failure

  • IF the error is because the Pod no longer exists, requeue to attempt unpacking process again as the Job could have been cleaned up by another process

  • IF a Package CR can not be created; and IF is the error is caused by the Package already existing - continue

  • IF a BundleMetadata CR can not be created; and IF the error is caused by the BundleMetadata already existing - continue

Signed-off-by: Rashmi Gottipati <chowdary.grashmi@gmail.com>
Copy link
Collaborator

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on @rashmigottipati ! I know it has likely been hectic with rebases and scope change due to other PRs so I appreciate you taking the time to get this PR up!

Here is my first round of review:

pkg/apis/core/v1beta1/catalogsource_types.go Show resolved Hide resolved
Comment on lines +228 to +231
// If BundleMetadata CR already exists, continue
if errors.IsNotFound(err) {
return nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I am reading this right, I think this should be:

Suggested change
// If BundleMetadata CR already exists, continue
if errors.IsNotFound(err) {
return nil
}
// If BundleMetadata CR already exists, continue
if !errors.IsAlreadyExists(err) {
return err
}

// If BundleMetadata CR already exists, continue
if errors.IsNotFound(err) {
return nil
}
return fmt.Errorf("creating bundlemetadata %q: %w", bundleMeta.Name, err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something that was discussed in https://github.com/operator-framework/catalogd/pull/30/files#r1164309453 is instead of returning an error when first encountered, we should aggregate the errors and return all the errors that occurred. This would mean the first occurrence of an error doesn't completely stop the unpacking process.

That being said, I'm not sure how our plans to switch to a different mechanism would impact this.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I don't think I'd worry too much about this kind of thing right now unless it impacts
operator-framework/operator-controller#161

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think it would impact operator-framework/operator-controller#161 any more than the current process does. If information fails to get unpacked we set the ready condition to false regardless to signal that you shouldn't attempt to get information from that catalog.

Comment on lines +279 to +282
// If Create fails due to Package CR already being present, continue
if errors.IsNotFound(err) {
return nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto to wrong error check, I think it should be:

Suggested change
// If Create fails due to Package CR already being present, continue
if errors.IsNotFound(err) {
return nil
}
// If Create fails due to Package CR already being present, continue
if !errors.IsAlreadyExists(err) {
return err
}

pkg/apis/core/v1beta1/catalogsource_types.go Show resolved Hide resolved
@anik120 anik120 mentioned this pull request Apr 12, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2023
@openshift-merge-robot
Copy link

PR needs rebase.

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.

@rashmigottipati
Copy link
Member Author

Just had an offline chat with @everettraven and the changes in this PR are being covered as a part of the larger PR that adds extensible unpacking interface. So closing this PR in favor of the other PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants