Merge pull request #36753 from deads2k/cli-08-fix-watch

Automatic merge from submit-queue

let printer update unstructured list

Fixes https://github.com/kubernetes/kubernetes/issues/36749.

Didn't see any existing test in `test-cmd.sh` and I'm not sure how to make the watch stop in the test for reasonable testing.

@kubernetes/kubectl @kargakis
This commit is contained in:
Kubernetes Submit Queue 2016-11-14 09:15:57 -08:00 committed by GitHub
commit 9d4f6d19f1

View File

@ -2318,7 +2318,7 @@ func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) er
// check if the object is unstructured. If so, let's attempt to convert it to a type we can understand before
// trying to print, since the printers are keyed by type. This is extremely expensive.
switch obj.(type) {
case *runtime.Unstructured, *runtime.Unknown:
case *runtime.UnstructuredList, *runtime.Unstructured, *runtime.Unknown:
if objBytes, err := runtime.Encode(api.Codecs.LegacyCodec(), obj); err == nil {
if decodedObj, err := runtime.Decode(api.Codecs.UniversalDecoder(), objBytes); err == nil {
obj = decodedObj