kubernetes/pkg/controller
Kubernetes Submit Queue 5d7569d664
Merge pull request #62913 from deads2k/client-04-dynamic
Automatic merge from submit-queue (batch tested with PRs 63137, 62913). 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>.

make a simple dynamic client that is easy to use

The dynamic client has annoyed me for the last time!  The existing one takes arguments at odd levels, requires lots of information to instantiate, does some weird pool thing, and uses unusual types.  This creates an interface like this:

```go

type DynamicInterface interface {
	ClusterResource(resource schema.GroupVersionResource) DynamicResourceInterface
	NamespacedResource(resource schema.GroupVersionResource, namespace string) DynamicResourceInterface
}

type DynamicResourceInterface interface {
	Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	Update(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	UpdateStatus(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	Delete(name string, options *metav1.DeleteOptions) error
	DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
	Get(name string, options metav1.GetOptions) (*unstructured.Unstructured, error)
	List(opts metav1.ListOptions) (*unstructured.UnstructuredList, error)
	Watch(opts metav1.ListOptions) (watch.Interface, error)
	Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*unstructured.Unstructured, error)
}
```

You create it from just a `rest.Config`, no mapper, no path resolving func, no trying to set up codecs ahead of time, no unnecessary pool.  It just works.

I updated the namespace controller to use it and I updated the existing dynamic client to leverage it so that I get all their tests for "free".

@kubernetes/sig-api-machinery-pr-reviews 
@liggitt @smarterclayton @bparees @sttts @ironcladlou I know each of us has struggled with the dynamic client in our time.
@lavalamp @caesarxuchao This is vastly simplifying.  I'm eager to drop the old `ClientPool`.  client-go will technically have another incompatible semver this release.  I'm up for changing it in tree.


```release-note
client-go developers: the new dynamic client is easier to use and the old is deprecated, you must switch.
```
2018-04-25 08:50:09 -07:00
..
bootstrap Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
certificates sarapprover: remove self node cert 2018-04-13 11:23:51 -07:00
cloud PR #59323, fix bug and remove one api call, add node util dependency to cloud controller 2018-04-22 20:32:26 +03:00
clusterroleaggregation Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
cronjob Merge pull request #62011 from hanxiaoshuai/fixtodo0402 2018-04-05 18:47:07 -07:00
daemon Moved sync pod on Node logic to func. 2018-04-12 09:31:31 +08:00
deployment Fix a bug in Deployment controller when comparing templates 2018-04-04 17:14:07 -07:00
disruption Use typed events client directly 2018-04-01 18:57:29 +10:00
endpoint Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
garbagecollector add easy to use dynamic client 2018-04-25 08:55:26 -04:00
history Merge pull request #59365 from ayushpateria/patch-sts 2018-02-27 10:21:00 -08:00
job Merge pull request #58972 from soltysh/issue54870 2018-04-19 16:47:18 -07:00
namespace add easy to use dynamic client 2018-04-25 08:55:26 -04:00
nodeipam Use typed events client directly 2018-04-01 18:57:29 +10:00
nodelifecycle PR #59323, fix bug and remove one api call, add node util dependency to cloud controller 2018-04-22 20:32:26 +03:00
podautoscaler Use typed events client directly 2018-04-01 18:57:29 +10:00
podgc Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
replicaset Use typed events client directly 2018-04-01 18:57:29 +10:00
replication Use typed events client directly 2018-04-01 18:57:29 +10:00
resourcequota Merge pull request #57302 from lichuqiang/resourceQuota4extendedResource 2018-02-20 14:10:46 -08:00
route Merge pull request #61315 from hzxuzhonghu/route-controller 2018-04-09 04:31:14 -07:00
service Use typed events client directly 2018-04-01 18:57:29 +10:00
serviceaccount Update gofmt for go1.10 2018-04-02 17:44:04 -07:00
statefulset Use typed events client directly 2018-04-01 18:57:29 +10:00
testutil PR #59323, fix bug and remove one api call, add node util dependency to cloud controller 2018-04-22 20:32:26 +03:00
ttl Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
util/node PR #59323, fix bug and remove one api call, add node util dependency to cloud controller 2018-04-22 20:32:26 +03:00
volume Merge pull request #62886 from msau42/fix-localssd-fsgroup 2018-04-20 20:06:13 -07:00
.import-restrictions add import restrictions 2016-10-13 16:10:24 -07:00
BUILD PR #59323, fix bug and remove one api call, add node util dependency to cloud controller 2018-04-22 20:32:26 +03:00
client_builder.go remove duplicated import 2017-11-14 17:18:17 +08:00
controller_ref_manager.go Update the DaemonSet controller to use the apps/v1 API 2018-02-22 11:38:54 -08:00
controller_ref_manager_test.go Merge pull request #50353 from zhangxiaoyu-zidif/Delete-redundant-expectError-for-controller-ref-test 2017-08-12 00:00:55 -07:00
controller_utils.go PR #59323, fix bug and remove one api call, add node util dependency to cloud controller 2018-04-22 20:32:26 +03:00
controller_utils_test.go Removed unused function. 2017-11-14 10:53:29 +02: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