mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-26 15:12:06 +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 ``` Kubernetes-commit: 7ba97b9200a9cab45f59a81ab8b44fca8ee863eb
This commit is contained in:
commit
dd40bd1fb2
58
Godeps/Godeps.json
generated
58
Godeps/Godeps.json
generated
@ -244,119 +244,119 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
|
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/admissionregistration/v1beta1",
|
"ImportPath": "k8s.io/api/admissionregistration/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/apps/v1",
|
"ImportPath": "k8s.io/api/apps/v1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/apps/v1beta1",
|
"ImportPath": "k8s.io/api/apps/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/apps/v1beta2",
|
"ImportPath": "k8s.io/api/apps/v1beta2",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/authentication/v1",
|
"ImportPath": "k8s.io/api/authentication/v1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/authentication/v1beta1",
|
"ImportPath": "k8s.io/api/authentication/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/authorization/v1",
|
"ImportPath": "k8s.io/api/authorization/v1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/authorization/v1beta1",
|
"ImportPath": "k8s.io/api/authorization/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/autoscaling/v1",
|
"ImportPath": "k8s.io/api/autoscaling/v1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
|
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/batch/v1",
|
"ImportPath": "k8s.io/api/batch/v1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/batch/v1beta1",
|
"ImportPath": "k8s.io/api/batch/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/batch/v2alpha1",
|
"ImportPath": "k8s.io/api/batch/v2alpha1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/certificates/v1beta1",
|
"ImportPath": "k8s.io/api/certificates/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/core/v1",
|
"ImportPath": "k8s.io/api/core/v1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/events/v1beta1",
|
"ImportPath": "k8s.io/api/events/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/extensions/v1beta1",
|
"ImportPath": "k8s.io/api/extensions/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/imagepolicy/v1alpha1",
|
"ImportPath": "k8s.io/api/imagepolicy/v1alpha1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/networking/v1",
|
"ImportPath": "k8s.io/api/networking/v1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/policy/v1beta1",
|
"ImportPath": "k8s.io/api/policy/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/rbac/v1",
|
"ImportPath": "k8s.io/api/rbac/v1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/rbac/v1alpha1",
|
"ImportPath": "k8s.io/api/rbac/v1alpha1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/rbac/v1beta1",
|
"ImportPath": "k8s.io/api/rbac/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
|
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/settings/v1alpha1",
|
"ImportPath": "k8s.io/api/settings/v1alpha1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/storage/v1",
|
"ImportPath": "k8s.io/api/storage/v1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/storage/v1alpha1",
|
"ImportPath": "k8s.io/api/storage/v1alpha1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/api/storage/v1beta1",
|
"ImportPath": "k8s.io/api/storage/v1beta1",
|
||||||
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
|
"Rev": "b2cf9c5556ca5601d7b4e9ecc67b704426bf96c6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
||||||
|
@ -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