mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-17 00:31:27 +00:00
core/v1 should be first in discovery order
Currently, core/v1 is in the end of the discovery order. Since core/v1 is special, it should be in the beginning. Kubernetes-commit: 45950fdb750d7ac12cec3b9ef3487baa99a40401
This commit is contained in:
parent
e2d750fcad
commit
c4f02185e3
@ -145,9 +145,9 @@ func (d *DiscoveryClient) ServerGroups() (apiGroupList *metav1.APIGroupList, err
|
||||
apiGroupList = &metav1.APIGroupList{}
|
||||
}
|
||||
|
||||
// append the group retrieved from /api to the list if not empty
|
||||
// prepend the group retrieved from /api to the list if not empty
|
||||
if len(v.Versions) != 0 {
|
||||
apiGroupList.Groups = append(apiGroupList.Groups, apiGroup)
|
||||
apiGroupList.Groups = append([]metav1.APIGroup{apiGroup}, apiGroupList.Groups...)
|
||||
}
|
||||
return apiGroupList, nil
|
||||
}
|
||||
|
@ -74,6 +74,17 @@ func TestGetServerGroupsWithV1Server(t *testing.T) {
|
||||
"v1",
|
||||
},
|
||||
}
|
||||
case "/apis":
|
||||
obj = &metav1.APIGroupList{
|
||||
Groups: []metav1.APIGroup{
|
||||
{
|
||||
Name: "extensions",
|
||||
Versions: []metav1.GroupVersionForDiscovery{
|
||||
{GroupVersion: "extensions/v1beta1"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
default:
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
@ -95,8 +106,8 @@ func TestGetServerGroupsWithV1Server(t *testing.T) {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
groupVersions := metav1.ExtractGroupVersions(apiGroupList)
|
||||
if !reflect.DeepEqual(groupVersions, []string{"v1"}) {
|
||||
t.Errorf("expected: %q, got: %q", []string{"v1"}, groupVersions)
|
||||
if !reflect.DeepEqual(groupVersions, []string{"v1", "extensions/v1beta1"}) {
|
||||
t.Errorf("expected: %q, got: %q", []string{"v1", "extensions/v1beta1"}, groupVersions)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user