kubernetes/pkg/controller
Kubernetes Submit Queue d2cc34fb07
Merge pull request #65771 from smarterclayton/untyped
Automatic merge from submit-queue (batch tested with PRs 65771, 65849). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add a new conversion path to replace GenericConversionFunc

reflect.Call is very expensive. We currently use a switch block as part of AddGenericConversionFunc to avoid the bulk of top level a->b conversion for our primary types which is hand-written. Instead of having these be handwritten, we should generate them.

The pattern for generating them looks like:

```
scheme.AddConversionFunc(&v1.Type{}, &internal.Type{}, func(a, b interface{}, scope conversion.Scope) error {
  return Convert_v1_Type_to_internal_Type(a.(*v1.Type), b.(*internal.Type), scope)
})
```

which matches AddDefaultObjectFunc (which proved out the approach last year). The
conversion machinery should then do a simple map lookup based on the incoming types and invoke the function.  Like defaulting, it's up to the caller to match the types to arguments, which we do by generating this code.  This bypasses reflect.Call and in the future allows Golang mid-stack inlining to optimize this code.

As part of this change I strengthened registration of custom functions to be generated instead of hand registered, and also strengthened error checking of the generator when it sees a manual conversion to error out.  Since custom functions are automatically used by the generator, we don't really have a case for not registering the functions.

Once this is fully tested out, we can remove the reflection based path and the old registration methods, and all conversion will work from point to point methods (whether generated or custom).

Much of the need for the reflection path has been removed by changes to generation (to omit fields) and changes to Go (to make assigning equivalent structs easy).

```release-note
NONE
```
2018-07-19 09:29:00 -07:00
..
bootstrap Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
certificates optimize certificate cleaner 2018-07-12 18:59:03 +08:00
cloud Merge pull request #65052 from dbdd4us/master 2018-07-11 22:25:03 -07:00
clusterroleaggregation Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
cronjob Typo Fix. 2018-06-29 11:04:10 +05:30
daemon Safe encode template hash value to make it consistent with resource name 2018-07-13 09:52:26 -07:00
deployment Safe encode template hash value to make it consistent with resource name 2018-07-13 09:52:26 -07:00
disruption Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
endpoint Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
garbagecollector kubernetes: fix printf format errors 2018-07-11 00:10:15 +03:00
history Safe encode template hash value to make it consistent with resource name 2018-07-13 09:52:26 -07:00
job Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
namespace Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
nodeipam Update external k8s.io/metrics imports 2018-07-02 10:44:18 +02:00
nodelifecycle Fix out of bounds error on non-64-bit machines 2018-06-28 16:29:52 -04:00
podautoscaler Merge pull request #65901 from jbartosik/hpa-improv-refactor-replica-calc-test 2018-07-18 16:42:18 -07:00
podgc Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
replicaset Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
replication Make conversion function names match expected values 2018-07-17 23:02:16 -04:00
resourcequota Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
route Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
service fixes docs 2018-06-28 11:33:47 +08:00
serviceaccount Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
statefulset Merge pull request #62943 from faraazkhan/master 2018-07-17 17:52:59 -07:00
testutil Merge pull request #65052 from dbdd4us/master 2018-07-11 22:25:03 -07:00
ttl Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
util/node Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
volume persistentvolume: fix spelling of storageClasseName 2018-07-17 14:34:51 +01:00
.import-restrictions add import restrictions 2016-10-13 16:10:24 -07:00
BUILD Safe encode template hash value to make it consistent with resource name 2018-07-13 09:52:26 -07:00
client_builder.go remove duplicated import 2017-11-14 17:18:17 +08:00
controller_ref_manager.go Use apps/v1 in Deployment controller. 2018-05-22 13:42:10 -07:00
controller_ref_manager_test.go Use apps/v1 in Deployment controller. 2018-05-22 13:42:10 -07:00
controller_utils.go Safe encode template hash value to make it consistent with resource name 2018-07-13 09:52:26 -07:00
controller_utils_test.go Use apps/v1 in Deployment controller. 2018-05-22 13:42:10 -07:00
doc.go Use Go canonical import paths 2016-07-16 13:48:21 -04:00
lookup_cache.go Use fnv.New32a() in hash instead adler32 2017-02-15 14:03:54 +08:00
OWNERS remove some people from OWNERS so they don't get reviews anymore 2017-07-13 10:02:21 -07:00