mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 22:05:59 +00:00
Add GroupDiscoveryFailedErrorGroups helper method
This commit is contained in:
parent
da2d500c80
commit
733f63c6c4
@ -19,6 +19,7 @@ package discovery
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
goerrors "errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -422,6 +423,16 @@ func IsGroupDiscoveryFailedError(err error) bool {
|
|||||||
return err != nil && ok
|
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) {
|
func ServerGroupsAndResources(d DiscoveryInterface) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
|
||||||
var sgs *metav1.APIGroupList
|
var sgs *metav1.APIGroupList
|
||||||
var resources []*metav1.APIResourceList
|
var resources []*metav1.APIResourceList
|
||||||
|
Loading…
Reference in New Issue
Block a user