Skip to content

Commit 0a35181

Browse files
authoredApr 18, 2024··
Merge pull request #112 from inteon/error_include_clustername
Include cluster name in authorization error messages
2 parents db89760 + deecb62 commit 0a35181

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎pkg/flagutil/kubernetes_cluster_clients.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,13 @@ func (o *KubernetesOptions) BuildClusterManagers(dryRun bool, requiredTestPodVer
396396
authzClient, err := authorizationv1.NewForConfig(&config)
397397
if err != nil {
398398
lock.Lock()
399-
errs = append(errs, fmt.Errorf("failed to construct authz client: %s", err))
399+
errs = append(errs, fmt.Errorf("failed to construct authz client for cluster %s: %s", name, err))
400400
lock.Unlock()
401401
return
402402
}
403403
if err := CheckAuthorizations(authzClient.SelfSubjectAccessReviews(), options.Namespace, requiredTestPodVerbs); err != nil {
404404
lock.Lock()
405-
errs = append(errs, fmt.Errorf("failed pod resource authorization check: %w", err))
405+
errs = append(errs, fmt.Errorf("failed pod resource authorization check for cluster %s: %w", name, err))
406406
lock.Unlock()
407407
return
408408
}

0 commit comments

Comments
 (0)
Please sign in to comment.