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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Centralize workload cluster-name projection
rcourtman6ad3f70b3a49
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex d172cb9b56..5ef7fff2f7 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -140,10 +140,10 @@ also routes its Kubernetes-cluster fallback through the same preferredresource display contract, so navigation context does not leak raw`displayName` values for governed clusters.That same workloads-link path and the dashboard workload projection now also-share the canonical Kubernetes cluster helpers in the shared agent-resource-layer, so route labels, pod grouping, and cluster-name fetch keys keep using-the same cluster-context source of truth instead of rebuilding the-`clusterName`/`context`/`clusterId` prefix locally.+share the canonical cluster-name helpers in the shared agent-resource layer,+so route labels, pod grouping, and cluster-name fetch keys keep using the+same source of truth instead of rebuilding the `clusterName`/`context`/+`clusterId` prefix locally.The drawer's Kubernetes namespace/deployment tabs use the canonicalcluster-name helper for fetch keys, so the visible navigation label staysseparate from the backend cluster lookup contract.diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 2afc872394..997a028251 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -51,6 +51,7 @@ querying, and the operator-facing storage health presentation layer.3. Add or change storage page UX through `frontend-modern/src/components/Storage/` and `frontend-modern/src/features/storageBackups/`4. Route transport changes for storage and recovery endpoints through `internal/api/` and the owning `api-contracts` proof routes5. Route canonical storage/recovery resource selection through `frontend-modern/src/hooks/useUnifiedResources.ts` and the owning `unified-resources` contract+ That shared hook now also projects resource `clusterId` through the shared cluster-name helper, so storage and recovery links keep the same cluster-context label as other unified-resource consumers instead of rebuilding a local fallback chain.6. Preserve API-owned node identity continuity in shared `internal/api/` helpers so storage and recovery transport attachments do not fork by hostname-versus-IP drift across the same runtime.7. Preserve fail-closed API assignment and lookup behavior in shared `internal/api/` helpers so storage and recovery surfaces do not inherit orphaned profile or resource references from unrelated transport mutations.8. Preserve canonical configured public endpoint selection in shared `internal/api/` helpers so recovery and storage links do not inherit loopback-local scheme drift from admin-originated setup/install flows.diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex f6dff45bc1..d005300247 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -172,10 +172,10 @@ The same surfaces now also render recent changes through the shared`frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx`card, so canonical timeline wording and ordering stay governed by onefrontend feed instead of separate page-local loops.-The same shared agent-resource module now also owns the canonical Kubernetes-cluster helpers, so cluster-name labels and Kubernetes context prefixes stay-aligned instead of each surface rebuilding its own pod and namespace routing-fallbacks.+The same shared agent-resource module now also owns the canonical cluster-name+helpers, so Kubernetes context prefixes, Proxmox cluster labels, and+cluster-name fetch keys stay aligned instead of each surface rebuilding its+own pod, namespace, and VM routing fallbacks.The canonical unified-resource change and relationship presenters now alsoshare the same elapsed-time and "ago" wording utilities, so `observed`,`last seen`, and `ago` fragments stay consistent without each formatterdiff --git a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.tsindex 4c0a4aaabc..b1ec38bc00 100644--- a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts+++ b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts@@ -237,6 +237,38 @@ describe('useUnifiedResources', () => {dispose();});+ it('projects proxmox clusterId from the shared cluster helper', async () => {+ apiFetchMock.mockResolvedValueOnce({+ ok: true,+ json: async () => ({+ data: [+ {+ ...v2Resource,+ type: 'vm',+ proxmox: {+ nodeName: 'pve1',+ clusterName: 'cluster-b',+ },+ },+ ],+ }),+ });++ 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-b');++ dispose();+ });+it('falls back to proxmox temperature when agent temperature is unavailable', async () => {apiFetchMock.mockResolvedValueOnce({ok: true,diff --git a/frontend-modern/src/hooks/__tests__/useWorkloads.test.ts b/frontend-modern/src/hooks/__tests__/useWorkloads.test.tsindex 997c3ed8af..ece6105afe 100644--- a/frontend-modern/src/hooks/__tests__/useWorkloads.test.ts+++ b/frontend-modern/src/hooks/__tests__/useWorkloads.test.ts@@ -196,6 +196,42 @@ describe('useWorkloads', () => {dispose();});+ it('uses the shared cluster-name helper for proxmox workload labels', async () => {+ apiFetchJSONMock.mockResolvedValueOnce({+ data: [+ {+ ...sampleResource,+ id: 'vm-1',+ type: 'vm',+ name: 'vm-1',+ instance: undefined,+ proxmox: {+ clusterName: 'cluster-b',+ },+ },+ ],+ meta: { totalPages: 1 },+ });++ let dispose = () => {};+ let result: ReturnType<UseWorkloadsModule['useWorkloads']> | undefined;+ createRoot((d) => {+ dispose = d;+ const [enabled] = createSignal(true);+ result = useWorkloads(enabled);+ });++ await flushAsync();+ await waitForWorkloadCount(() => result!.workloads().length);++ expect(result!.workloads()[0]?.clusterName).toBe('cluster-b');+ expect(result!.workloads()[0]?.contextLabel).toBe('pve1 (cluster-b)');+ expect(result!.workloads()[0]?.instance).toBe('cluster-b');+ expect(result!.workloads()[0]?.id).toBe('cluster-b:pve1:101');++ dispose();+ });+it('keeps workload reference stable when polling returns identical payload', async () => {let dispose = () => {};let result: ReturnType<UseWorkloadsModule['useWorkloads']> | undefined;diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.tsindex 52de21b501..4e18aea3f3 100644--- a/frontend-modern/src/hooks/useUnifiedResources.ts+++ b/frontend-modern/src/hooks/useUnifiedResources.ts@@ -23,7 +23,7 @@ import { eventBus } from '@/stores/events';import { canonicalDiscoveryResourceType } from '@/utils/discoveryTarget';import {getPreferredNormalizedPlatformId,- getPreferredResourceKubernetesContext,+ getPreferredResourceClusterName,} from '@/utils/resourceIdentity';import {resolvePlatformTypeFromSources,@@ -558,10 +558,7 @@ const toResource = (v2: APIResource): Resource => {sourceType: resolveSourceTypeFromSources(sources),parentId: v2.parentId,parentName: v2.parentName,- clusterId:- getPreferredResourceKubernetesContext(v2) ||- v2.identity?.clusterName ||- v2.proxmox?.clusterName,+ clusterId: getPreferredResourceClusterName(v2),status: resolveStatus(v2.status),incidentCount: v2.incidentCount,incidentCode: v2.incidentCode,diff --git a/frontend-modern/src/hooks/useWorkloads.ts b/frontend-modern/src/hooks/useWorkloads.tsindex d339f06d63..c9983a07dc 100644--- a/frontend-modern/src/hooks/useWorkloads.ts+++ b/frontend-modern/src/hooks/useWorkloads.ts@@ -285,12 +285,12 @@ const mapResourceToWorkload = (resource: APIResource): WorkloadGuest | null => {const name = (resource.name || resource.id || '').toString().trim();const node = resource.node ?? resource.proxmox?.nodeName ?? resource.kubernetes?.nodeName ?? '';const kubernetesContext = getPreferredResourceKubernetesContext(resource);+ const preferredClusterName = getPreferredResourceClusterName(resource);const instance =resource.instance ??resource.proxmox?.instance ??kubernetesContext ??- resource.proxmox?.clusterName ??- resource.identity?.clusterName ??+ preferredClusterName ??'';const vmid =typeof resource.vmid === 'number'@@ -405,7 +405,7 @@ const mapResourceToWorkload = (resource: APIResource): WorkloadGuest | null => {workloadType === 'vm' || workloadType === 'system-container'? node? (() => {- const cluster = resource.proxmox?.clusterName || resource.identity?.clusterName || '';+ const cluster = preferredClusterName || '';if (cluster && cluster !== node) return `${node} (${cluster})`;if (instance && instance !== node) return `${node} (${instance})`;return node;@@ -414,10 +414,9 @@ const mapResourceToWorkload = (resource: APIResource): WorkloadGuest | null => {: workloadType === 'app-container'? resource.parentName || resource.docker?.hostname: workloadType === 'pod'- ? getPreferredResourceClusterName(resource)+ ? preferredClusterName: undefined,- clusterName:- (resource.proxmox?.clusterName || resource.identity?.clusterName || '').trim() || undefined,+ clusterName: preferredClusterName || undefined,containerRuntime:workloadType === 'app-container'? (resource.docker?.runtime || '').trim() || undefineddiff --git a/frontend-modern/src/utils/__tests__/agentResources.test.ts b/frontend-modern/src/utils/__tests__/agentResources.test.tsindex a8b98cef6c..5f5cefe0f3 100644--- a/frontend-modern/src/utils/__tests__/agentResources.test.ts+++ b/frontend-modern/src/utils/__tests__/agentResources.test.ts@@ -170,6 +170,17 @@ describe('agentResources', () => {}),),).toBe('cluster-by-name');++ expect(+ getPreferredResourceClusterName(+ makeResource({+ type: 'vm',+ proxmox: {+ clusterName: 'proxmox-cluster',+ },+ }),+ ),+ ).toBe('proxmox-cluster');});it('detects docker workloads scope from explicit docker facets instead of source lists', () => {diff --git a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts b/frontend-modern/src/utils/__tests__/resourceIdentity.test.tsindex c254bae16e..4b376b8d9a 100644--- a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts+++ b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts@@ -184,6 +184,19 @@ describe('resourceIdentity', () => {expect(getPreferredResourceClusterName(resource)).toBe('cluster-a');});+ it('prefers proxmox cluster names when kubernetes context is unavailable', () => {+ const resource = makeResource({+ type: 'vm',+ name: 'proxmox-node',+ displayName: 'Governed Node',+ proxmox: {+ clusterName: 'proxmox-cluster',+ },+ });++ expect(getPreferredResourceClusterName(resource)).toBe('proxmox-cluster');+ });+it('prefers the canonical Kubernetes context prefix without display fallbacks', () => {const resource = makeResource({type: 'k8s-node',diff --git a/frontend-modern/src/utils/agentResources.ts b/frontend-modern/src/utils/agentResources.tsindex f312f74bfc..559665088a 100644--- a/frontend-modern/src/utils/agentResources.ts+++ b/frontend-modern/src/utils/agentResources.ts@@ -36,6 +36,25 @@ type KubernetesContextLike = {} | null;};+type ResourceClusterNameLike = KubernetesContextLike & {+ identity?: {+ clusterName?: string | null;+ } | null;+ proxmox?: {+ clusterName?: string | null;+ } | null;+ platformData?: {+ kubernetes?: {+ clusterName?: string | null;+ context?: string | null;+ clusterId?: string | null;+ } | null;+ proxmox?: {+ clusterName?: string | null;+ } | null;+ } | null;+};+export const getPlatformDataRecord = (resource: Resource): Record<string, unknown> | undefined =>resource.platformData ? (resource.platformData as Record<string, unknown>) : undefined;@@ -122,9 +141,13 @@ export const getPreferredResourceKubernetesContext = (};export const getPreferredResourceClusterName = (- resource: KubernetesContextLike,+ resource: ResourceClusterNameLike,): string | undefined =>- getPreferredResourceKubernetesContext(resource) || asTrimmedString(resource.name);+ getPreferredResourceKubernetesContext(resource) ||+ asTrimmedString(resource.identity?.clusterName) ||+ asTrimmedString(resource.proxmox?.clusterName) ||+ asTrimmedString(resource.platformData?.proxmox?.clusterName) ||+ asTrimmedString(resource.name);export const getMetricsChartKeyCandidatesFromResource = (resource: Resource): string[] => {const candidates = [