mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
Handle partial group and resource responses consistently
This commit is contained in:
parent
d371be33f7
commit
e203c4e42b
@ -144,7 +144,10 @@ 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 {
|
||||||
return nil, err
|
if apiGroups == nil || len(apiGroups.Groups) == 0 {
|
||||||
|
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 {
|
||||||
@ -157,7 +160,9 @@ 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.
|
||||||
continue
|
if resources == nil || len(resources.APIResources) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
groupResources.VersionedResources[version.Version] = resources.APIResources
|
groupResources.VersionedResources[version.Version] = resources.APIResources
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user