mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #43896 from CaoShuFeng/list-meta
Automatic merge from submit-queue Reorganize the output of "kubectl get -o json" "resourceVersion" and "selfLink" are members of "metadata" rather than the list. This change reorganize the struct to provide consistency with other places. Before this change: ```json "kind": "List", "metadata": {}, "resourceVersion": "", "selfLink": "" ``` After this change: ```json "kind": "List", "metadata": { "resourceVersion": "", "selfLink": "" } ``` Reference: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go#L57 **Release note**: ```release-note NONE ```
This commit is contained in:
commit
e7ca665a0d
@ -362,8 +362,10 @@ func RunGet(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args [
|
||||
},
|
||||
}
|
||||
if listMeta, err := meta.ListAccessor(obj); err == nil {
|
||||
list.Object["selfLink"] = listMeta.GetSelfLink()
|
||||
list.Object["resourceVersion"] = listMeta.GetResourceVersion()
|
||||
list.Object["metadata"] = map[string]interface{}{
|
||||
"selfLink": listMeta.GetSelfLink(),
|
||||
"resourceVersion": listMeta.GetResourceVersion(),
|
||||
}
|
||||
}
|
||||
|
||||
for _, item := range items {
|
||||
|
@ -603,7 +603,7 @@ func TestGetMultipleTypeObjectsAsList(t *testing.T) {
|
||||
}
|
||||
|
||||
expected := &unstructured.UnstructuredList{
|
||||
Object: map[string]interface{}{"kind": "List", "apiVersion": "v1", "metadata": map[string]interface{}{}, "selfLink": "", "resourceVersion": ""},
|
||||
Object: map[string]interface{}{"kind": "List", "apiVersion": "v1", "metadata": map[string]interface{}{"selfLink": "", "resourceVersion": ""}},
|
||||
Items: []unstructured.Unstructured{
|
||||
fn(&pods.Items[0]),
|
||||
fn(&pods.Items[1]),
|
||||
|
Loading…
Reference in New Issue
Block a user