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.

feat(kubernetes): scope overview workloads by cluster

[email protected]206d3a1c4d98
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index b26166cb05..a72b8c6863 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1359,6 +1359,21 @@ Agent`), with the plain-language source phrase available through accessible
Jobs, and CronJobs, including targets, active/current counts,
ready/succeeded counts, availability, exceptions, service names, schedules,
and last run metadata.
+ Kubernetes Overview keeps the cluster inventory above the native workload
+ inventory so multi-cluster operators can orient and scope in one surface,
+ matching the Docker Overview host-to-container flow. Selecting a cluster
+ name writes the canonical `cluster` query parameter and scopes every
+ Deployment, Pod, StatefulSet, DaemonSet, ReplicaSet, Job, CronJob, and
+ autoscaling section beneath it; selecting the active cluster again clears
+ that scope. The same URL-backed Cluster facet is available on Workloads,
+ Services, and Configuration and composes with the existing namespace,
+ search, and status parameters so saved views, bookmarks, and shared links
+ retain the complete scope. Changing cluster scope clears namespace scope to
+ prevent a namespace from the previous cluster from silently hiding all
+ rows. Cluster names remain separate from their external web-interface
+ control and detail disclosure: the name scopes inventory, the adjacent
+ external-link icon opens the persisted cluster URL, and the row continues
+ to own drawer expansion.
7. Keep shared source/platform vocabulary on the governed manifest boundary. `frontend-modern/src/utils/platformSupportManifest.generated.ts` must be the tracked frontend projection of `docs/release-control/v6/internal/PLATFORM_SUPPORT_MANIFEST.json`, `frontend-modern/src/utils/platformSupportManifest.ts`, `frontend-modern/src/utils/sourcePlatforms.ts`, and `frontend-modern/src/utils/sourcePlatformOptions.ts` must consume that generated projection instead of embedding divergent future-label lists, setup/onboarding path allowlists, host-profile labels, surface-kind guesses, readiness-state guesses, or presentation-only guesses, and `frontend-modern/scripts/canonical-platform-audit.mjs` must fail when the generated projection drifts from the governed manifest. The generated governance/readiness split is authoritative: supported platform arrays drive current support claims, while admitted platform arrays may keep route/navigation and add-flow vocabulary available without turning `first-lab-ready` entries such as VMware into supported-source copy. Kubernetes manifest projections must enumerate the native API-backed page sections the shared tab shell can expose, including controllers, networking, storage, config, policy, autoscaling, and events, so platform pages do not invent local support claims outside the governed JSON. The generated `surface_kind` is the machine-readable boundary between owning platform entries and runtime lenses: `docker` is a `runtime-lens`, not a `platform`, even when the container-runtime route stays available as a primary shell destination. The generic `docker` source-platform label is "Docker / Podman" in shared selectors, badges, and filter options so v5 Docker users can find the runtime surface while Podman-backed rows are not mislabeled as Docker-only; "Container runtime" remains the governed runtime family, not the primary customer-facing label. Identity colour is semantic, not page-local decoration: shared source/platform badges, host identity badges, and container runtime badges must use the shared presentation helpers so Docker remains on the Docker/Podman blue runtime tone, Podman uses its distinct runtime tone, Proxmox PVE remains orange, and those meanings do not drift across table rows, filters, drawers, or platform pages. Agent host-profile entries, including Unraid, stay in the generated `agentHostProfiles` projection and shared wrapper helpers; frontend primitives may render those labels for Pulse Agent install/identity copy but must not add them to the first-class platform union.
The generated host-profile projection also carries runtime platform fallback
metadata for shared explanation and parity with backend normalization, but
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 7afb879b0b..13c7c0b139 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -1653,6 +1653,7 @@ recovery scope, or a storage/recovery-owned secret source.
11e. Letting adjacent platform-route additions in shared `frontend-modern/src/routing/resourceLinks.ts` perturb storage or recovery route semantics; adding canonical `/standalone/machines`, `/standalone/availability`, or other platform paths must not reuse storage/recovery query names, alter storage or recovery parse/build behavior, or convert agent-platform membership into storage/recovery ownership
11f. Letting adjacent Patrol control starter route state in shared `frontend-modern/src/routing/resourceLinks.ts` perturb storage or recovery route semantics; `patrolControlStarter=patrol_control` is a first-party Patrol control handoff flag only, legacy `operationsLoopStarter=patrol_control`, `operationsLoopStarter=patrol_autonomy`, and `operationsLoopStarter=pulse_pro_activation` are only compatibility aliases, and storage/recovery parse-build contracts must not consume any of them as recovery state, storage focus, platform scope, or proof of backup/recovery posture
11g. Letting adjacent Pulse Intelligence external-agent setup anchors in shared `frontend-modern/src/routing/resourceLinks.ts` perturb storage or recovery route semantics; `/settings/pulse-intelligence/assistant#external-agent-setup` is the canonical external-agent setup hash, `/settings/security/api#external-agent-setup` and `/settings/security/api#pulse-mcp-setup` are legacy compatibility hashes, and storage/recovery parse-build contracts must not consume any of them as recovery state, storage focus, platform scope, or proof of backup/recovery posture
+ 11h. Letting the Kubernetes platform page's route-local `cluster` scope perturb recovery's separate `cluster` filter merely because both constants live in shared `frontend-modern/src/routing/resourceLinks.ts`; `/kubernetes` may serialize `cluster=<clusterId>` for native inventory scoping, while `/recovery` continues to normalize and transport its own protected-item cluster vocabulary through the recovery parser/builders, with neither surface importing the other's option set or state owner
12. Letting protected-inventory protection posture overload recovery-event outcome filtering; the protected inventory protection-state control must drive the route-backed `state` field and local rollup posture filtering, while the recovery events `status` field remains the canonical outcome filter for points, series, and facets transport filters
13. Letting visible protected-item filters fall out of shared recovery links; protected inventory state such as stale, failed, warning, running, unknown, healthy, and never-succeeded must restore from the canonical recovery URL and rewrite to the owned `state=<value>` route form, with legacy `stale=1` accepted only as compatibility input
14. Reintroducing stacked full-width recovery tables as the primary desktop layout; the governed recovery surface must expose one primary data region at a time with recovery events as the default workspace and protection coverage as an explicit secondary review so Pulse does not collapse back into a single-platform backup screen
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 1bac41867b..cf865f8085 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -314,11 +314,16 @@ guest.
Platform Overview tabs are rollup boundaries, not duplicate inventory dumps.
Docker / Podman Overview owns runtime host rows and primary container workload
rows; image, storage, network, and Swarm object rows belong in their workflow
-tabs. Kubernetes Overview owns cluster/control-plane rollup rows only; node,
-workload, service, storage, configuration, policy, and event object rows belong
-in their workflow tabs. If a future Overview repeats a detailed table, the
-owning workflow must be retired or the Overview content must be reduced to
-aggregate signal.
+tabs. Kubernetes Overview owns cluster/control-plane rollup rows followed by
+the primary native workload stack: Deployments, Pods, workload controllers,
+and autoscaling rows. That deliberate cluster-to-workload composition mirrors
+the Docker host-to-container Overview and shares the exact same URL-backed
+cluster, namespace, search, and status state as the Workloads workflow; it must
+not fork a second projection or filter model. Node, service, storage,
+configuration, policy, and event object rows remain in their workflow tabs.
+Any other future Overview that repeats a detailed table must retire the owning
+workflow, reduce the Overview content to aggregate signal, or establish an
+equally explicit shared-state contract.
Cross-platform handoffs into the Docker / Podman Overview must preserve runtime
scope when the source surface knows it. A Proxmox LXC drawer that links to the
Docker runtime lens must carry the unambiguous Docker host facet as route state,
diff --git a/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx
index f404fb4626..2ea6e0e45e 100644
--- a/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx
+++ b/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx
@@ -73,6 +73,8 @@ export const KubernetesClustersTable: Component<{
emptyDescription: string;
title?: string;
showToolbar?: boolean;
+ selectedClusterId?: string;
+ onSelectCluster?: (cluster: Resource) => void;
}> = (props) => {
const alertsActivation = useAlertsActivation();
const tableState = createPlatformTableFilterState({
@@ -246,6 +248,10 @@ export const KubernetesClustersTable: Component<{
asTrimmedString(cluster.kubernetes?.clusterName) ||
asTrimmedString(cluster.name) ||
cluster.id;
+ const clusterScopeId = () =>
+ asTrimmedString(cluster.kubernetes?.clusterId) ||
+ asTrimmedString(cluster.kubernetes?.clusterName) ||
+ '';
const context = () => formatPlatformTableTextValue(cluster.kubernetes?.context);
const version = () => formatPlatformTableTextValue(cluster.kubernetes?.version);
const metricsKey = () => buildMetricKeyForUnifiedResource(cluster);
@@ -305,7 +311,31 @@ export const KubernetesClustersTable: Component<{
url={cluster.customUrl}
class="min-w-0"
nameClass="truncate font-semibold text-base-content"
- />
+ >
+ <Show when={props.onSelectCluster} fallback={name()}>
+ <button
+ type="button"
+ class={`truncate rounded-sm text-left font-semibold underline-offset-2 hover:text-blue-600 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:hover:text-blue-400 ${
+ props.selectedClusterId === clusterScopeId()
+ ? 'text-blue-600 dark:text-blue-400'
+ : 'text-base-content'
+ }`}
+ aria-label={`Show workloads for ${name()}`}
+ aria-pressed={
+ props.selectedClusterId === clusterScopeId()
+ ? 'true'
+ : 'false'
+ }
+ onClick={(event) => {
+ event.stopPropagation();
+ props.onSelectCluster?.(cluster);
+ }}
+ onKeyDown={(event) => event.stopPropagation()}
+ >
+ {name()}
+ </button>
+ </Show>
+ </ResourceNameWithWebInterfaceLink>
<Show when={cluster.kubernetes?.pendingUninstall === true}>
<span class="inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-900/40 dark:text-amber-300">
Pending uninstall
diff --git a/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx b/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx
index a7d47140d4..351a05b231 100644
--- a/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx
+++ b/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx
@@ -244,34 +244,57 @@ function countKubernetesVisible(
return visible;
}
-type KubernetesNamespaceScope = {
+type KubernetesInventoryScope = {
scopedSections: Accessor<Resource[][]>;
scopeFilters: Accessor<FilterDef[]>;
- hasActiveNamespace: Accessor<boolean>;
+ hasActiveScope: Accessor<boolean>;
};
-// Namespace scope for a shared-toolbar Kubernetes tab. Namespace is the primary
-// scoping axis and the shared toolbar drives several stacked tables at once, so
-// the facet pre-filters every section's resources rather than living on any one
-// table. URL-backed so it is shareable and captured by saved views; the facet
-// only appears when more than one namespace is present.
-function createKubernetesNamespaceScope(
+// Cluster and namespace scope for a shared-toolbar Kubernetes tab. The shared
+// toolbar drives several stacked tables at once, so both facets pre-filter every
+// section rather than living on any one table. URL-backed scope is shareable,
+// captured by saved views, and lets the Overview cluster table drive the
+// workload inventory beneath it.
+function createKubernetesInventoryScope(
sections: Accessor<Resource[][]>,
-): KubernetesNamespaceScope {
+): KubernetesInventoryScope {
const [searchParams, setSearchParams] = useSearchParams();
+ const clusterFilter = () => {
+ const value = searchParams[KUBERNETES_QUERY_PARAMS.cluster];
+ return typeof value === 'string' ? value : '';
+ };
const namespaceFilter = () => {
const value = searchParams[KUBERNETES_QUERY_PARAMS.namespace];
return typeof value === 'string' ? value : '';
};
+ const clusterOf = (resource: Resource) =>
+ (resource.kubernetes?.clusterId ?? resource.kubernetes?.clusterName ?? '').trim();
const namespaceOf = (resource: Resource) => (resource.kubernetes?.namespace ?? '').trim();
+ const matchesCluster = (resource: Resource) => {
+ const cluster = clusterFilter();
+ return !cluster || clusterOf(resource) === cluster;
+ };
const matchesNamespace = (resource: Resource) => {
const namespace = namespaceFilter();
return !namespace || namespaceOf(resource) === namespace;
};
+ const clusterOptions = createMemo(() => {
+ const clusters = new Map<string, string>();
+ for (const section of sections()) {
+ for (const resource of section) {
+ const value = clusterOf(resource);
+ if (!value) continue;
+ const label = (resource.kubernetes?.clusterName ?? value).trim() || value;
+ if (!clusters.has(value)) clusters.set(value, label);
+ }
+ }
+ return [...clusters.entries()].sort((left, right) => left[1].localeCompare(right[1]));
+ });
const namespaceOptions = createMemo(() => {
const seen = new Set<string>();
for (const section of sections()) {
for (const resource of section) {
+ if (!matchesCluster(resource)) continue;
const namespace = namespaceOf(resource);
if (namespace) seen.add(namespace);
}
@@ -279,12 +302,32 @@ function createKubernetesNamespaceScope(
return [...seen].sort((a, b) => a.localeCompare(b));
});
const scopedSections = createMemo<Resource[][]>(() =>
- sections().map((rows) => rows.filter(matchesNamespace)),
+ sections().map((rows) =>
+ rows.filter((resource) => matchesCluster(resource) && matchesNamespace(resource)),
+ ),
);
const scopeFilters = createMemo<FilterDef[]>(() => {
- if (namespaceOptions().length <= 1) return [];
- return [
- {
+ const filters: FilterDef[] = [];
+ if (clusterOptions().length > 1) {
+ filters.push({
+ id: 'cluster',
+ label: 'Cluster',
+ group: 'scope',
+ options: () => [
+ { value: '', label: 'All clusters' },
+ ...clusterOptions().map(([value, label]) => ({ value, label })),
+ ],
+ value: clusterFilter,
+ setValue: (value: string) =>
+ setSearchParams({
+ [KUBERNETES_QUERY_PARAMS.cluster]: value || null,
+ [KUBERNETES_QUERY_PARAMS.namespace]: null,
+ }),
+ defaultValue: '',
+ });
+ }
+ if (namespaceOptions().length > 1) {
+ filters.push({
id: 'namespace',
label: 'Namespace',
group: 'scope',
@@ -296,13 +339,14 @@ function createKubernetesNamespaceScope(
setValue: (value: string) =>
setSearchParams({ [KUBERNETES_QUERY_PARAMS.namespace]: value || null }),
defaultValue: '',
- },
- ];
+ });
+ }
+ return filters;
});
return {
scopedSections,
scopeFilters,
- hasActiveNamespace: () => namespaceFilter() !== '',
+ hasActiveScope: () => clusterFilter() !== '' || namespaceFilter() !== '',
};
}
@@ -319,9 +363,9 @@ function KubernetesWorkloads(props: { model: KubernetesPageModel; controllers: R
]);
const totalRows = createMemo(() => sections().reduce((sum, rows) => sum + rows.length, 0));
- // Namespace scope applies across every workload section at once (see the
- // shared helper). Section order here defines the scoped accessors below.
- const scope = createKubernetesNamespaceScope(sections);
+ // Cluster and namespace scope apply across every workload section at once
+ // (see the shared helper). Section order defines the scoped accessors below.
+ const scope = createKubernetesInventoryScope(sections);
const scopedDeployments = () => scope.scopedSections()[0];
const scopedPods = () => scope.scopedSections()[1];
const scopedControllers = () => scope.scopedSections()[2];
@@ -330,8 +374,12 @@ function KubernetesWorkloads(props: { model: KubernetesPageModel; controllers: R
const visibleRows = createMemo(() =>
countKubernetesVisible(scope.scopedSections(), toolbar.search(), toolbar.status()),
);
- const hasActiveFilters = () => toolbar.hasActiveFilters() || scope.hasActiveNamespace();
- const resetFilters = () => toolbar.resetFilters({ [KUBERNETES_QUERY_PARAMS.namespace]: null });
+ const hasActiveFilters = () => toolbar.hasActiveFilters() || scope.hasActiveScope();
+ const resetFilters = () =>
+ toolbar.resetFilters({
+ [KUBERNETES_QUERY_PARAMS.cluster]: null,
+ [KUBERNETES_QUERY_PARAMS.namespace]: null,
+ });
return (
<Show
@@ -419,14 +467,18 @@ function KubernetesServices(props: { model: KubernetesPageModel }) {
props.model.serviceNetworking,
]);
const totalRows = createMemo(() => sections().reduce((sum, rows) => sum + rows.length, 0));
- const scope = createKubernetesNamespaceScope(sections);
+ const scope = createKubernetesInventoryScope(sections);
const scopedServices = () => scope.scopedSections()[0];
const scopedNetworking = () => scope.scopedSections()[1];
const visibleRows = createMemo(() =>
countKubernetesVisible(scope.scopedSections(), toolbar.search(), toolbar.status()),
);
- const hasActiveFilters = () => toolbar.hasActiveFilters() || scope.hasActiveNamespace();
- const resetFilters = () => toolbar.resetFilters({ [KUBERNETES_QUERY_PARAMS.namespace]: null });
+ const hasActiveFilters = () => toolbar.hasActiveFilters() || scope.hasActiveScope();
+ const resetFilters = () =>
+ toolbar.resetFilters({
+ [KUBERNETES_QUERY_PARAMS.cluster]: null,
+ [KUBERNETES_QUERY_PARAMS.namespace]: null,
+ });
return (
<Show
@@ -489,14 +541,18 @@ function KubernetesConfiguration(props: { model: KubernetesPageModel }) {
const toolbar = createKubernetesSharedToolbar();
const sections = createMemo<Resource[][]>(() => [props.model.config, props.model.policy]);
const totalRows = createMemo(() => sections().reduce((sum, rows) => sum + rows.length, 0));
- const scope = createKubernetesNamespaceScope(sections);
+ const scope = createKubernetesInventoryScope(sections);
const scopedConfig = () => scope.scopedSections()[0];
const scopedPolicy = () => scope.scopedSections()[1];
const visibleRows = createMemo(() =>
countKubernetesVisible(scope.scopedSections(), toolbar.search(), toolbar.status()),
);
- const hasActiveFilters = () => toolbar.hasActiveFilters() || scope.hasActiveNamespace();
- const resetFilters = () => toolbar.resetFilters({ [KUBERNETES_QUERY_PARAMS.namespace]: null });
+ const hasActiveFilters = () => toolbar.hasActiveFilters() || scope.hasActiveScope();
+ const resetFilters = () =>
+ toolbar.resetFilters({
+ [KUBERNETES_QUERY_PARAMS.cluster]: null,
+ [KUBERNETES_QUERY_PARAMS.namespace]: null,
+ });
return (
<Show
@@ -553,6 +609,7 @@ function KubernetesConfiguration(props: { model: KubernetesPageModel }) {
}
function KubernetesOverview(props: KubernetesOverviewProps) {
+ const [searchParams, setSearchParams] = useSearchParams();
const posture = createMemo(() => buildKubernetesOverviewPosture(props.model()));
const needsAttention = () => posture().attentionResources > 0 || posture().attentionSignals > 0;
const workloadAttention = () => posture().podAttention + posture().deploymentAttention;
@@ -608,6 +665,24 @@ function KubernetesOverview(props: KubernetesOverviewProps) {
emptyTitle="No clusters reported"
emptyDescription="Kubernetes clusters appear here once at least one agent reports cluster context."
showToolbar={false}
+ selectedClusterId={
+ typeof searchParams[KUBERNETES_QUERY_PARAMS.cluster] === 'string'
+ ? searchParams[KUBERNETES_QUERY_PARAMS.cluster]
+ : ''
+ }
+ onSelectCluster={(cluster) => {
+ const clusterId =
+ cluster.kubernetes?.clusterId?.trim() || cluster.kubernetes?.clusterName?.trim() || '';
+ setSearchParams({
+ [KUBERNETES_QUERY_PARAMS.cluster]:
+ searchParams[KUBERNETES_QUERY_PARAMS.cluster] === clusterId ? null : clusterId,
+ [KUBERNETES_QUERY_PARAMS.namespace]: null,
+ });
+ }}
+ />
+ <KubernetesWorkloads
+ model={props.model()}
+ controllers={getKubernetesControllerResources(props.model())}
/>
<Show when={props.model().incidents.length > 0}>
<div id="kubernetes-health-signals">
diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesClustersTable.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesClustersTable.test.tsx
index e56d4370b8..73c94775aa 100644
--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesClustersTable.test.tsx
+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesClustersTable.test.tsx
@@ -1,4 +1,4 @@
-import { cleanup, render, screen } from '@solidjs/testing-library';
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
import { afterEach, describe, expect, it, vi } from 'vitest';
import type { Resource } from '@/types/resource';
@@ -148,4 +148,27 @@ describe('KubernetesClustersTable', () => {
expect(screen.getByText('Pending uninstall')).toBeInTheDocument();
});
+
+ it('lets the overview scope workload inventory from the cluster name', () => {
+ const cluster = makeClusterResource();
+ const onSelectCluster = vi.fn();
+
+ render(() => (
+ <KubernetesClustersTable
+ clusters={[cluster]}
+ scope={[cluster]}
+ emptyIcon={<span />}
+ emptyTitle="No clusters"
+ emptyDescription="No clusters"
+ showToolbar={false}
+ selectedClusterId="prod-west"
+ onSelectCluster={onSelectCluster}
+ />
+ ));
+
+ const selector = screen.getByRole('button', { name: 'Show workloads for prod-west' });
+ expect(selector).toHaveAttribute('aria-pressed', 'true');
+ fireEvent.click(selector);
+ expect(onSelectCluster).toHaveBeenCalledWith(cluster);
+ });
});
diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx
index 6940c0eaa0..d8bb6140ea 100644
--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx
@@ -197,9 +197,9 @@ describe('KubernetesPageSurface contract', () => {
);
expect(screen.getByTestId('platform-section-tabs')).toHaveAttribute('data-active', 'overview');
expect(screen.getByTestId('clusters-table')).toHaveAttribute('data-rows', '1');
- expect(screen.queryByTestId('pods-table')).toBeNull();
- expect(screen.queryByTestId('deployments-table')).toBeNull();
- expect(screen.queryByTestId('controllers-table')).toBeNull();
+ expect(screen.getByTestId('pods-table')).toHaveAttribute('data-rows', '1');
+ expect(screen.getByTestId('deployments-table')).toHaveAttribute('data-rows', '1');
+ expect(screen.getByTestId('controllers-table')).toHaveAttribute('data-rows', '1');
});
it('falls back to Overview when a requested Kubernetes workflow has no inventory', () => {
diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurfaceUrlFilters.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurfaceUrlFilters.test.tsx
index af34629d60..e3916e470c 100644
--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurfaceUrlFilters.test.tsx
+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurfaceUrlFilters.test.tsx
@@ -92,6 +92,72 @@ describe('Kubernetes URL-backed shared toolbar filters', () => {
expect(screen.queryByText('checkout-api')).not.toBeInTheDocument();
});
+ it('applies the URL cluster filter across workload sections', () => {
+ setResources([
+ makeResource({
+ id: 'west-api',
+ type: 'k8s-deployment',
+ kubernetes: { clusterId: 'cluster-west', clusterName: 'West', namespace: 'prod' },
+ }),
+ makeResource({
+ id: 'east-api',
+ type: 'k8s-deployment',
+ kubernetes: { clusterId: 'cluster-east', clusterName: 'East', namespace: 'prod' },
+ }),
+ makeResource({
+ id: 'west-pod',
+ type: 'pod',
+ kubernetes: { clusterId: 'cluster-west', clusterName: 'West', namespace: 'prod' },
+ }),
+ makeResource({
+ id: 'east-pod',
+ type: 'pod',
+ kubernetes: { clusterId: 'cluster-east', clusterName: 'East', namespace: 'prod' },
+ }),
+ ]);
+
+ renderSurfaceAt('/kubernetes/workloads?cluster=cluster-west');
+
+ expect(screen.getByText('west-api')).toBeInTheDocument();
+ expect(screen.getByText('west-pod')).toBeInTheDocument();
+ expect(screen.queryByText('east-api')).not.toBeInTheDocument();
+ expect(screen.queryByText('east-pod')).not.toBeInTheDocument();
+ });
+
+ it('scopes the Overview workload inventory when a cluster name is selected', async () => {
+ setResources([
+ makeResource({
+ id: 'cluster-west',
+ type: 'k8s-cluster',
+ name: 'West',
+ kubernetes: { clusterId: 'cluster-west', clusterName: 'West' },
+ }),
+ makeResource({
+ id: 'cluster-east',
+ type: 'k8s-cluster',
+ name: 'East',
+ kubernetes: { clusterId: 'cluster-east', clusterName: 'East' },
+ }),
+ makeResource({
+ id: 'west-api',
+ type: 'k8s-deployment',
+ kubernetes: { clusterId: 'cluster-west', clusterName: 'West', namespace: 'prod' },
+ }),
+ makeResource({
+ id: 'east-api',
+ type: 'k8s-deployment',
+ kubernetes: { clusterId: 'cluster-east', clusterName: 'East', namespace: 'prod' },
+ }),
+ ]);
+
+ renderSurfaceAt('/kubernetes/overview');
+ fireEvent.click(screen.getByRole('button', { name: 'Show workloads for West' }));
+
+ await waitFor(() => expect(window.location.search).toBe('?cluster=cluster-west'));
+ expect(screen.getByText('west-api')).toBeInTheDocument();
+ expect(screen.queryByText('east-api')).not.toBeInTheDocument();
+ });
+
it('applies the URL search filter on the services tab', () => {
setResources([
makeResource({ id: 'checkout-svc', type: 'k8s-service' }),
@@ -116,7 +182,7 @@ describe('Kubernetes URL-backed shared toolbar filters', () => {
expect(screen.queryByText('cache-settings')).not.toBeInTheDocument();
});
- it('clears search, status, and namespace in one navigation on reset', async () => {
+ it('clears search, status, cluster, and namespace in one navigation on reset', async () => {
setResources([
makeResource({
id: 'checkout-api',
@@ -131,13 +197,15 @@ describe('Kubernetes URL-backed shared toolbar filters', () => {
}),
]);
- renderSurfaceAt('/kubernetes/workloads?q=-cache&status=offline&namespace=prod');
+ renderSurfaceAt(
+ '/kubernetes/workloads?q=-cache&status=offline&cluster=cluster-1&namespace=prod',
+ );
fireEvent.click(screen.getByLabelText('Clear all'));
// A multi-write reset would leave earlier-cleared params resurrected by
// later writes (each merges against the pre-navigation URL); the settled
- // URL must lose all three params.
+ // URL must lose all four params.
await waitFor(() => expect(window.location.search).toBe(''));
expect(screen.getByText('checkout-api')).toBeInTheDocument();
expect(screen.getByText('cache-worker')).toBeInTheDocument();
diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
index 1c6d83b98e..2b8ea87c0d 100644
--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
@@ -8,6 +8,7 @@ import {
EXTERNAL_AGENT_SETUP_ANCHOR,
EXTERNAL_AGENT_SETUP_PATH,
KUBERNETES_PATH,
+ KUBERNETES_QUERY_PARAMS,
PMG_THRESHOLDS_PATH,
PATROL_AUTONOMY_OPERATIONS_LOOP_PATH,
PATROL_CONTROL_ANCHOR,
@@ -187,6 +188,7 @@ describe('resource link routing contract', () => {
expect(buildKubernetesPath('services')).toBe('/kubernetes/services');
expect(buildKubernetesPath('configuration')).toBe('/kubernetes/configuration');
expect(buildKubernetesPath('pods')).toBe('/kubernetes/pods');
+ expect(KUBERNETES_QUERY_PARAMS.cluster).toBe('cluster');
expect(TRUENAS_PATH).toBe('/truenas');
expect(buildTrueNASPath()).toBe('/truenas/overview');
diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.ts
index af8923b2de..d772d0ad42 100644
--- a/frontend-modern/src/routing/resourceLinks.ts
+++ b/frontend-modern/src/routing/resourceLinks.ts
@@ -66,6 +66,7 @@ export const DOCKER_QUERY_PARAMS = {
} as const;
export const KUBERNETES_QUERY_PARAMS = {
+ cluster: 'cluster',
namespace: 'namespace',
query: 'q',
status: 'status',