summaryrefslogtreecommitdiff
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-08-28 08:23:59 -0400
committerGitHub <noreply@github.com>2020-08-28 08:23:59 -0400
commit74bdf52c401dd1c9cd3c636d4fa8ea94e7c88ef3 (patch)
treeaf0904e9ec643dea2caa8d39a55764adc38c069f /vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
parent061c93f70101026d79cca6e75ac0c565e1fa99ec (diff)
parent90a86cad3a6f007c6708406d8a78528fbb302a0a (diff)
downloadpodman-74bdf52c401dd1c9cd3c636d4fa8ea94e7c88ef3.tar.gz
podman-74bdf52c401dd1c9cd3c636d4fa8ea94e7c88ef3.tar.bz2
podman-74bdf52c401dd1c9cd3c636d4fa8ea94e7c88ef3.zip
Merge pull request #7472 from containers/dependabot/go_modules/k8s.io/apimachinery-0.19.0
Bump k8s.io/apimachinery from 0.18.8 to 0.19.0
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.