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
This commit is contained in:
Shubham Bansal
2022-10-28 20:39:08 +05:30
committed by GitHub
parent dbd2153181
commit 47cbbef06f
+11 -8
View File
@@ -583,27 +583,30 @@ func (gpm *GenericPoolManager) idleObjectReaper(ctx context.Context) {
} }
func (gpm *GenericPoolManager) doIdleObjectReaper(ctx context.Context) { func (gpm *GenericPoolManager) doIdleObjectReaper(ctx context.Context) {
envs, err := gpm.fissionClient.CoreV1().Environments(metav1.NamespaceAll).List(ctx, metav1.ListOptions{}) envList := make(map[k8sTypes.UID]struct{})
for _, namespace := range utils.GetNamespaces() {
envs, err := gpm.fissionClient.CoreV1().Environments(namespace).List(ctx, metav1.ListOptions{})
if err != nil { if err != nil {
gpm.logger.Error("failed to get environment list", zap.Error(err)) gpm.logger.Error("failed to get environment list", zap.Error(err), zap.String("namespace", namespace))
return return
} }
envList := make(map[k8sTypes.UID]struct{})
for _, env := range envs.Items { for _, env := range envs.Items {
envList[env.ObjectMeta.UID] = struct{}{} envList[env.ObjectMeta.UID] = struct{}{}
} }
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
} }
fnList := make(map[k8sTypes.UID]fv1.Function) fnList := make(map[k8sTypes.UID]fv1.Function)
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 { for i, fn := range fns.Items {
fnList[fn.ObjectMeta.UID] = fns.Items[i] fnList[fn.ObjectMeta.UID] = fns.Items[i]
} }
}
funcSvcs, err := gpm.fsCache.ListOldForPool(time.Second * 5) funcSvcs, err := gpm.fsCache.ListOldForPool(time.Second * 5)
if err != nil { if err != nil {