Merge pull request #62990 from hzxuzhonghu/dynamic-restMapper-namespace-controller

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>.

Add dynamic RESTMapper to ControllerContext and make it generic

Add RESTMapper to ControllerContext and make it generic.

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue
2018-05-04 13:33:03 -07:00
committed by GitHub
4 changed files with 29 additions and 19 deletions

View File

@@ -254,6 +254,12 @@ func setupWithServer(t *testing.T, result *kubeapiservertesting.TestServer, work
}
syncPeriod := 5 * time.Second
startGC := func(workers int) {
go wait.Until(func() {
// Resetting the REST mapper will also invalidate the underlying discovery
// client. This is a leaky abstraction and assumes behavior about the REST
// mapper, but we'll deal with it for now.
restMapper.Reset()
}, syncPeriod, stopCh)
go gc.Run(workers, stopCh)
go gc.Sync(clientSet.Discovery(), syncPeriod, stopCh)
}