Merge pull request #39399 from zhouhaibing089/namespace-controller

Automatic merge from submit-queue

make discovery static when extensions/thirdpartyresources is not enabled

this should be a bug fix, if `extensions/thirdpartyresources` is enabled, the result of `Discovery().ServerPreferredNamespacedResources` will be dynamic then, so we are making the `discoverResourcesFn` static only when the `extensions/thirdpartyresources` is not enabled.
This commit is contained in:
Kubernetes Submit Queue 2017-01-04 10:04:00 -08:00 committed by GitHub
commit ee47db8c84

View File

@ -115,7 +115,7 @@ func startNamespaceController(ctx ControllerContext) (bool, error) {
return true, fmt.Errorf("failed to parse preferred server resources: %v", err)
}
discoverResourcesFn := namespaceKubeClient.Discovery().ServerPreferredNamespacedResources
if _, found := gvrs[extensions.SchemeGroupVersion.WithResource("thirdpartyresource")]; found {
if _, found := gvrs[extensions.SchemeGroupVersion.WithResource("thirdpartyresource")]; !found {
// make discovery static
snapshot, err := discoverResourcesFn()
if err != nil {