Fix executor unable to list secrets/configmaps (#1307)

This commit is contained in:
Ta-Ching Chen
2019-09-11 10:47:20 +08:00
committed by GitHub
parent 678a2c7ad8
commit 082c244b0b
+2 -4
View File
@@ -68,7 +68,7 @@ func (csController *ConfigSecretController) Run(ctx context.Context) {
func initConfigmapController(logger *zap.Logger, fissionClient *crd.FissionClient,
kubernetesClient *kubernetes.Clientset, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) (cache.Store, cache.Controller) {
resyncPeriod := 30 * time.Second
listWatch := cache.NewListWatchFromClient(kubernetesClient.AppsV1().RESTClient(), "configmaps", metav1.NamespaceAll, fields.Everything())
listWatch := cache.NewListWatchFromClient(kubernetesClient.CoreV1().RESTClient(), "configmaps", metav1.NamespaceAll, fields.Everything())
store, controller := cache.NewInformer(listWatch, &apiv1.ConfigMap{}, resyncPeriod, cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {},
DeleteFunc: func(obj interface{}) {},
@@ -80,7 +80,6 @@ func initConfigmapController(logger *zap.Logger, fissionClient *crd.FissionClien
logger.Debug("Configmap changed",
zap.String("configmap_name", newCm.ObjectMeta.Name),
zap.String("configmap_namespace", newCm.ObjectMeta.Namespace))
}
funcs, err := getConfigmapRelatedFuncs(logger, &newCm.ObjectMeta, fissionClient)
@@ -89,7 +88,6 @@ func initConfigmapController(logger *zap.Logger, fissionClient *crd.FissionClien
}
recyclePods(logger, funcs, ndm, gpm)
}
},
})
return store, controller
@@ -116,7 +114,7 @@ func getConfigmapRelatedFuncs(logger *zap.Logger, m *metav1.ObjectMeta, fissionC
func initSecretController(logger *zap.Logger, fissionClient *crd.FissionClient,
kubernetesClient *kubernetes.Clientset, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) (cache.Store, cache.Controller) {
resyncPeriod := 30 * time.Second
listWatch := cache.NewListWatchFromClient(kubernetesClient.AppsV1().RESTClient(), "secrets", metav1.NamespaceAll, fields.Everything())
listWatch := cache.NewListWatchFromClient(kubernetesClient.CoreV1().RESTClient(), "secrets", metav1.NamespaceAll, fields.Everything())
store, controller := cache.NewInformer(listWatch, &apiv1.Secret{}, resyncPeriod, cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {},
DeleteFunc: func(obj interface{}) {},