mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-25 06:31:35 +00:00
Handle partial group and resource responses consistently
Kubernetes-commit: e203c4e42b9037a6800dbc0dc433c63fc8cf7516
This commit is contained in:
parent
92a7e05901
commit
bc399996ff
@ -144,8 +144,11 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
|
|||||||
func GetAPIGroupResources(cl DiscoveryInterface) ([]*APIGroupResources, error) {
|
func GetAPIGroupResources(cl DiscoveryInterface) ([]*APIGroupResources, error) {
|
||||||
apiGroups, err := cl.ServerGroups()
|
apiGroups, err := cl.ServerGroups()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if apiGroups == nil || len(apiGroups.Groups) == 0 {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// TODO track the errors and update callers to handle partial errors.
|
||||||
|
}
|
||||||
var result []*APIGroupResources
|
var result []*APIGroupResources
|
||||||
for _, group := range apiGroups.Groups {
|
for _, group := range apiGroups.Groups {
|
||||||
groupResources := &APIGroupResources{
|
groupResources := &APIGroupResources{
|
||||||
@ -157,8 +160,10 @@ func GetAPIGroupResources(cl DiscoveryInterface) ([]*APIGroupResources, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// continue as best we can
|
// continue as best we can
|
||||||
// TODO track the errors and update callers to handle partial errors.
|
// TODO track the errors and update callers to handle partial errors.
|
||||||
|
if resources == nil || len(resources.APIResources) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
}
|
||||||
groupResources.VersionedResources[version.Version] = resources.APIResources
|
groupResources.VersionedResources[version.Version] = resources.APIResources
|
||||||
}
|
}
|
||||||
result = append(result, groupResources)
|
result = append(result, groupResources)
|
||||||
|
Loading…
Reference in New Issue
Block a user