mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 20:17:41 +00:00
Merge pull request #62234 from liggitt/apigroup-partial-discovery
Automatic merge from submit-queue (batch tested with PRs 61306, 60270, 62496, 62181, 62234). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Handle partial group and resource responses consistently GetAPIGroupResources tolerates partial discovery responses to provide as much information to the caller as possible. Before skipping a particular error response, check whether the response was accompanied by partial group or resource data. There's an existing TODO to propagate partial errors that I plan to address in a follow-up, but that had more ripples and I wanted to correct this first. ```release-note NONE ```
This commit is contained in:
commit
7ba97b9200
@ -144,7 +144,10 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
|
||||
func GetAPIGroupResources(cl DiscoveryInterface) ([]*APIGroupResources, error) {
|
||||
apiGroups, err := cl.ServerGroups()
|
||||
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
|
||||
for _, group := range apiGroups.Groups {
|
||||
@ -157,7 +160,9 @@ func GetAPIGroupResources(cl DiscoveryInterface) ([]*APIGroupResources, error) {
|
||||
if err != nil {
|
||||
// continue as best we can
|
||||
// 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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user