core: use filter only if its set to non empty string

Also check for the empty namespace instead of an
empty name which was incorrect.

Co-authored-by: Nikita Sivukhin <sivukhin@turso.tech>
Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
(cherry picked from commit 71a4fce87b)
This commit is contained in:
Travis Nielsen authored and Mergify committed 2025-04-04 18:12:06 +00:00
1 parent 88a12084d0
commit 962b995196
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -32,7 +32,7 @@ import (
discoverDaemon "github.com/rook/rook/pkg/daemon/discover"
"github.com/rook/rook/pkg/operator/ceph/controller"
opcontroller "github.com/rook/rook/pkg/operator/ceph/controller"
k8sutil "github.com/rook/rook/pkg/operator/k8sutil"
"github.com/rook/rook/pkg/operator/k8sutil"
"github.com/rook/rook/pkg/util/sys"
apps "k8s.io/api/apps/v1"
@@ -424,7 +424,7 @@ func GetAvailableDevices(ctx context.Context, clusterdContext *clusterd.Context,
}
}
}
} else if len(filter) >= 0 {
} else if len(filter) > 0 {
for i := range nodeDevices {
// TODO support filter based on other keys
matched, err := regexp.Match(filter, []byte(nodeDevices[i].Name))
+1 -1
View File
@@ -165,7 +165,7 @@ func GetRunningPod(ctx context.Context, clientset kubernetes.Interface) (*v1.Pod
return nil, fmt.Errorf("cannot detect the pod name. Please provide it using the downward API in the manifest file")
}
podNamespace := os.Getenv(PodNamespaceEnvVar)
if podName == "" {
if podNamespace == "" {
return nil, fmt.Errorf("cannot detect the pod namespace. Please provide it using the downward API in the manifest file")
}