mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-26 07:02:01 +00:00
Merge pull request #59342 from nikhita/discovery-corev1-order
Automatic merge from submit-queue. 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>. core/v1 should be first in the discovery order Currently, `core/v1` is at the end of the discovery order. See https://github.com/kubernetes/kubernetes/issues/42521#issuecomment-360517775. **Release note**: ```release-note NONE ``` /assign sttts liggitt Kubernetes-commit: d8928efc8a0742d245af357e66ff264ac17327ca
This commit is contained in:
commit
847d15469a
@ -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