Update go dependencies
This commit is contained in:
parent
d5cf22c129
commit
063cc68d1c
1321 changed files with 52830 additions and 31081 deletions
28
vendor/k8s.io/apimachinery/pkg/runtime/converter.go
generated
vendored
28
vendor/k8s.io/apimachinery/pkg/runtime/converter.go
generated
vendored
|
|
@ -73,7 +73,6 @@ var (
|
|||
mapStringInterfaceType = reflect.TypeOf(map[string]interface{}{})
|
||||
stringType = reflect.TypeOf(string(""))
|
||||
int64Type = reflect.TypeOf(int64(0))
|
||||
uint64Type = reflect.TypeOf(uint64(0))
|
||||
float64Type = reflect.TypeOf(float64(0))
|
||||
boolType = reflect.TypeOf(bool(false))
|
||||
fieldCache = newFieldsCache()
|
||||
|
|
@ -411,8 +410,7 @@ func (c *unstructuredConverter) ToUnstructured(obj interface{}) (map[string]inte
|
|||
var u map[string]interface{}
|
||||
var err error
|
||||
if unstr, ok := obj.(Unstructured); ok {
|
||||
// UnstructuredContent() mutates the object so we need to make a copy first
|
||||
u = unstr.DeepCopyObject().(Unstructured).UnstructuredContent()
|
||||
u = unstr.UnstructuredContent()
|
||||
} else {
|
||||
t := reflect.TypeOf(obj)
|
||||
value := reflect.ValueOf(obj)
|
||||
|
|
@ -439,22 +437,32 @@ func (c *unstructuredConverter) ToUnstructured(obj interface{}) (map[string]inte
|
|||
}
|
||||
|
||||
// DeepCopyJSON deep copies the passed value, assuming it is a valid JSON representation i.e. only contains
|
||||
// types produced by json.Unmarshal().
|
||||
// types produced by json.Unmarshal() and also int64.
|
||||
// bool, int64, float64, string, []interface{}, map[string]interface{}, json.Number and nil
|
||||
func DeepCopyJSON(x map[string]interface{}) map[string]interface{} {
|
||||
return DeepCopyJSONValue(x).(map[string]interface{})
|
||||
}
|
||||
|
||||
// DeepCopyJSONValue deep copies the passed value, assuming it is a valid JSON representation i.e. only contains
|
||||
// types produced by json.Unmarshal().
|
||||
// types produced by json.Unmarshal() and also int64.
|
||||
// bool, int64, float64, string, []interface{}, map[string]interface{}, json.Number and nil
|
||||
func DeepCopyJSONValue(x interface{}) interface{} {
|
||||
switch x := x.(type) {
|
||||
case map[string]interface{}:
|
||||
if x == nil {
|
||||
// Typed nil - an interface{} that contains a type map[string]interface{} with a value of nil
|
||||
return x
|
||||
}
|
||||
clone := make(map[string]interface{}, len(x))
|
||||
for k, v := range x {
|
||||
clone[k] = DeepCopyJSONValue(v)
|
||||
}
|
||||
return clone
|
||||
case []interface{}:
|
||||
if x == nil {
|
||||
// Typed nil - an interface{} that contains a type []interface{} with a value of nil
|
||||
return x
|
||||
}
|
||||
clone := make([]interface{}, len(x))
|
||||
for i, v := range x {
|
||||
clone[i] = DeepCopyJSONValue(v)
|
||||
|
|
@ -584,10 +592,14 @@ func toUnstructured(sv, dv reflect.Value) error {
|
|||
dv.Set(reflect.ValueOf(sv.Int()))
|
||||
return nil
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
dv.Set(reflect.New(uint64Type))
|
||||
uVal := sv.Uint()
|
||||
if uVal > math.MaxInt64 {
|
||||
return fmt.Errorf("unsigned value %d does not fit into int64 (overflow)", uVal)
|
||||
}
|
||||
dv.Set(reflect.ValueOf(sv.Uint()))
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
dv.Set(reflect.New(int64Type))
|
||||
}
|
||||
dv.Set(reflect.ValueOf(int64(uVal)))
|
||||
return nil
|
||||
case reflect.Float32, reflect.Float64:
|
||||
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
|
||||
|
|
|
|||
8
vendor/k8s.io/apimachinery/pkg/runtime/error.go
generated
vendored
8
vendor/k8s.io/apimachinery/pkg/runtime/error.go
generated
vendored
|
|
@ -41,10 +41,18 @@ func NewNotRegisteredErrForTarget(t reflect.Type, target GroupVersioner) error {
|
|||
return ¬RegisteredErr{t: t, target: target}
|
||||
}
|
||||
|
||||
func NewNotRegisteredGVKErrForTarget(gvk schema.GroupVersionKind, target GroupVersioner) error {
|
||||
return ¬RegisteredErr{gvk: gvk, target: target}
|
||||
}
|
||||
|
||||
func (k *notRegisteredErr) Error() string {
|
||||
if k.t != nil && k.target != nil {
|
||||
return fmt.Sprintf("%v is not suitable for converting to %q", k.t, k.target)
|
||||
}
|
||||
nullGVK := schema.GroupVersionKind{}
|
||||
if k.gvk != nullGVK && k.target != nil {
|
||||
return fmt.Sprintf("%q is not suitable for converting to %q", k.gvk.GroupVersion(), k.target)
|
||||
}
|
||||
if k.t != nil {
|
||||
return fmt.Sprintf("no kind is registered for the type %v", k.t)
|
||||
}
|
||||
|
|
|
|||
2
vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
2
vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
17
vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
generated
vendored
17
vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
generated
vendored
|
|
@ -174,13 +174,16 @@ type ObjectVersioner interface {
|
|||
|
||||
// ObjectConvertor converts an object to a different version.
|
||||
type ObjectConvertor interface {
|
||||
// Convert attempts to convert one object into another, or returns an error. This method does
|
||||
// not guarantee the in object is not mutated. The context argument will be passed to
|
||||
// all nested conversions.
|
||||
// Convert attempts to convert one object into another, or returns an error. This
|
||||
// method does not mutate the in object, but the in and out object might share data structures,
|
||||
// i.e. the out object cannot be mutated without mutating the in object as well.
|
||||
// The context argument will be passed to all nested conversions.
|
||||
Convert(in, out, context interface{}) error
|
||||
// ConvertToVersion takes the provided object and converts it the provided version. This
|
||||
// method does not guarantee that the in object is not mutated. This method is similar to
|
||||
// Convert() but handles specific details of choosing the correct output version.
|
||||
// method does not mutate the in object, but the in and out object might share data structures,
|
||||
// i.e. the out object cannot be mutated without mutating the in object as well.
|
||||
// This method is similar to Convert() but handles specific details of choosing the correct
|
||||
// output version.
|
||||
ConvertToVersion(in Object, gv GroupVersioner) (out Object, err error)
|
||||
ConvertFieldLabel(version, kind, label, value string) (string, string, error)
|
||||
}
|
||||
|
|
@ -234,9 +237,9 @@ type Object interface {
|
|||
// to JSON allowed.
|
||||
type Unstructured interface {
|
||||
Object
|
||||
// UnstructuredContent returns a non-nil, mutable map of the contents of this object. Values may be
|
||||
// UnstructuredContent returns a non-nil map with this object's contents. Values may be
|
||||
// []interface{}, map[string]interface{}, or any primitive type. Contents are typically serialized to
|
||||
// and from JSON.
|
||||
// and from JSON. SetUnstructuredContent should be used to mutate the contents.
|
||||
UnstructuredContent() map[string]interface{}
|
||||
// SetUnstructuredContent updates the object content to match the provided map.
|
||||
SetUnstructuredContent(map[string]interface{})
|
||||
|
|
|
|||
2
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
2
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
146
vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
generated
vendored
146
vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
generated
vendored
|
|
@ -21,8 +21,11 @@ import (
|
|||
"net/url"
|
||||
"reflect"
|
||||
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
)
|
||||
|
||||
// Scheme defines methods for serializing and deserializing API objects, a type
|
||||
|
|
@ -68,6 +71,13 @@ type Scheme struct {
|
|||
// converter stores all registered conversion functions. It also has
|
||||
// default coverting behavior.
|
||||
converter *conversion.Converter
|
||||
|
||||
// versionPriority is a map of groups to ordered lists of versions for those groups indicating the
|
||||
// default priorities of these versions as registered in the scheme
|
||||
versionPriority map[string][]string
|
||||
|
||||
// observedVersions keeps track of the order we've seen versions during type registration
|
||||
observedVersions []schema.GroupVersion
|
||||
}
|
||||
|
||||
// Function to convert a field selector to internal representation.
|
||||
|
|
@ -82,6 +92,7 @@ func NewScheme() *Scheme {
|
|||
unversionedKinds: map[string]reflect.Type{},
|
||||
fieldLabelConversionFuncs: map[string]map[string]FieldLabelConversionFunc{},
|
||||
defaulterFuncs: map[reflect.Type]func(interface{}){},
|
||||
versionPriority: map[string][]string{},
|
||||
}
|
||||
s.converter = conversion.NewConverter(s.nameFunc)
|
||||
|
||||
|
|
@ -111,7 +122,7 @@ func (s *Scheme) nameFunc(t reflect.Type) string {
|
|||
|
||||
for _, gvk := range gvks {
|
||||
internalGV := gvk.GroupVersion()
|
||||
internalGV.Version = "__internal" // this is hacky and maybe should be passed in
|
||||
internalGV.Version = APIVersionInternal // this is hacky and maybe should be passed in
|
||||
internalGVK := internalGV.WithKind(gvk.Kind)
|
||||
|
||||
if internalType, exists := s.gvkToType[internalGVK]; exists {
|
||||
|
|
@ -141,6 +152,7 @@ func (s *Scheme) Converter() *conversion.Converter {
|
|||
// TODO: there is discussion about removing unversioned and replacing it with objects that are manifest into
|
||||
// every version with particular schemas. Resolve this method at that point.
|
||||
func (s *Scheme) AddUnversionedTypes(version schema.GroupVersion, types ...Object) {
|
||||
s.addObservedVersion(version)
|
||||
s.AddKnownTypes(version, types...)
|
||||
for _, obj := range types {
|
||||
t := reflect.TypeOf(obj).Elem()
|
||||
|
|
@ -158,6 +170,7 @@ func (s *Scheme) AddUnversionedTypes(version schema.GroupVersion, types ...Objec
|
|||
// the struct becomes the "kind" field when encoding. Version may not be empty - use the
|
||||
// APIVersionInternal constant if you have a type that does not have a formal version.
|
||||
func (s *Scheme) AddKnownTypes(gv schema.GroupVersion, types ...Object) {
|
||||
s.addObservedVersion(gv)
|
||||
for _, obj := range types {
|
||||
t := reflect.TypeOf(obj)
|
||||
if t.Kind() != reflect.Ptr {
|
||||
|
|
@ -173,6 +186,7 @@ func (s *Scheme) AddKnownTypes(gv schema.GroupVersion, types ...Object) {
|
|||
// your structs. Version may not be empty - use the APIVersionInternal constant if you have a
|
||||
// type that does not have a formal version.
|
||||
func (s *Scheme) AddKnownTypeWithName(gvk schema.GroupVersionKind, obj Object) {
|
||||
s.addObservedVersion(gvk.GroupVersion())
|
||||
t := reflect.TypeOf(obj)
|
||||
if len(gvk.Version) == 0 {
|
||||
panic(fmt.Sprintf("version is required on all types: %s %v", gvk, t))
|
||||
|
|
@ -620,3 +634,133 @@ func setTargetKind(obj Object, kind schema.GroupVersionKind) {
|
|||
}
|
||||
obj.GetObjectKind().SetGroupVersionKind(kind)
|
||||
}
|
||||
|
||||
// SetVersionPriority allows specifying a precise order of priority. All specified versions must be in the same group,
|
||||
// and the specified order overwrites any previously specified order for this group
|
||||
func (s *Scheme) SetVersionPriority(versions ...schema.GroupVersion) error {
|
||||
groups := sets.String{}
|
||||
order := []string{}
|
||||
for _, version := range versions {
|
||||
if len(version.Version) == 0 || version.Version == APIVersionInternal {
|
||||
return fmt.Errorf("internal versions cannot be prioritized: %v", version)
|
||||
}
|
||||
|
||||
groups.Insert(version.Group)
|
||||
order = append(order, version.Version)
|
||||
}
|
||||
if len(groups) != 1 {
|
||||
return fmt.Errorf("must register versions for exactly one group: %v", strings.Join(groups.List(), ", "))
|
||||
}
|
||||
|
||||
s.versionPriority[groups.List()[0]] = order
|
||||
return nil
|
||||
}
|
||||
|
||||
// PrioritizedVersionsForGroup returns versions for a single group in priority order
|
||||
func (s *Scheme) PrioritizedVersionsForGroup(group string) []schema.GroupVersion {
|
||||
ret := []schema.GroupVersion{}
|
||||
for _, version := range s.versionPriority[group] {
|
||||
ret = append(ret, schema.GroupVersion{Group: group, Version: version})
|
||||
}
|
||||
for _, observedVersion := range s.observedVersions {
|
||||
if observedVersion.Group != group {
|
||||
continue
|
||||
}
|
||||
found := false
|
||||
for _, existing := range ret {
|
||||
if existing == observedVersion {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
ret = append(ret, observedVersion)
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
// PrioritizedVersionsAllGroups returns all known versions in their priority order. Groups are random, but
|
||||
// versions for a single group are prioritized
|
||||
func (s *Scheme) PrioritizedVersionsAllGroups() []schema.GroupVersion {
|
||||
ret := []schema.GroupVersion{}
|
||||
for group, versions := range s.versionPriority {
|
||||
for _, version := range versions {
|
||||
ret = append(ret, schema.GroupVersion{Group: group, Version: version})
|
||||
}
|
||||
}
|
||||
for _, observedVersion := range s.observedVersions {
|
||||
found := false
|
||||
for _, existing := range ret {
|
||||
if existing == observedVersion {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
ret = append(ret, observedVersion)
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// PreferredVersionAllGroups returns the most preferred version for every group.
|
||||
// group ordering is random.
|
||||
func (s *Scheme) PreferredVersionAllGroups() []schema.GroupVersion {
|
||||
ret := []schema.GroupVersion{}
|
||||
for group, versions := range s.versionPriority {
|
||||
for _, version := range versions {
|
||||
ret = append(ret, schema.GroupVersion{Group: group, Version: version})
|
||||
break
|
||||
}
|
||||
}
|
||||
for _, observedVersion := range s.observedVersions {
|
||||
found := false
|
||||
for _, existing := range ret {
|
||||
if existing.Group == observedVersion.Group {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
ret = append(ret, observedVersion)
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
// IsGroupRegistered returns true if types for the group have been registered with the scheme
|
||||
func (s *Scheme) IsGroupRegistered(group string) bool {
|
||||
for _, observedVersion := range s.observedVersions {
|
||||
if observedVersion.Group == group {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsVersionRegistered returns true if types for the version have been registered with the scheme
|
||||
func (s *Scheme) IsVersionRegistered(version schema.GroupVersion) bool {
|
||||
for _, observedVersion := range s.observedVersions {
|
||||
if observedVersion == version {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (s *Scheme) addObservedVersion(version schema.GroupVersion) {
|
||||
if len(version.Version) == 0 || version.Version == APIVersionInternal {
|
||||
return
|
||||
}
|
||||
for _, observedVersion := range s.observedVersions {
|
||||
if observedVersion == version {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
s.observedVersions = append(s.observedVersions, version)
|
||||
}
|
||||
|
|
|
|||
27
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
27
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
generated
vendored
|
|
@ -75,11 +75,6 @@ func init() {
|
|||
case jsoniter.NumberValue:
|
||||
var number json.Number
|
||||
iter.ReadVal(&number)
|
||||
u64, err := strconv.ParseUint(string(number), 10, 64)
|
||||
if err == nil {
|
||||
*(*interface{})(ptr) = u64
|
||||
return
|
||||
}
|
||||
i64, err := strconv.ParseInt(string(number), 10, 64)
|
||||
if err == nil {
|
||||
*(*interface{})(ptr) = i64
|
||||
|
|
@ -98,6 +93,20 @@ func init() {
|
|||
jsoniter.RegisterTypeDecoderFunc("interface {}", decodeNumberAsInt64IfPossible)
|
||||
}
|
||||
|
||||
// CaseSensitiveJsonIterator returns a jsoniterator API that's configured to be
|
||||
// case-sensitive when unmarshalling, and otherwise compatible with
|
||||
// the encoding/json standard library.
|
||||
func CaseSensitiveJsonIterator() jsoniter.API {
|
||||
return jsoniter.Config{
|
||||
EscapeHTML: true,
|
||||
SortMapKeys: true,
|
||||
ValidateJsonRawMessage: true,
|
||||
CaseSensitive: true,
|
||||
}.Froze()
|
||||
}
|
||||
|
||||
var caseSensitiveJsonIterator = CaseSensitiveJsonIterator()
|
||||
|
||||
// gvkWithDefaults returns group kind and version defaulting from provided default
|
||||
func gvkWithDefaults(actual, defaultGVK schema.GroupVersionKind) schema.GroupVersionKind {
|
||||
if len(actual.Kind) == 0 {
|
||||
|
|
@ -162,7 +171,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
|||
types, _, err := s.typer.ObjectKinds(into)
|
||||
switch {
|
||||
case runtime.IsNotRegisteredError(err), isUnstructured:
|
||||
if err := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(data, into); err != nil {
|
||||
if err := caseSensitiveJsonIterator.Unmarshal(data, into); err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
return into, actual, nil
|
||||
|
|
@ -186,7 +195,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
|||
return nil, actual, err
|
||||
}
|
||||
|
||||
if err := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(data, obj); err != nil {
|
||||
if err := caseSensitiveJsonIterator.Unmarshal(data, obj); err != nil {
|
||||
return nil, actual, err
|
||||
}
|
||||
return obj, actual, nil
|
||||
|
|
@ -195,7 +204,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
|
|||
// Encode serializes the provided object to the given writer.
|
||||
func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
||||
if s.yaml {
|
||||
json, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(obj)
|
||||
json, err := caseSensitiveJsonIterator.Marshal(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -208,7 +217,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
|||
}
|
||||
|
||||
if s.pretty {
|
||||
data, err := jsoniter.ConfigCompatibleWithStandardLibrary.MarshalIndent(obj, "", " ")
|
||||
data, err := caseSensitiveJsonIterator.MarshalIndent(obj, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
23
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
generated
vendored
23
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
generated
vendored
|
|
@ -19,6 +19,7 @@ package versioning
|
|||
import (
|
||||
"io"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
|
@ -166,9 +167,27 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
|
|||
// Encode ensures the provided object is output in the appropriate group and version, invoking
|
||||
// conversion if necessary. Unversioned objects (according to the ObjectTyper) are output as is.
|
||||
func (c *codec) Encode(obj runtime.Object, w io.Writer) error {
|
||||
switch obj.(type) {
|
||||
case *runtime.Unknown, runtime.Unstructured:
|
||||
switch obj := obj.(type) {
|
||||
case *runtime.Unknown:
|
||||
return c.encoder.Encode(obj, w)
|
||||
case runtime.Unstructured:
|
||||
// An unstructured list can contain objects of multiple group version kinds. don't short-circuit just
|
||||
// because the top-level type matches our desired destination type. actually send the object to the converter
|
||||
// to give it a chance to convert the list items if needed.
|
||||
if _, ok := obj.(*unstructured.UnstructuredList); !ok {
|
||||
// avoid conversion roundtrip if GVK is the right one already or is empty (yes, this is a hack, but the old behaviour we rely on in kubectl)
|
||||
objGVK := obj.GetObjectKind().GroupVersionKind()
|
||||
if len(objGVK.Version) == 0 {
|
||||
return c.encoder.Encode(obj, w)
|
||||
}
|
||||
targetGVK, ok := c.encodeVersion.KindForGroupVersionKinds([]schema.GroupVersionKind{objGVK})
|
||||
if !ok {
|
||||
return runtime.NewNotRegisteredGVKErrForTarget(objGVK, c.encodeVersion)
|
||||
}
|
||||
if targetGVK == objGVK {
|
||||
return c.encoder.Encode(obj, w)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gvks, isUnversioned, err := c.typer.ObjectKinds(obj)
|
||||
|
|
|
|||
2
vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go
generated
vendored
|
|
@ -1,7 +1,7 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue