summaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2020-08-27 08:22:37 +0000
committerDaniel J Walsh <dwalsh@redhat.com>2020-08-28 05:45:35 -0400
commit90a86cad3a6f007c6708406d8a78528fbb302a0a (patch)
tree4c6546079346d0ff39f7c9a4d076913457a6a417 /vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
parentd6b13d8a0993aced5e227e7a516aadbf37e14dbc (diff)
downloadpodman-90a86cad3a6f007c6708406d8a78528fbb302a0a.tar.gz
podman-90a86cad3a6f007c6708406d8a78528fbb302a0a.tar.bz2
podman-90a86cad3a6f007c6708406d8a78528fbb302a0a.zip
Bump k8s.io/apimachinery from 0.18.8 to 0.19.0
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.18.8 to 0.19.0. - [Release notes](https://github.com/kubernetes/apimachinery/releases) - [Commits](https://github.com/kubernetes/apimachinery/compare/v0.18.8...v0.19.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/runtime/scheme.go')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/scheme.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
index 4b739ec38..3b254961d 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
@@ -211,6 +211,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.