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.

Centralize Kubernetes cluster projection in unified resources

rcourtmana3f24c304b2a
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 0b2e758f99..9cc403b67a 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -152,6 +152,10 @@ same canonical cluster-name boundary.
The drawer's discovery mapper also reuses that helper for pod fallback agent
IDs, so the resource-detail hot path and the dashboard selector path stay
aligned on the same cluster-name source of truth.
+The unified-resource projection also uses that same helper for Kubernetes
+`clusterId`, so the shared store, dashboard grouping, and detail-navigation
+surfaces all see the same cluster-context prefix before any surface-specific
+fallback applies.
The aggregate `/api/charts/workloads-summary` endpoint now also has its own
explicit API p95 budget constant, aligned with the per-workload charts budget,
and `internal/api/slo_bench_test.go` must fail if that aggregate budget or its
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 7f2595547c..2afc872394 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -737,8 +737,12 @@ trusts the backend canonical metadata directly instead of re-normalizing it
locally, so storage and recovery views see the same policy posture the API
publishes. The same hook and the resource-identity helpers it depends on now
share the canonical trimmed-string utility instead of each surface rebuilding
-its own whitespace cleanup, so storage and recovery identity checks stay
-aligned with the other unified-resource consumers. That same boundary now also
-owns the backend facet-bundle route for timeline history and related change
-counts, so storage and recovery surfaces must continue to consume the shared
-bundle rather than issuing separate local resource-detail fetches.
+ its own whitespace cleanup, so storage and recovery identity checks stay
+ aligned with the other unified-resource consumers. That same decode path
+ also projects Kubernetes cluster identity through the shared cluster-context
+ helper, so storage and recovery surfaces see the same canonical cluster
+ prefix as the dashboard and unified-resource store instead of rebuilding
+ their own fallback. That same boundary now also owns the backend facet-bundle
+ route for timeline history and related change counts, so storage and recovery
+ surfaces must continue to consume the shared bundle rather than issuing
+ separate local resource-detail fetches.
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 686424cace..d3ee8b8da0 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -300,6 +300,10 @@ The dashboard workload projection and workloads-link route helpers also share
the same Kubernetes context prefix helper, so pod grouping and cluster
navigation keep the same cluster-context prefix before any surface-specific
display fallback is applied.
+The unified-resource projection also reuses that same prefix helper for
+projected Kubernetes `clusterId`, so the shared resource store stays aligned
+with the dashboard and detail surfaces on the same canonical cluster-context
+source of truth.
That same contract also owns the canonical resource display-name fallback, so
name-or-ID presentation stays consistent between the unified AI adapter, the
AI resource context, and the shared resource selectors instead of being
diff --git a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
index c433220b56..4c0a4aaabc 100644
--- a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
@@ -203,6 +203,40 @@ describe('useUnifiedResources', () => {
dispose();
});
+ it('projects kubernetes clusterId from the canonical context prefix', async () => {
+ apiFetchMock.mockResolvedValueOnce({
+ ok: true,
+ json: async () => ({
+ data: [
+ {
+ ...v2Resource,
+ type: 'pod',
+ kubernetes: {
+ clusterName: 'cluster-a',
+ context: 'cluster-context',
+ clusterId: 'cluster-a-id',
+ podUid: 'pod-uid-1',
+ },
+ },
+ ],
+ }),
+ });
+
+ let dispose = () => {};
+ let result: ReturnType<UseUnifiedResourcesModule['useUnifiedResources']> | undefined;
+ createRoot((d) => {
+ dispose = d;
+ result = useUnifiedResources();
+ });
+
+ await flushAsync();
+ await waitForResourceCount(() => result!.resources().length);
+
+ expect(result!.resources()[0]?.clusterId).toBe('cluster-a');
+
+ dispose();
+ });
+
it('falls back to proxmox temperature when agent temperature is unavailable', async () => {
apiFetchMock.mockResolvedValueOnce({
ok: true,
diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.ts
index e2c397da07..52de21b501 100644
--- a/frontend-modern/src/hooks/useUnifiedResources.ts
+++ b/frontend-modern/src/hooks/useUnifiedResources.ts
@@ -21,7 +21,10 @@ import { normalizeDiskArray } from '@/utils/format';
import { logger } from '@/utils/logger';
import { eventBus } from '@/stores/events';
import { canonicalDiscoveryResourceType } from '@/utils/discoveryTarget';
-import { getPreferredNormalizedPlatformId } from '@/utils/resourceIdentity';
+import {
+ getPreferredNormalizedPlatformId,
+ getPreferredResourceKubernetesContext,
+} from '@/utils/resourceIdentity';
import {
resolvePlatformTypeFromSources,
resolveSourceTypeFromSources,
@@ -555,7 +558,10 @@ const toResource = (v2: APIResource): Resource => {
sourceType: resolveSourceTypeFromSources(sources),
parentId: v2.parentId,
parentName: v2.parentName,
- clusterId: v2.identity?.clusterName || v2.proxmox?.clusterName,
+ clusterId:
+ getPreferredResourceKubernetesContext(v2) ||
+ v2.identity?.clusterName ||
+ v2.proxmox?.clusterName,
status: resolveStatus(v2.status),
incidentCount: v2.incidentCount,
incidentCode: v2.incidentCode,