k3s/pkg/kubelet
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
..
apis generated: Avoid use of reflect.Call in conversion code paths 2018-07-17 23:02:16 -04:00
cadvisor Remove --cadvisor-port - has been deprecated since v1.10 2018-07-02 08:54:14 -04:00
certificate Derive kubelet serving certificate CSR template from node status addresses 2018-07-10 14:33:48 -04:00
checkpoint Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
checkpointmanager Make 'pod' package to use unified checkpointManager 2018-04-16 01:30:20 -04:00
client Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
cm Remove duplicate check line 2018-07-05 11:07:56 +08:00
config Speed up cluster startup in GCE 2018-07-02 10:22:32 +02:00
configmap Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
container Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
custommetrics Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
dockershim Merge pull request #65902 from wojtek-t/kube_proxy_less_allocations_2 2018-07-09 23:07:01 -07:00
envvars Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
events
eviction Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
images Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
kubeletconfig Fix test failure of truncated time 2018-06-30 01:14:44 +09:00
kuberuntime Fix RunAsGroup. 2018-07-06 15:42:26 -07:00
leaky
lifecycle Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
logs Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
metrics fix metrics help comment 2018-07-13 10:26:35 +09:00
mountpod Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
network Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
pleg Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
pod Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
preemption Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
prober Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
qos Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
remote Update to gazelle 0.12.0 and run hack/update-bazel.sh 2018-06-22 16:22:18 -07:00
secret Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
server Add healthz check to ensure logging is not blocked 2018-07-03 22:27:23 -04:00
stats Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
status Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
sysctl Run make update 2018-06-06 00:12:40 +02:00
token Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
types Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
util Add hierarchy support for plugin directory 2018-06-25 17:32:18 -07:00
volumemanager kubernetes: fix printf format errors 2018-07-11 00:10:15 +03:00
winstats Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
BUILD Remove unused io util writer & volume host GetWriter() 2018-07-09 14:09:48 -07:00
OWNERS
active_deadline.go
active_deadline_test.go
cloud_request_manager.go Put all the node address cloud provider retrival complex logic into cloudResourceSyncManager 2018-07-03 20:11:35 +02:00
cloud_request_manager_test.go Put all the node address cloud provider retrival complex logic into cloudResourceSyncManager 2018-07-03 20:11:35 +02:00
doc.go
kubelet.go Start cloudResourceSyncsManager before getNodeAnyWay (initializeModules) 2018-07-18 15:15:03 -04:00
kubelet_getters.go Apply pod name and namespace labels for pod cgroup for cadvisor metrics 2018-05-07 14:51:12 -04:00
kubelet_getters_test.go
kubelet_network.go Move hairpin mode logic to dockershim 2018-04-11 09:21:17 -07:00
kubelet_network_test.go Move the kubelet network package down to dockershim 2018-04-11 09:25:56 -07:00
kubelet_node_status.go fix a panic due to assignment to nil map 2018-07-17 12:34:20 -07:00
kubelet_node_status_test.go fix a panic due to assignment to nil map 2018-07-17 12:34:20 -07:00
kubelet_pods.go kubernetes: fix printf format errors 2018-07-11 00:10:15 +03:00
kubelet_pods_test.go Merge pull request #64006 from Random-Liu/streaming-auth 2018-05-31 22:45:29 -07:00
kubelet_pods_windows_test.go Add dynamic environment variable substitution to subpaths 2018-05-29 17:01:09 +01:00
kubelet_resources.go
kubelet_resources_test.go Cleanup verbose cAdvisor mocking in Kubelet unit tests 2018-06-27 11:53:41 -07:00
kubelet_test.go Cleanup verbose cAdvisor mocking in Kubelet unit tests 2018-06-27 11:53:41 -07:00
kubelet_volumes.go Fix issue with race condition during pod deletion 2018-03-15 15:35:37 -07:00
kubelet_volumes_test.go Refactor of GenerateMapDeviceFunc to delegate Map call to volume plugin. 2018-06-03 17:25:37 -04:00
oom_watcher.go
oom_watcher_test.go
pod_container_deletor.go kubelet: force filterContainerID to empty string when removeAll is true 2018-04-30 16:29:17 -05:00
pod_container_deletor_test.go
pod_workers.go Fix pod worker deadlock. 2018-07-09 11:45:26 -07:00
pod_workers_test.go
reason_cache.go
reason_cache_test.go
runonce.go fix todo:add function getFailContainer to report which containers failed the pod 2018-03-15 09:38:02 +08:00
runonce_test.go implement service account token projection 2018-06-04 17:22:08 -07:00
runtime.go cleanup some dead kubelet code 2018-05-29 22:38:01 +08:00
util.go
volume_host.go Remove unused io util writer & volume host GetWriter() 2018-07-09 14:09:48 -07:00