Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Improve CatalogSource controller error handling#34

Closed
rashmigottipati wants to merge 1 commit intooperator-framework:mainfrom
rashmigottipati:error-handling
Closed

Improve CatalogSource controller error handling#34
rashmigottipati wants to merge 1 commit intooperator-framework:mainfrom
rashmigottipati:error-handling

Conversation

@rashmigottipati
Copy link
Copy Markdown
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>
Comment thread pkg/apis/core/v1beta1/catalogsource_types.go
Comment thread pkg/controllers/core/catalogsource_controller.go
Comment thread pkg/controllers/core/catalogsource_controller.go
Copy link
Copy Markdown
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:

Comment thread pkg/apis/core/v1beta1/catalogsource_types.go
Comment thread pkg/controllers/core/catalogsource_controller.go
Comment thread pkg/controllers/core/catalogsource_controller.go
Comment on lines +228 to +231
// If BundleMetadata CR already exists, continue
if errors.IsNotFound(err) {
return nil
}
Copy link
Copy Markdown
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 errors.IsNotFound(err) {
return nil
}
return fmt.Errorf("creating bundlemetadata %q: %w", bundleMeta.Name, err)
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 thread pkg/controllers/core/catalogsource_controller.go
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
Copy Markdown
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
}

Comment thread pkg/controllers/core/catalogsource_controller.go
Comment thread pkg/apis/core/v1beta1/catalogsource_types.go
@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
Copy Markdown

PR needs rebase.

Details

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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

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