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

oc/*: gracefully fail when user group is not configured #1585

Conversation

stevekuznetsov
Copy link
Contributor

All commands using the userv1 clients should be wrapped now.

$ for file in $( git grep -l 'clientset/versioned/typed/user/v1' | grep -v vendor ); do if ! grep -q 'CheckOAuthDisabledErr' $file; then echo $file; fi; done
pkg/cli/admin/groups/sync/interfaces.go    # just interfaces, no impl
pkg/cli/admin/prune/auth/group_test.go     # test
pkg/cli/admin/prune/auth/user.go           # helper func, caller handles it
pkg/cli/admin/prune/auth/user_test.go      # test
pkg/helpers/describe/describer.go          # TODO: need to figure this out
pkg/helpers/groupsync/grouplister.go       # helper func, caller handles it
pkg/helpers/groupsync/grouplister_test.go  # test
pkg/helpers/groupsync/grouppruner.go       # helper func, caller handles it
pkg/helpers/groupsync/grouppruner_test.go  # test
pkg/helpers/groupsync/groupsyncer.go       # helper func, caller handles it
pkg/helpers/groupsync/groupsyncer_test.go  # test
pkg/helpers/project/whoami.go              # helper func, caller handles it

Follow-ups:

  • determine how to handle the describer functions
  • also handle the oauth group

@@ -5,7 +5,9 @@ import (
"fmt"

"github.com/go-ldap/ldap/v3"
ocmdhelpers "github.com/openshift/oc/pkg/helpers/cmd"
Copy link
Member

Choose a reason for hiding this comment

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

nit: should be in oc/pkg group with the end of imports

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have an import formatter enabled on the repo? I think you (and anyone making PRs) would appreciate your preferences being automated so these kinds of comments don't need to happen. OpenShift has an import formatter that I've seen other repos use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pkg/cli/admin/verifyimagesignature/verify-signature.go Outdated Show resolved Hide resolved
@@ -68,7 +71,7 @@ func NewCmdWhoAmI(f kcmdutil.Factory, streams genericiooptions.IOStreams) *cobra
Run: func(cmd *cobra.Command, args []string) {
kcmdutil.CheckErr(o.Complete(f))
kcmdutil.CheckErr(o.Validate())
kcmdutil.CheckErr(o.Run())
ocmdhelpers.CheckOAuthDisabledErr(o.Run(), o.DiscoveryClient)
Copy link
Member

Choose a reason for hiding this comment

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

no need to add this check in here because we will support both cases(catch notfound error internally and use different endpoint)

Copy link
Member

Choose a reason for hiding this comment

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

whoami should work with external OIDC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, let's have it fail gracefully - when we're ready to have it work both ways, we can remove this.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
@stevekuznetsov stevekuznetsov force-pushed the skuznets/fail-gracefully-user-oauth branch from 1a4165e to df2f47f Compare October 19, 2023 14:50
@ardaguclu
Copy link
Member

Thanks @stevekuznetsov

/lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 19, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ardaguclu, stevekuznetsov

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

@openshift-ci openshift-ci bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Oct 19, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 19, 2023

@stevekuznetsov: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-ci openshift-ci bot merged commit e0eb4a2 into openshift:master Oct 19, 2023
12 checks passed
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. 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

2 participants