k3s/pkg/client
Kubernetes Submit Queue 268555a30a
Merge pull request #57504 from yue9944882/fix-fake-client-dummy-watch
Automatic merge from submit-queue. 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>.

feat(fakeclient): push event on watched channel on add/update/delete

**What this PR does / why we need it**:

This PR enables watch function for kubernetes [fakeclient](1bcf0b0a22/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go (L88)). 

This fake client add watchReactorFunction by wrapping [watch.NewFake](1bcf0b0a22/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go (L98)) which is a `chan Event` but actually nothing pushes objects into this channel. So all watch function called by fake client will never return or never receive any object. 

This PR intercepts ReactionFunc of `Create / Update / DeleteActionImpl` and will push the requested object to channel. 

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

Fixes #54075

**Special notes for your reviewer**:

**Release note**:

```dev-release-note
enable watch function for fake client
```
2018-01-16 08:39:03 -08:00
..
chaosclient Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
clientset_generated Merge pull request #57504 from yue9944882/fix-fake-client-dummy-watch 2018-01-16 08:39:03 -08:00
conditions cleanup useless functions and variables 2017-12-20 17:10:31 +08:00
informers/informers_generated/internalversion Update generated files 2018-01-02 22:13:19 -08:00
leaderelectionconfig update BUILD files 2017-10-15 18:18:13 -07:00
listers Regenerate all generated code 2018-01-02 00:21:07 -08:00
metrics update BUILD files 2017-10-15 18:18:13 -07:00
testdata Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
tests Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
unversioned Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
OWNERS Remove myself from a bunch of places 2017-07-20 12:10:46 +02:00