Commit e7ca665a authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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 ```
parents 1235365a a6db26d5
......@@ -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]),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment