kubectl: add JSON fallback codec to cope with more strict stock versioning codec

This commit is contained in:
Dr. Stefan Schimanski
2018-02-22 18:01:48 +01:00
parent ca9d1f728b
commit 0fc2c48444
6 changed files with 32 additions and 7 deletions

View File

@@ -45,6 +45,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
utilflag "k8s.io/apiserver/pkg/util/flag"
@@ -662,5 +663,6 @@ func InternalVersionDecoder() runtime.Decoder {
}
func InternalVersionJSONEncoder() runtime.Encoder {
return legacyscheme.Codecs.LegacyCodec(legacyscheme.Registry.EnabledVersions()...)
encoder := legacyscheme.Codecs.LegacyCodec(legacyscheme.Registry.EnabledVersions()...)
return unstructured.JSONFallbackEncoder{Encoder: encoder}
}