mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Check whether apiversions is empty
This commit is contained in:
parent
7e1cacaa91
commit
4acb99df52
@ -123,7 +123,7 @@ func (d *DiscoveryClient) ServerGroups() (apiGroupList *metav1.APIGroupList, err
|
|||||||
v := &metav1.APIVersions{}
|
v := &metav1.APIVersions{}
|
||||||
err = d.restClient.Get().AbsPath(d.LegacyPrefix).Do().Into(v)
|
err = d.restClient.Get().AbsPath(d.LegacyPrefix).Do().Into(v)
|
||||||
apiGroup := metav1.APIGroup{}
|
apiGroup := metav1.APIGroup{}
|
||||||
if err == nil {
|
if err == nil && len(v.Versions) != 0 {
|
||||||
apiGroup = apiVersionsToAPIGroup(v)
|
apiGroup = apiVersionsToAPIGroup(v)
|
||||||
}
|
}
|
||||||
if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
|
if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
|
||||||
@ -141,8 +141,10 @@ func (d *DiscoveryClient) ServerGroups() (apiGroupList *metav1.APIGroupList, err
|
|||||||
apiGroupList = &metav1.APIGroupList{}
|
apiGroupList = &metav1.APIGroupList{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// append the group retrieved from /api to the list
|
// append the group retrieved from /api to the list if not empty
|
||||||
apiGroupList.Groups = append(apiGroupList.Groups, apiGroup)
|
if len(v.Versions) != 0 {
|
||||||
|
apiGroupList.Groups = append(apiGroupList.Groups, apiGroup)
|
||||||
|
}
|
||||||
return apiGroupList, nil
|
return apiGroupList, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user