Skip to content

Commit

Permalink
checks for namespace and node
Browse files Browse the repository at this point in the history
  • Loading branch information
gizas committed Jan 11, 2024
1 parent 51bbd1b commit 5aac018
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kubernetes/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ package kubernetes
import (
"context"
"fmt"
"reflect"
"strings"
"time"

"k8s.io/apimachinery/pkg/api/meta"
Expand Down Expand Up @@ -162,7 +164,12 @@ func NewNamedWatcher(name string, client kubernetes.Interface, resource Resource
// state should just be deduped by autodiscover and not stop/started periodically as would be the case with an update.
w.enqueue(n, add)
}
w.cacheObject(o)

//We check the type of resource and only if it is namespace or node return the cacheObject
stringresource := reflect.TypeOf(resource).String()
if strings.Contains(strings.ToLower(stringresource), "namespace") || strings.Contains(strings.ToLower(stringresource), "node") {
w.cacheObject(o)
}

},
})
Expand Down

0 comments on commit 5aac018

Please sign in to comment.