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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user