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 12, 2024
1 parent 5aac018 commit b89e490
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kubernetes/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ package kubernetes
import (
"context"
"fmt"
"reflect"
"strings"
"time"

"k8s.io/apimachinery/pkg/api/meta"
Expand Down Expand Up @@ -166,11 +164,12 @@ func NewNamedWatcher(name string, client kubernetes.Interface, resource Resource
}

//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") {
switch resource.(type) {
case *Namespace:
w.cacheObject(o)
case *Node:
w.cacheObject(o)
}

},
})

Expand Down

0 comments on commit b89e490

Please sign in to comment.