Skip to content

Commit

Permalink
Add GroupDiscoveryFailedErrorGroups helper method
Browse files Browse the repository at this point in the history
Kubernetes-commit: 733f63c6c423565b8cecf3f3db8e9d81e48b1311
  • Loading branch information
liggitt authored and k8s-publishing-bot committed May 15, 2023
1 parent b8a03ab commit daed746
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions discovery/discovery_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package discovery
import (
"context"
"encoding/json"
goerrors "errors"
"fmt"
"mime"
"net/http"
Expand Down Expand Up @@ -422,6 +423,16 @@ func IsGroupDiscoveryFailedError(err error) bool {
return err != nil && ok
}

// GroupDiscoveryFailedErrorGroups returns true if the error is an ErrGroupDiscoveryFailed error,
// along with the map of group versions that failed discovery.
func GroupDiscoveryFailedErrorGroups(err error) (map[schema.GroupVersion]error, bool) {
var groupDiscoveryError *ErrGroupDiscoveryFailed
if err != nil && goerrors.As(err, &groupDiscoveryError) {
return groupDiscoveryError.Groups, true
}
return nil, false
}

func ServerGroupsAndResources(d DiscoveryInterface) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
var sgs *metav1.APIGroupList
var resources []*metav1.APIResourceList
Expand Down

0 comments on commit daed746

Please sign in to comment.