Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: correct pod/deployment filtering logic and fix test helper calls

rcourtman90799f477104
diff --git a/internal/kubernetesagent/agent.go b/internal/kubernetesagent/agent.go
index fc1028b024..467a7ee04a 100644
--- a/internal/kubernetesagent/agent.go
+++ b/internal/kubernetesagent/agent.go
@@ -468,7 +468,7 @@ func (a *Agent) collectPods(ctx context.Context) ([]agentsk8s.Pod, error) {
if !a.namespaceAllowed(pod.Namespace) {
continue
}
- if !a.cfg.IncludeAllPods && isProblemPod(pod) {
+ if !a.cfg.IncludeAllPods && !isProblemPod(pod) {
continue
}
@@ -600,7 +600,7 @@ func (a *Agent) collectDeployments(ctx context.Context) ([]agentsk8s.Deployment,
if !a.namespaceAllowed(dep.Namespace) {
continue
}
- if isProblemDeployment(dep) {
+ if !isProblemDeployment(dep) {
continue
}
diff --git a/internal/kubernetesagent/agent_test.go b/internal/kubernetesagent/agent_test.go
index 7931e79316..6dc40a2b53 100644
--- a/internal/kubernetesagent/agent_test.go
+++ b/internal/kubernetesagent/agent_test.go
@@ -62,8 +62,8 @@ users:
func TestNamespaceAllowed_IncludeExclude(t *testing.T) {
a := &Agent{
- includeNamespaces: makeNamespaceSet([]string{"a", "b"}),
- excludeNamespaces: makeNamespaceSet([]string{"b"}),
+ includeNamespaces: []string{"a", "b"},
+ excludeNamespaces: []string{"b"},
}
if !a.namespaceAllowed("a") {
@@ -122,9 +122,9 @@ func TestCollectPods_FiltersProblemsAndSorts(t *testing.T) {
MaxPods: 2,
IncludeAllPods: false,
},
- kubeClient: clientset,
- includeNamespaces: makeNamespaceSet(nil),
- excludeNamespaces: makeNamespaceSet(nil),
+ kubeClient: clientset,
+ includeNamespaces: nil,
+ excludeNamespaces: nil,
}
pods, err := a.collectPods(context.Background())
@@ -165,10 +165,10 @@ func TestCollectDeployments_FiltersProblems(t *testing.T) {
)
a := &Agent{
- cfg: Config{IncludeAllPods: false},
- kubeClient: clientset,
- includeNamespaces: makeNamespaceSet(nil),
- excludeNamespaces: makeNamespaceSet(nil),
+ cfg: Config{IncludeAllPods: false},
+ kubeClient: clientset,
+ includeNamespaces: nil,
+ excludeNamespaces: nil,
}
deps, err := a.collectDeployments(context.Background())