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
+18 -15
View File
@@ -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)