aboutsummaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-08 12:59:42 +0200
committerGitHub <noreply@github.com>2020-05-08 12:59:42 +0200
commit4b300a12cedabff3c57ee657afac0696cefaae0a (patch)
tree61c5fceec50e88338038415fa1375371bef2dca4 /vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
parent70e7fc670be13d3877e65e160456c312e23a5806 (diff)
parent2f0bc5ff1cde9afb595868b92dd123478af9ef74 (diff)
downloadpodman-4b300a12cedabff3c57ee657afac0696cefaae0a.tar.gz
podman-4b300a12cedabff3c57ee657afac0696cefaae0a.tar.bz2
podman-4b300a12cedabff3c57ee657afac0696cefaae0a.zip
Merge pull request #6086 from containers/dependabot/go_modules/k8s.io/api-0.18.2
Bump k8s.io/api from 0.17.4 to 0.18.2
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/runtime/scheme.go')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/scheme.go45
1 files changed, 3 insertions, 42 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
index fd37e293a..4b739ec38 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
@@ -102,10 +102,10 @@ func NewScheme() *Scheme {
}
s.converter = conversion.NewConverter(s.nameFunc)
- utilruntime.Must(s.AddConversionFuncs(DefaultEmbeddedConversions()...))
+ // Enable couple default conversions by default.
+ utilruntime.Must(RegisterEmbeddedConversions(s))
+ utilruntime.Must(RegisterStringConversions(s))
- // Enable map[string][]string conversions by default
- utilruntime.Must(s.AddConversionFuncs(DefaultStringConversions...))
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
@@ -308,45 +308,6 @@ func (s *Scheme) AddIgnoredConversionType(from, to interface{}) error {
return s.converter.RegisterIgnoredConversion(from, to)
}
-// AddConversionFuncs adds functions to the list of conversion functions. The given
-// functions should know how to convert between two of your API objects, or their
-// sub-objects. We deduce how to call these functions from the types of their two
-// parameters; see the comment for Converter.Register.
-//
-// Note that, if you need to copy sub-objects that didn't change, you can use the
-// conversion.Scope object that will be passed to your conversion function.
-// Additionally, all conversions started by Scheme will set the SrcVersion and
-// DestVersion fields on the Meta object. Example:
-//
-// s.AddConversionFuncs(
-// func(in *InternalObject, out *ExternalObject, scope conversion.Scope) error {
-// // You can depend on Meta() being non-nil, and this being set to
-// // the source version, e.g., ""
-// s.Meta().SrcVersion
-// // You can depend on this being set to the destination version,
-// // e.g., "v1".
-// s.Meta().DestVersion
-// // Call scope.Convert to copy sub-fields.
-// s.Convert(&in.SubFieldThatMoved, &out.NewLocation.NewName, 0)
-// return nil
-// },
-// )
-//
-// (For more detail about conversion functions, see Converter.Register's comment.)
-//
-// Also note that the default behavior, if you don't add a conversion function, is to
-// sanely copy fields that have the same names and same type names. It's OK if the
-// destination type has extra fields, but it must not remove any. So you only need to
-// add conversion functions for things with changed/removed fields.
-func (s *Scheme) AddConversionFuncs(conversionFuncs ...interface{}) error {
- for _, f := range conversionFuncs {
- if err := s.converter.RegisterConversionFunc(f); err != nil {
- return err
- }
- }
- return nil
-}
-
// AddConversionFunc registers a function that converts between a and b by passing objects of those
// types to the provided function. The function *must* accept objects of a and b - this machinery will not enforce
// any other guarantee.