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

provider: prevent fatal log when no operatorGroups #2672

Conversation

sebrandon1
Copy link
Member

@sebrandon1 sebrandon1 commented Jan 7, 2025

In the provider.go, we have:

env.OperatorGroups, err = GetAllOperatorGroups()
if err != nil {
   log.Fatal("Cannot get OperatorGroups: %v", err)
}

Where if we fail to do a lookup for the OperatorGroups, we are issuing a log.Fatal which then crashes the execution. In my opinion we should handle this gracefully if its a basic Not Found error.

This is an example of running against a cluster without any OperatorGroups without this change:

bpalm at bpalm-mac in ~/Repositories/go/src/github.com/redhat-best-practices-for-k8s/certsuite on main [?$]
$ ./certsuite run -l accesscontrol

FATAL: Cannot get OperatorGroups: the server could not find the requested resource (get operatorgroups.operators.coreos.com)

@sebrandon1 sebrandon1 self-assigned this Jan 7, 2025
@dcibot
Copy link
Collaborator

dcibot commented Jan 7, 2025

@sebrandon1 sebrandon1 force-pushed the prevent_fatal_operatorgroups branch from 83fcc96 to 95bba92 Compare January 7, 2025 21:45
@dcibot
Copy link
Collaborator

dcibot commented Jan 7, 2025

@sebrandon1 sebrandon1 merged commit 6ce3d2b into redhat-best-practices-for-k8s:main Jan 8, 2025
34 checks passed
@sebrandon1 sebrandon1 deleted the prevent_fatal_operatorgroups branch January 8, 2025 15:36
@dcibot
Copy link
Collaborator

dcibot commented Jan 8, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants