From 47cbbef06f5a645bfddccccdac7fe7da8cfc9717 Mon Sep 17 00:00:00 2001 From: Shubham Bansal <62992590+shubham-bansal96@users.noreply.github.com> Date: Fri, 28 Oct 2022 20:39:08 +0530 Subject: [PATCH] List Fission resource for specific namespace in executor reaper (#2587) * pool manager to work with specific namespaces * code review changes and revert changes for go.mod and values.yaml file --- pkg/executor/executortype/poolmgr/gpm.go | 33 +++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/pkg/executor/executortype/poolmgr/gpm.go b/pkg/executor/executortype/poolmgr/gpm.go index 0f13a231..fa779c86 100644 --- a/pkg/executor/executortype/poolmgr/gpm.go +++ b/pkg/executor/executortype/poolmgr/gpm.go @@ -583,26 +583,29 @@ func (gpm *GenericPoolManager) idleObjectReaper(ctx context.Context) { } func (gpm *GenericPoolManager) doIdleObjectReaper(ctx context.Context) { - envs, err := gpm.fissionClient.CoreV1().Environments(metav1.NamespaceAll).List(ctx, metav1.ListOptions{}) - if err != nil { - gpm.logger.Error("failed to get environment list", zap.Error(err)) - return - } - envList := make(map[k8sTypes.UID]struct{}) - for _, env := range envs.Items { - envList[env.ObjectMeta.UID] = struct{}{} - } + for _, namespace := range utils.GetNamespaces() { + envs, err := gpm.fissionClient.CoreV1().Environments(namespace).List(ctx, metav1.ListOptions{}) + if err != nil { + gpm.logger.Error("failed to get environment list", zap.Error(err), zap.String("namespace", namespace)) + return + } - fns, err := gpm.fissionClient.CoreV1().Functions(metav1.NamespaceAll).List(ctx, metav1.ListOptions{}) - if err != nil { - gpm.logger.Error("failed to get environment list", zap.Error(err)) - return + for _, env := range envs.Items { + envList[env.ObjectMeta.UID] = struct{}{} + } } fnList := make(map[k8sTypes.UID]fv1.Function) - for i, fn := range fns.Items { - fnList[fn.ObjectMeta.UID] = fns.Items[i] + for _, namespace := range utils.GetNamespaces() { + fns, err := gpm.fissionClient.CoreV1().Functions(namespace).List(ctx, metav1.ListOptions{}) + if err != nil { + gpm.logger.Error("failed to get environment list", zap.Error(err), zap.String("namespace", namespace)) + return + } + for i, fn := range fns.Items { + fnList[fn.ObjectMeta.UID] = fns.Items[i] + } } funcSvcs, err := gpm.fsCache.ListOldForPool(time.Second * 5)