Merge pull request #87718 from wojtek-t/kubelet_not_watching_immutable_secret_configmaps

WatchBasedManager stops  watching immutable objects
This commit is contained in:
Kubernetes Prow Robot
2020-02-11 23:14:33 -08:00
committed by GitHub
6 changed files with 226 additions and 15 deletions

View File

@@ -145,8 +145,14 @@ func NewWatchingConfigMapManager(kubeClient clientset.Interface) Manager {
newConfigMap := func() runtime.Object {
return &v1.ConfigMap{}
}
isImmutable := func(object runtime.Object) bool {
if configMap, ok := object.(*v1.ConfigMap); ok {
return configMap.Immutable != nil && *configMap.Immutable
}
return false
}
gr := corev1.Resource("configmap")
return &configMapManager{
manager: manager.NewWatchBasedManager(listConfigMap, watchConfigMap, newConfigMap, gr, getConfigMapNames),
manager: manager.NewWatchBasedManager(listConfigMap, watchConfigMap, newConfigMap, isImmutable, gr, getConfigMapNames),
}
}