This is an automated email from the ASF dual-hosted git repository.

ccondit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git


The following commit(s) were added to refs/heads/master by this push:
     new 3c19bc9d [YUNIKORN-2638] Simplify finalizeNodes and finalizePods (#949)
3c19bc9d is described below

commit 3c19bc9d701b1e98e0e7b63e0c010177c122ecae
Author: steinsgateted <steinsgate...@gmail.com>
AuthorDate: Thu Mar 6 12:22:07 2025 -0600

    [YUNIKORN-2638] Simplify finalizeNodes and finalizePods (#949)
    
    Closes: #949
    
    Signed-off-by: Craig Condit <ccon...@apache.org>
---
 pkg/cache/context.go | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pkg/cache/context.go b/pkg/cache/context.go
index ca409c10..99f27319 100644
--- a/pkg/cache/context.go
+++ b/pkg/cache/context.go
@@ -1654,14 +1654,14 @@ func (ctx *Context) finalizeNodes(existingNodes 
[]*v1.Node) error {
        }
 
        // convert the node list into a map
-       nodeMap := make(map[string]*v1.Node)
+       nodeMap := make(map[string]bool, len(nodes))
        for _, node := range nodes {
-               nodeMap[node.Name] = node
+               nodeMap[node.Name] = true
        }
 
        // find any existing nodes that no longer exist
        for _, node := range existingNodes {
-               if _, ok := nodeMap[node.Name]; !ok {
+               if !nodeMap[node.Name] {
                        // node no longer exists, delete it
                        log.Log(log.ShimContext).Info("Removing node which went 
away during initialization",
                                zap.String("name", node.Name))
@@ -1710,13 +1710,13 @@ func (ctx *Context) finalizePods(existingPods 
[]*v1.Pod) error {
        }
 
        // convert the pod list into a map
-       podMap := make(map[types.UID]*v1.Pod)
+       podMap := make(map[types.UID]bool, len(pods))
        for _, pod := range pods {
                // if the pod is terminated finalising should remove it if it 
was running in register
                if utils.IsPodTerminated(pod) {
                        continue
                }
-               podMap[pod.UID] = pod
+               podMap[pod.UID] = true
        }
 
        // find any existing pods that no longer exist
@@ -1725,7 +1725,7 @@ func (ctx *Context) finalizePods(existingPods []*v1.Pod) 
error {
                if pod == nil {
                        continue
                }
-               if _, ok := podMap[pod.UID]; !ok {
+               if !podMap[pod.UID] {
                        // pod no longer exists, delete it
                        log.Log(log.ShimContext).Info("Removing pod which went 
away during initialization",
                                zap.String("namespace", pod.Namespace),


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@yunikorn.apache.org
For additional commands, e-mail: issues-h...@yunikorn.apache.org

Reply via email to