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 management API copy

rcourtman5e8619eb583c
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 57cc89c939..641a6f362f 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -1670,6 +1670,12 @@ 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.
+Lifecycle-adjacent Docker / Podman management responses are part of that same
+shared backend dependency. When `internal/api/docker_agents.go`,
+`internal/api/docker_metadata.go`, or `frontend-modern/src/api/monitoring.ts`
+surface host removal, hide/unhide, pending uninstall, display-name, or metadata
+errors, the operator-facing copy must describe Docker / Podman agents or hosts
+rather than reviving generic container-runtime labels.
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 fa4a383384..effc670260 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -242,6 +242,13 @@ the canonical monitored-system blocked payload.
agent language and route operator recovery to the Infrastructure and
Security settings surfaces rather than generic runtime family wording or
retired agent-management destinations.
+3b. Route Docker / Podman management API response copy through
+ `internal/api/docker_agents.go`, `internal/api/docker_metadata.go`,
+ `frontend-modern/src/api/monitoring.ts`, and their route/client tests
+ together. Operator-facing responses for Docker / Podman host removal,
+ hide/unhide, pending uninstall, display-name, and host metadata paths must
+ use Docker / Podman agent or host wording instead of generic container
+ runtime labels.
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/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index cab639399a..9cd5fc416e 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -102,6 +102,10 @@ querying, and the operator-facing storage health presentation layer.
those notes. Recovery-adjacent diagnostics consumers must preserve the
source-specific Docker / Podman wording and recovery destinations governed
by the shared diagnostics API contract.
+ Adjacent Docker / Podman management routes may also share `internal/api/`
+ transport with storage/recovery. Storage and recovery consumers must
+ preserve the API-owned Docker / Podman agent or host wording for management
+ responses and must not introduce recovery-local container-runtime labels.
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/frontend-modern/src/api/__tests__/monitoring.test.ts b/frontend-modern/src/api/__tests__/monitoring.test.ts
index 7b414c87c6..e44243bc97 100644
--- a/frontend-modern/src/api/__tests__/monitoring.test.ts
+++ b/frontend-modern/src/api/__tests__/monitoring.test.ts
@@ -165,12 +165,12 @@ describe('MonitoringAPI', () => {
);
});
- it('throws the canonical missing-runtime message on 404', async () => {
+ it('throws the canonical missing Docker / Podman message on 404', async () => {
vi.mocked(apiFetch).mockResolvedValueOnce({ ok: false, status: 404 } as unknown as Response);
await expect(
MonitoringAPI.setDockerRuntimeDisplayName('agent-1', 'New Name'),
- ).rejects.toThrow('Container runtime not found');
+ ).rejects.toThrow('Docker / Podman agent not found');
});
});
diff --git a/frontend-modern/src/api/monitoring.ts b/frontend-modern/src/api/monitoring.ts
index 4ce14a2269..181b445b29 100644
--- a/frontend-modern/src/api/monitoring.ts
+++ b/frontend-modern/src/api/monitoring.ts
@@ -146,7 +146,7 @@ export class MonitoringAPI {
return deleteResource<DeleteDockerRuntimeResponse>(
url,
- 'Failed to parse delete container runtime response',
+ 'Failed to parse Docker / Podman agent delete response',
);
}
@@ -165,7 +165,7 @@ export class MonitoringAPI {
await setResourceDisplayName(
url,
displayName,
- 'Container runtime not found',
+ 'Docker / Podman agent not found',
);
}
@@ -336,7 +336,7 @@ export class MonitoringAPI {
}
/**
- * Triggers an immediate update check for all containers on a specific container runtime.
+ * Triggers an immediate update check for all containers on a specific Docker / Podman agent.
*/
static async checkDockerUpdates(
agentId: string,
@@ -349,7 +349,7 @@ export class MonitoringAPI {
}
/**
- * Triggers a batch update for all containers with updates available on a specific container runtime.
+ * Triggers a batch update for all containers with updates available on a specific Docker / Podman agent.
*/
static async updateAllDockerContainers(
agentId: string,
diff --git a/internal/api/docker_agents.go b/internal/api/docker_agents.go
index 4af9d1b823..f371c8c4d4 100644
--- a/internal/api/docker_agents.go
+++ b/internal/api/docker_agents.go
@@ -249,7 +249,7 @@ func (h *DockerAgentHandlers) HandleCommandAck(w http.ResponseWriter, r *http.Re
}
// If a container update succeeded, migrate persisted container metadata (custom URLs, notes, tags)
- // so the UI doesn't "lose" it when the container runtime ID changes.
+ // so the UI doesn't lose it when the container ID changes.
if status == monitoring.DockerCommandStatusCompleted && commandStatus.Type == monitoring.DockerCommandTypeUpdateContainer && len(req.Payload) > 0 {
oldContainerID, _ := req.Payload["oldContainerId"].(string)
newContainerID, _ := req.Payload["newContainerId"].(string)
@@ -290,7 +290,7 @@ func (h *DockerAgentHandlers) HandleCommandAck(w http.ResponseWriter, r *http.Re
}
}
-// HandleDeleteHost removes or hides a container runtime from the shared state.
+// HandleDeleteHost removes or hides a Docker / Podman host from the shared state.
// If query parameter ?hide=true is provided, the host is marked as hidden instead of deleted.
func (h *DockerAgentHandlers) HandleDeleteHost(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodDelete {
@@ -314,7 +314,7 @@ func (h *DockerAgentHandlers) HandleDeleteHost(w http.ResponseWriter, r *http.Re
if shouldHide {
if !hostExists {
- writeErrorResponse(w, http.StatusNotFound, "docker_agent_not_found", "Container runtime not found", nil)
+ writeErrorResponse(w, http.StatusNotFound, "docker_agent_not_found", "Docker / Podman agent not found", nil)
return
}
host, err := h.getMonitor(r.Context()).HideDockerHost(agentID)
@@ -328,7 +328,7 @@ func (h *DockerAgentHandlers) HandleDeleteHost(w http.ResponseWriter, r *http.Re
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
"agentId": host.ID,
- "message": "Container runtime hidden",
+ "message": "Docker / Podman agent hidden",
}); err != nil {
log.Error().Err(err).Msg("Failed to serialize docker host operation response")
}
@@ -340,14 +340,14 @@ func (h *DockerAgentHandlers) HandleDeleteHost(w http.ResponseWriter, r *http.Re
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
"agentId": agentID,
- "message": "Container runtime already removed",
+ "message": "Docker / Podman agent already removed",
}); err != nil {
log.Error().Err(err).Msg("Failed to serialize docker host operation response")
}
return
}
- writeErrorResponse(w, http.StatusNotFound, "docker_agent_not_found", "Container runtime not found", nil)
+ writeErrorResponse(w, http.StatusNotFound, "docker_agent_not_found", "Docker / Podman agent not found", nil)
return
}
@@ -382,13 +382,13 @@ func (h *DockerAgentHandlers) HandleDeleteHost(w http.ResponseWriter, r *http.Re
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
"agentId": host.ID,
- "message": "Container runtime removed",
+ "message": "Docker / Podman agent removed",
}); err != nil {
log.Error().Err(err).Msg("Failed to serialize docker host operation response")
}
}
-// HandleAllowReenroll clears the removal block for a container runtime to permit future reports.
+// HandleAllowReenroll clears the removal block for a Docker / Podman host to permit future reports.
func (h *DockerAgentHandlers) HandleAllowReenroll(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
writeErrorResponse(w, http.StatusMethodNotAllowed, "method_not_allowed", "Only POST is allowed", nil)
@@ -417,7 +417,7 @@ func (h *DockerAgentHandlers) HandleAllowReenroll(w http.ResponseWriter, r *http
}
}
-// HandleUnhideHost unhides a previously hidden container runtime.
+// HandleUnhideHost unhides a previously hidden Docker / Podman host.
func (h *DockerAgentHandlers) HandleUnhideHost(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPut {
writeErrorResponse(w, http.StatusMethodNotAllowed, "method_not_allowed", "Only PUT is allowed", nil)
@@ -441,13 +441,13 @@ func (h *DockerAgentHandlers) HandleUnhideHost(w http.ResponseWriter, r *http.Re
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
"agentId": host.ID,
- "message": "Container runtime unhidden",
+ "message": "Docker / Podman agent unhidden",
}); err != nil {
log.Error().Err(err).Msg("Failed to serialize docker host unhide response")
}
}
-// HandleMarkPendingUninstall marks a container runtime as pending uninstall.
+// HandleMarkPendingUninstall marks a Docker / Podman host as pending uninstall.
func (h *DockerAgentHandlers) HandleMarkPendingUninstall(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPut {
writeErrorResponse(w, http.StatusMethodNotAllowed, "method_not_allowed", "Only PUT is allowed", nil)
@@ -471,13 +471,13 @@ func (h *DockerAgentHandlers) HandleMarkPendingUninstall(w http.ResponseWriter,
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
"agentId": host.ID,
- "message": "Container runtime marked as pending uninstall",
+ "message": "Docker / Podman agent marked as pending uninstall",
}); err != nil {
log.Error().Err(err).Msg("Failed to serialize docker host pending uninstall response")
}
}
-// HandleSetCustomDisplayName updates the custom display name for a container runtime.
+// HandleSetCustomDisplayName updates the custom display name for a Docker / Podman host.
func (h *DockerAgentHandlers) HandleSetCustomDisplayName(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPut {
writeErrorResponse(w, http.StatusMethodNotAllowed, "method_not_allowed", "Only PUT is allowed", nil)
@@ -515,7 +515,7 @@ func (h *DockerAgentHandlers) HandleSetCustomDisplayName(w http.ResponseWriter,
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
"agentId": host.ID,
- "message": "Container runtime custom display name updated",
+ "message": "Docker / Podman agent custom display name updated",
}); err != nil {
log.Error().Err(err).Msg("Failed to serialize docker host custom display name response")
}
@@ -584,7 +584,7 @@ func (h *DockerAgentHandlers) HandleContainerUpdate(w http.ResponseWriter, r *ht
}
}
-// HandleUpdateAll triggers an update for all containers with updates available on a container runtime.
+// HandleUpdateAll triggers an update for all containers with updates available on a Docker / Podman host.
// POST /api/agents/docker/runtimes/{agentId}/update-all
func (h *DockerAgentHandlers) HandleUpdateAll(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
@@ -624,7 +624,7 @@ func (h *DockerAgentHandlers) HandleUpdateAll(w http.ResponseWriter, r *http.Req
}
}
-// HandleCheckUpdates triggers an immediate update check for all containers on a container runtime.
+// HandleCheckUpdates triggers an immediate update check for all containers on a Docker / Podman host.
// POST /api/agents/docker/runtimes/{agentId}/check-updates
func (h *DockerAgentHandlers) HandleCheckUpdates(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
diff --git a/internal/api/docker_agents_additional_test.go b/internal/api/docker_agents_additional_test.go
index 00999c22a7..2b515c7d58 100644
--- a/internal/api/docker_agents_additional_test.go
+++ b/internal/api/docker_agents_additional_test.go
@@ -219,6 +219,9 @@ func TestDockerAgentHandlers_HandleDeleteHost(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want 200: %s", rec.Code, rec.Body.String())
}
+ if body := rec.Body.String(); !strings.Contains(body, "Docker / Podman agent removed") || strings.Contains(body, "Container runtime") {
+ t.Fatalf("unexpected delete response body: %s", body)
+ }
}
func TestDockerAgentHandlers_HandleUnhideHost(t *testing.T) {
@@ -232,6 +235,9 @@ func TestDockerAgentHandlers_HandleUnhideHost(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want 200: %s", rec.Code, rec.Body.String())
}
+ if body := rec.Body.String(); !strings.Contains(body, "Docker / Podman agent unhidden") || strings.Contains(body, "Container runtime") {
+ t.Fatalf("unexpected unhide response body: %s", body)
+ }
}
func TestDockerAgentHandlers_HandleMarkPendingUninstall(t *testing.T) {
@@ -245,6 +251,9 @@ func TestDockerAgentHandlers_HandleMarkPendingUninstall(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want 200: %s", rec.Code, rec.Body.String())
}
+ if body := rec.Body.String(); !strings.Contains(body, "Docker / Podman agent marked as pending uninstall") || strings.Contains(body, "Container runtime") {
+ t.Fatalf("unexpected pending uninstall response body: %s", body)
+ }
}
func TestDockerAgentHandlers_HandleSetCustomDisplayName(t *testing.T) {
@@ -259,6 +268,9 @@ func TestDockerAgentHandlers_HandleSetCustomDisplayName(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want 200: %s", rec.Code, rec.Body.String())
}
+ if body := rec.Body.String(); !strings.Contains(body, "Docker / Podman agent custom display name updated") || strings.Contains(body, "Container runtime") {
+ t.Fatalf("unexpected display-name response body: %s", body)
+ }
}
func TestDockerAgentHandlers_HandleContainerUpdate(t *testing.T) {
diff --git a/internal/api/docker_agents_routes_more_test.go b/internal/api/docker_agents_routes_more_test.go
index d48fce9658..21c6725480 100644
--- a/internal/api/docker_agents_routes_more_test.go
+++ b/internal/api/docker_agents_routes_more_test.go
@@ -113,6 +113,9 @@ func TestDockerAgentHandlers_HandleDeleteHost_Errors(t *testing.T) {
if rec.Code != http.StatusNotFound {
t.Fatalf("expected 404, got %d", rec.Code)
}
+ if body := rec.Body.String(); !strings.Contains(body, "Docker / Podman agent not found") || strings.Contains(body, "Container runtime") {
+ t.Fatalf("unexpected missing hide response body: %s", body)
+ }
req = httptest.NewRequest(http.MethodDelete, "/api/agents/docker/runtimes/missing?force=true", nil)
rec = httptest.NewRecorder()
@@ -120,6 +123,9 @@ func TestDockerAgentHandlers_HandleDeleteHost_Errors(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("expected 200, got %d", rec.Code)
}
+ if body := rec.Body.String(); !strings.Contains(body, "Docker / Podman agent already removed") || strings.Contains(body, "Container runtime") {
+ t.Fatalf("unexpected forced delete response body: %s", body)
+ }
}
func TestDockerAgentHandlers_RejectsLegacyHostsRouteAlias(t *testing.T) {
diff --git a/internal/api/docker_metadata.go b/internal/api/docker_metadata.go
index 228d47823e..7fa5b82072 100644
--- a/internal/api/docker_metadata.go
+++ b/internal/api/docker_metadata.go
@@ -198,7 +198,7 @@ func (h *DockerMetadataHandler) HandleGetRuntimeMetadata(w http.ResponseWriter,
}
}
-// HandleUpdateRuntimeMetadata updates metadata for a container runtime.
+// HandleUpdateRuntimeMetadata updates metadata for a Docker / Podman host.
func (h *DockerMetadataHandler) HandleUpdateRuntimeMetadata(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPut && r.Method != http.MethodPost {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
@@ -207,7 +207,7 @@ func (h *DockerMetadataHandler) HandleUpdateRuntimeMetadata(w http.ResponseWrite
runtimeID := strings.TrimPrefix(r.URL.Path, dockerRuntimeMetadataPathPrefix)
if runtimeID == "" || runtimeID == "metadata" {
- http.Error(w, "Container runtime ID required", http.StatusBadRequest)
+ http.Error(w, "Docker / Podman host ID required", http.StatusBadRequest)
return
}
@@ -243,18 +243,18 @@ func (h *DockerMetadataHandler) HandleUpdateRuntimeMetadata(w http.ResponseWrite
}
if err := store.SetHostMetadata(runtimeID, &meta); err != nil {
- log.Error().Err(err).Str("runtimeID", runtimeID).Msg("Failed to save container runtime metadata")
+ log.Error().Err(err).Str("runtimeID", runtimeID).Msg("Failed to save Docker / Podman host metadata")
http.Error(w, metadataSaveErrorMessage(err), http.StatusInternalServerError)
return
}
- log.Info().Str("runtimeID", runtimeID).Str("url", meta.CustomURL).Msg("Updated container runtime metadata")
+ log.Info().Str("runtimeID", runtimeID).Str("url", meta.CustomURL).Msg("Updated Docker / Podman host metadata")
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(&meta)
}
-// HandleDeleteRuntimeMetadata removes metadata for a container runtime.
+// HandleDeleteRuntimeMetadata removes metadata for a Docker / Podman host.
func (h *DockerMetadataHandler) HandleDeleteRuntimeMetadata(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodDelete {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
@@ -263,17 +263,17 @@ func (h *DockerMetadataHandler) HandleDeleteRuntimeMetadata(w http.ResponseWrite
runtimeID := strings.TrimPrefix(r.URL.Path, dockerRuntimeMetadataPathPrefix)
if runtimeID == "" || runtimeID == "metadata" {
- http.Error(w, "Container runtime ID required", http.StatusBadRequest)
+ http.Error(w, "Docker / Podman host ID required", http.StatusBadRequest)
return
}
store := h.getStore(r.Context())
if err := store.SetHostMetadata(runtimeID, nil); err != nil {
- log.Error().Err(err).Str("runtimeID", runtimeID).Msg("Failed to delete container runtime metadata")
+ log.Error().Err(err).Str("runtimeID", runtimeID).Msg("Failed to delete Docker / Podman host metadata")
http.Error(w, "Failed to delete metadata", http.StatusInternalServerError)
return
}
- log.Info().Str("runtimeID", runtimeID).Msg("Deleted container runtime metadata")
+ log.Info().Str("runtimeID", runtimeID).Msg("Deleted Docker / Podman host metadata")
w.WriteHeader(http.StatusNoContent)
}
diff --git a/internal/api/docker_metadata_additional_test.go b/internal/api/docker_metadata_additional_test.go
index 6ef1ceedf6..f9e413966c 100644
--- a/internal/api/docker_metadata_additional_test.go
+++ b/internal/api/docker_metadata_additional_test.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/http"
"net/http/httptest"
+ "strings"
"testing"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
@@ -171,4 +172,28 @@ func TestDockerMetadataHandlers_RuntimeMetadata(t *testing.T) {
t.Fatalf("status = %d, want 204", rec.Code)
}
})
+
+ t.Run("missing-runtime-id-copy", func(t *testing.T) {
+ req := httptest.NewRequest(http.MethodPut, "/api/docker/runtimes/metadata/", bytes.NewReader([]byte(`{}`)))
+ rec := httptest.NewRecorder()
+
+ handler.HandleUpdateRuntimeMetadata(rec, req)
+ if rec.Code != http.StatusBadRequest {
+ t.Fatalf("status = %d, want 400", rec.Code)
+ }
+ if body := rec.Body.String(); !strings.Contains(body, "Docker / Podman host ID required") || strings.Contains(body, "Container runtime") {
+ t.Fatalf("unexpected missing runtime ID response body: %s", body)
+ }
+
+ req = httptest.NewRequest(http.MethodDelete, "/api/docker/runtimes/metadata/", nil)
+ rec = httptest.NewRecorder()
+
+ handler.HandleDeleteRuntimeMetadata(rec, req)
+ if rec.Code != http.StatusBadRequest {
+ t.Fatalf("status = %d, want 400", rec.Code)
+ }
+ if body := rec.Body.String(); !strings.Contains(body, "Docker / Podman host ID required") || strings.Contains(body, "Container runtime") {
+ t.Fatalf("unexpected missing runtime ID delete response body: %s", body)
+ }
+ })
}