Reactored ready pod controller code to user lister and cache sync checks, so that we avoid querying lister if cache is not synced in choodPod function. Also, as noticied in #2258 we were initializing workqueue in goroutine which was causing nil pointer reference. We have moved it out of goroutine and kept specific parts in goroutine. Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -13,6 +13,16 @@ import (
|
||||
v1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
)
|
||||
|
||||
func GetInformerFactoryByReadyPod(client *kubernetes.Clientset, namespace string, labelSelector *metav1.LabelSelector) (k8sInformers.SharedInformerFactory, error) {
|
||||
informerFactory := k8sInformers.NewSharedInformerFactoryWithOptions(client, 0,
|
||||
k8sInformers.WithNamespace(namespace),
|
||||
k8sInformers.WithTweakListOptions(func(options *metav1.ListOptions) {
|
||||
options.LabelSelector = labels.Set(labelSelector.MatchLabels).AsSelector().String()
|
||||
options.FieldSelector = "status.phase=Running"
|
||||
}))
|
||||
return informerFactory, nil
|
||||
}
|
||||
|
||||
func GetInformerFactoryByExecutor(client *kubernetes.Clientset, executorType v1.ExecutorType, defaultResync time.Duration) (k8sInformers.SharedInformerFactory, error) {
|
||||
executorLabel, err := labels.NewRequirement(v1.EXECUTOR_TYPE, selection.DoubleEquals, []string{string(executorType)})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user