mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update kubernetes to v1.20.0
updated kubernetes packages to latest release. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
4abe128bd8
commit
83559144b1
43
vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
generated
vendored
43
vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
generated
vendored
@ -18,7 +18,6 @@ package runtime
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
@ -105,9 +104,6 @@ func NewScheme() *Scheme {
|
||||
// Enable couple default conversions by default.
|
||||
utilruntime.Must(RegisterEmbeddedConversions(s))
|
||||
utilruntime.Must(RegisterStringConversions(s))
|
||||
|
||||
utilruntime.Must(s.RegisterInputDefaults(&map[string][]string{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields))
|
||||
utilruntime.Must(s.RegisterInputDefaults(&url.Values{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields))
|
||||
return s
|
||||
}
|
||||
|
||||
@ -211,6 +207,19 @@ func (s *Scheme) AddKnownTypeWithName(gvk schema.GroupVersionKind, obj Object) {
|
||||
}
|
||||
}
|
||||
s.typeToGVK[t] = append(s.typeToGVK[t], gvk)
|
||||
|
||||
// if the type implements DeepCopyInto(<obj>), register a self-conversion
|
||||
if m := reflect.ValueOf(obj).MethodByName("DeepCopyInto"); m.IsValid() && m.Type().NumIn() == 1 && m.Type().NumOut() == 0 && m.Type().In(0) == reflect.TypeOf(obj) {
|
||||
if err := s.AddGeneratedConversionFunc(obj, obj, func(a, b interface{}, scope conversion.Scope) error {
|
||||
// copy a to b
|
||||
reflect.ValueOf(a).MethodByName("DeepCopyInto").Call([]reflect.Value{reflect.ValueOf(b)})
|
||||
// clear TypeMeta to match legacy reflective conversion
|
||||
b.(Object).GetObjectKind().SetGroupVersionKind(schema.GroupVersionKind{})
|
||||
return nil
|
||||
}); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// KnownTypes returns the types known for the given version.
|
||||
@ -296,11 +305,6 @@ func (s *Scheme) New(kind schema.GroupVersionKind) (Object, error) {
|
||||
return nil, NewNotRegisteredErrForKind(s.schemeName, kind)
|
||||
}
|
||||
|
||||
// Log sets a logger on the scheme. For test purposes only
|
||||
func (s *Scheme) Log(l conversion.DebugLogger) {
|
||||
s.converter.Debug = l
|
||||
}
|
||||
|
||||
// AddIgnoredConversionType identifies a pair of types that should be skipped by
|
||||
// conversion (because the data inside them is explicitly dropped during
|
||||
// conversion).
|
||||
@ -329,14 +333,6 @@ func (s *Scheme) AddFieldLabelConversionFunc(gvk schema.GroupVersionKind, conver
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterInputDefaults sets the provided field mapping function and field matching
|
||||
// as the defaults for the provided input type. The fn may be nil, in which case no
|
||||
// mapping will happen by default. Use this method to register a mechanism for handling
|
||||
// a specific input type in conversion, such as a map[string]string to structs.
|
||||
func (s *Scheme) RegisterInputDefaults(in interface{}, fn conversion.FieldMappingFunc, defaultFlags conversion.FieldMatchingFlags) error {
|
||||
return s.converter.RegisterInputDefaults(in, fn, defaultFlags)
|
||||
}
|
||||
|
||||
// AddTypeDefaultingFunc registers a function that is passed a pointer to an
|
||||
// object and can default fields on the object. These functions will be invoked
|
||||
// when Default() is called. The function will never be called unless the
|
||||
@ -420,12 +416,9 @@ func (s *Scheme) Convert(in, out interface{}, context interface{}) error {
|
||||
in = typed
|
||||
}
|
||||
|
||||
flags, meta := s.generateConvertMeta(in)
|
||||
meta := s.generateConvertMeta(in)
|
||||
meta.Context = context
|
||||
if flags == 0 {
|
||||
flags = conversion.AllowDifferentFieldTypeNames
|
||||
}
|
||||
return s.converter.Convert(in, out, flags, meta)
|
||||
return s.converter.Convert(in, out, meta)
|
||||
}
|
||||
|
||||
// ConvertFieldLabel alters the given field label and value for an kind field selector from
|
||||
@ -522,9 +515,9 @@ func (s *Scheme) convertToVersion(copy bool, in Object, target GroupVersioner) (
|
||||
in = in.DeepCopyObject()
|
||||
}
|
||||
|
||||
flags, meta := s.generateConvertMeta(in)
|
||||
meta := s.generateConvertMeta(in)
|
||||
meta.Context = target
|
||||
if err := s.converter.Convert(in, out, flags, meta); err != nil {
|
||||
if err := s.converter.Convert(in, out, meta); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -552,7 +545,7 @@ func (s *Scheme) unstructuredToTyped(in Unstructured) (Object, error) {
|
||||
}
|
||||
|
||||
// generateConvertMeta constructs the meta value we pass to Convert.
|
||||
func (s *Scheme) generateConvertMeta(in interface{}) (conversion.FieldMatchingFlags, *conversion.Meta) {
|
||||
func (s *Scheme) generateConvertMeta(in interface{}) *conversion.Meta {
|
||||
return s.converter.DefaultMeta(reflect.TypeOf(in))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user