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.

Canonicalize Docker Podman diagnostics copy

rcourtmane79764a0fda1
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index c424e92d31..5231229d95 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -1659,6 +1659,11 @@ funnel diagnostics stay org-scoped at the cache boundary: when
lifecycle diagnostics, the shared diagnostics cache must key by authenticated
org context so lifecycle-adjacent admin surfaces do not cross-tenant leak local
commerce telemetry.
+Lifecycle-adjacent Docker and Podman agent diagnostics are part of that same
+shared backend dependency. When `internal/api/diagnostics.go` emits agent
+health notes for Docker and Podman, the copy must keep Infrastructure as the
+operator recovery surface and must not send users back to retired agent-only
+management routes.
That same shared `internal/api/` dependency now also assumes auth persistence
compatibility is handled as an explicit migration/import boundary: legacy
raw-token `sessions.json` and `csrf_tokens.json` files may load for upgrade
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 9681a536db..fa4a383384 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -234,6 +234,14 @@ the canonical monitored-system blocked payload.
2. Update frontend API types in lockstep with backend contract changes.
Websocket-backed API consumers such as `frontend-modern/src/components/Settings/useAPITokenManagerState.ts` and `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx` may read runtime context only through `frontend-modern/src/contexts/appRuntime.ts`; they must not import `frontend-modern/src/App.tsx`, because payload ownership remains in the API contract rather than the root shell.
3. Add dedicated contract tests for new stable payloads
+3a. Route diagnostics payload fields and user-facing diagnostics copy through
+ `internal/api/diagnostics.go`,
+ `internal/api/diagnostics_additional_test.go`, and
+ `internal/api/diagnostics_memory_test.go` together. Docker and Podman
+ agent health notes emitted by diagnostics must lead with Docker / Podman
+ agent language and route operator recovery to the Infrastructure and
+ Security settings surfaces rather than generic runtime family wording or
+ retired agent-management destinations.
4. Route unified resource sensitivity, routing, and `aiSafeSummary` payload changes through `internal/api/resources.go`, `internal/api/contract_test.go`, and the canonical frontend resource consumer proofs together; resource governance metadata must not ship as an API-only or frontend-only heuristic
That same resource payload contract owns `aggregations.policyPosture` on
`/api/resources` and `/api/resources/stats`. The aggregation must be derived
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 258873f71a..938f0bb01a 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -1645,6 +1645,7 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
+ "internal/api/diagnostics_additional_test.go",
"internal/api/diagnostics_memory_test.go"
]
},
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 42bcca7838..cab639399a 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -97,6 +97,11 @@ querying, and the operator-facing storage health presentation layer.
through the shared `Table` wrapper rather than page-local scroll divs or
inline overflow styles.
4. Route transport changes for storage and recovery endpoints through `internal/api/` and the owning `api-contracts` proof routes
+ Shared diagnostics routes may include Docker and Podman agent health notes,
+ but storage/recovery does not own a recovery-local runtime vocabulary for
+ those notes. Recovery-adjacent diagnostics consumers must preserve the
+ source-specific Docker / Podman wording and recovery destinations governed
+ by the shared diagnostics API contract.
That same adjacent API/security boundary owns CSRF replacement-token
concurrency for browser mutations. Storage and recovery forms may benefit
from the shared retry behavior when parallel requests receive replacement
diff --git a/internal/api/diagnostics.go b/internal/api/diagnostics.go
index ab147f1e6c..d3cd5bf7dd 100644
--- a/internal/api/diagnostics.go
+++ b/internal/api/diagnostics.go
@@ -1339,7 +1339,7 @@ func buildDockerAgentDiagnostic(m *monitoring.Monitor, serverVersion string) *Do
}
if len(hosts) == 0 {
- appendNote("No container runtime agents have reported in yet. Use Settings → Agents to install the container-side agent and unlock remote commands.")
+ appendNote("No Docker / Podman agents have reported in yet. Use Settings → Infrastructure to install the Docker / Podman agent and unlock remote commands.")
return diag
}
@@ -1378,11 +1378,11 @@ func buildDockerAgentDiagnostic(m *monitoring.Monitor, serverVersion string) *Do
issues := make([]string, 0, 4)
if status != "online" && status != "" {
- issues = append(issues, fmt.Sprintf("Container runtime reports status %q.", status))
+ issues = append(issues, fmt.Sprintf("Docker / Podman agent reports status %q.", status))
}
if versionStr == "" {
- issues = append(issues, "Agent has not reported a version (pre v4.24). Reinstall using Settings → Agents.")
+ issues = append(issues, "Agent has not reported a version (pre v4.24). Reinstall using Settings → Infrastructure.")
} else if serverVer != nil {
if agentVer, err := updates.ParseVersion(versionStr); err == nil {
if agentVer.Compare(serverVer) < 0 {
@@ -1395,7 +1395,7 @@ func buildDockerAgentDiagnostic(m *monitoring.Monitor, serverVersion string) *Do
}
if strings.TrimSpace(host.TokenID()) == "" {
- issues = append(issues, "Container runtime is still using the shared API token. Generate a dedicated token in Settings → Security and rerun the installer.")
+ issues = append(issues, "Docker / Podman agent is still using the shared API token. Generate a dedicated token in Settings → Security and rerun the installer.")
}
if !host.LastSeen().IsZero() && now.Sub(host.LastSeen().UTC()) > 10*time.Minute {
@@ -1417,7 +1417,7 @@ func buildDockerAgentDiagnostic(m *monitoring.Monitor, serverVersion string) *Do
if host.PendingUninstall() {
diag.AgentsPendingUninstall++
- issues = append(issues, "Container runtime is pending uninstall; confirm the agent container stopped or clear the flag.")
+ issues = append(issues, "Docker / Podman agent is pending uninstall; confirm the agent container stopped or clear the flag.")
}
if len(issues) == 0 {
@@ -1443,27 +1443,48 @@ func buildDockerAgentDiagnostic(m *monitoring.Monitor, serverVersion string) *Do
diag.AgentsNeedingAttention = len(diag.Attention)
if legacyTokenHosts > 0 {
- appendNote(fmt.Sprintf("%d container runtime(s) still rely on the shared API token. Migrate each runtime to a dedicated token via Settings → Security and rerun the installer.", legacyTokenHosts))
+ appendNote(fmt.Sprintf("%s still %s on the shared API token. Migrate each agent to a dedicated token via Settings → Security and rerun the installer.", dockerPodmanAgentCount(legacyTokenHosts), pluralVerb(legacyTokenHosts, "relies", "rely")))
}
if diag.AgentsOutdatedVersion > 0 {
- appendNote(fmt.Sprintf("%d container runtime(s) run an out-of-date agent. Re-run the installer from Settings → Agents to upgrade them.", diag.AgentsOutdatedVersion))
+ appendNote(fmt.Sprintf("%s %s out of date. Re-run the installer from Settings → Infrastructure to upgrade.", dockerPodmanAgentCount(diag.AgentsOutdatedVersion), pluralVerb(diag.AgentsOutdatedVersion, "is", "are")))
}
if diag.AgentsWithoutVersion > 0 {
- appendNote(fmt.Sprintf("%d container runtime(s) have not reported an agent version yet. Reinstall the agent to enable the new command system.", diag.AgentsWithoutVersion))
+ appendNote(fmt.Sprintf("%s %s not reported an agent version yet. Reinstall from Settings → Infrastructure to enable the new command system.", dockerPodmanAgentCount(diag.AgentsWithoutVersion), pluralVerb(diag.AgentsWithoutVersion, "has", "have")))
}
if diag.AgentsWithStaleCommand > 0 {
- appendNote(fmt.Sprintf("%d container runtime command(s) appear stuck. Use the 'Allow reconnect' action in Settings → Infrastructure to reset them.", diag.AgentsWithStaleCommand))
+ appendNote(fmt.Sprintf("%s %s stuck. Use the 'Allow reconnect' action in Settings → Infrastructure to reset.", dockerPodmanAgentCommandCount(diag.AgentsWithStaleCommand), pluralVerb(diag.AgentsWithStaleCommand, "appears", "appear")))
}
if diag.AgentsPendingUninstall > 0 {
- appendNote(fmt.Sprintf("%d container runtime(s) are pending uninstall. Confirm the uninstall or clear the flag from Settings → Agents.", diag.AgentsPendingUninstall))
+ appendNote(fmt.Sprintf("%s %s pending uninstall. Confirm the uninstall or clear the flag from Settings → Infrastructure.", dockerPodmanAgentCount(diag.AgentsPendingUninstall), pluralVerb(diag.AgentsPendingUninstall, "is", "are")))
}
if diag.AgentsNeedingAttention == 0 {
- appendNote("All container runtime agents are reporting with dedicated tokens and the expected version.")
+ appendNote("All Docker / Podman agents are reporting with dedicated tokens and the expected version.")
}
return diag
}
+func dockerPodmanAgentCount(count int) string {
+ if count == 1 {
+ return "1 Docker / Podman agent"
+ }
+ return fmt.Sprintf("%d Docker / Podman agents", count)
+}
+
+func dockerPodmanAgentCommandCount(count int) string {
+ if count == 1 {
+ return "1 Docker / Podman agent command"
+ }
+ return fmt.Sprintf("%d Docker / Podman agent commands", count)
+}
+
+func pluralVerb(count int, singular, plural string) string {
+ if count == 1 {
+ return singular
+ }
+ return plural
+}
+
func buildAlertsDiagnostic(m *monitoring.Monitor) *AlertsDiagnostic {
if m == nil {
return nil
diff --git a/internal/api/diagnostics_additional_test.go b/internal/api/diagnostics_additional_test.go
index 9cd958ab3a..607a1953ee 100644
--- a/internal/api/diagnostics_additional_test.go
+++ b/internal/api/diagnostics_additional_test.go
@@ -489,6 +489,46 @@ func TestBuildDockerAgentDiagnostic(t *testing.T) {
if diag.AgentsNeedingAttention == 0 {
t.Fatalf("expected agents needing attention")
}
+
+ diagnosticText := strings.Join(diag.Notes, "\n")
+ for _, attention := range diag.Attention {
+ diagnosticText += "\n" + strings.Join(attention.Issues, "\n")
+ }
+ if strings.Contains(strings.ToLower(diagnosticText), "container runtime") {
+ t.Fatalf("Docker diagnostics should not expose generic container-runtime copy, got %q", diagnosticText)
+ }
+ for _, want := range []string{
+ "Docker / Podman agent is still using the shared API token",
+ "1 Docker / Podman agent is out of date",
+ "Settings → Infrastructure",
+ } {
+ if !strings.Contains(diagnosticText, want) {
+ t.Fatalf("expected Docker / Podman diagnostic copy %q in %q", want, diagnosticText)
+ }
+ }
+}
+
+func TestBuildDockerAgentDiagnosticEmptyUsesDockerPodmanCopy(t *testing.T) {
+ cfg := &config.Config{DataPath: t.TempDir()}
+ monitor := newMonitorForDiagnostics(t, cfg)
+
+ diag := buildDockerAgentDiagnostic(monitor, "1.0.0")
+ if diag == nil {
+ t.Fatalf("expected diagnostics")
+ }
+
+ notes := strings.Join(diag.Notes, "\n")
+ if strings.Contains(strings.ToLower(notes), "container runtime") {
+ t.Fatalf("empty Docker diagnostics should not expose generic container-runtime copy, got %q", notes)
+ }
+ for _, want := range []string{
+ "No Docker / Podman agents have reported in yet",
+ "Settings → Infrastructure",
+ } {
+ if !strings.Contains(notes, want) {
+ t.Fatalf("expected empty Docker / Podman diagnostic copy %q in %q", want, notes)
+ }
+ }
}
func TestBuildAlertsDiagnostic_LegacySettings(t *testing.T) {