k3s/cmd
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
..
clicheck wire config flags through factory 2018-05-04 17:02:20 -04:00
cloud-controller-manager Merge pull request #64654 from atlassian/missing-error-handling 2018-07-02 07:14:34 -07:00
controller-manager controller-manager: allow high ports in secure serving validation 2018-07-05 15:01:19 +02:00
gendocs wire config flags through factory 2018-05-04 17:02:20 -04:00
genkubedocs Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
genman Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
genswaggertypedocs Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
genutils Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
genyaml wire config flags through factory 2018-05-04 17:02:20 -04:00
hyperkube Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
importverifier fix message output for import verifier 2018-05-10 12:50:28 -04:00
kube-apiserver Merge pull request #65832 from sttts/sttts-apiserver-reusable-loopback-logic 2018-07-13 13:22:04 -07:00
kube-controller-manager Merge pull request #65917 from dims/remove-stray-comment-from-merge 2018-07-09 08:07:04 -07:00
kube-proxy Merge pull request #65425 from islinwb/ipvs_cleanup_rules 2018-07-12 15:14:16 -07:00
kube-scheduler apiserver: allow high ports in secure serving validation 2018-07-04 19:20:12 +02:00
kubeadm Merge pull request #65771 from smarterclayton/untyped 2018-07-19 09:29:00 -07:00
kubectl Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
kubelet Remove unused io util writer & volume host GetWriter() 2018-07-09 14:09:48 -07:00
kubemark Make proxier params configurable in kubemark 2018-07-06 16:07:15 +02:00
linkcheck Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
BUILD gke-certificates-controller: rm -rf 2018-02-15 12:01:00 -08:00
OWNERS