mirror of https://github.com/k3s-io/k3s
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: "kind": "List", "metadata": {}, "resourceVersion": "", "selfLink": "" After this change: "kind": "List", "metadata": { "resourceVersion": "", "selfLink": "" } Reference: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go#L57pull/6/head
parent
b4c76c6aa2
commit
a6db26d5b7
|
@ -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