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.

Expose Docker and Kubernetes API tab fields

rcourtman3403104662bd
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 3c6259d571..21e36a4316 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -205,7 +205,13 @@ network, Swarm node, task, secret, and config columns through dedicated native
tables. The Docker containers tab must use the native
`DockerContainersTable` for container state, health, restart, image, port,
network, mount, update, and host/runtime columns rather than embedding
-`WorkloadsSurface`.
+`WorkloadsSurface`. Swarm services must surface the API-reported rollout/update
+state in the native services table, and engine storage rows must expose a
+stable row hook so platform-page browser proof can verify the storage tab is
+hydrated from runtime disk-usage data. Kubernetes deployments must surface the
+API-native observed generation and metadata age columns through the shared
+table shell without page-local alignment helpers or generic infrastructure
+columns.
1. `frontend-modern/src/components/Settings/APIAccessPanel.tsx` shared with `security-privacy`: the API Access settings intro is both a security/privacy token-management trust surface and a canonical settings-shell presentation boundary.
The panel may own shell placement and local action layout, but
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index e3b29df45a..3ccd29bbe0 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -94,6 +94,10 @@ truth for live infrastructure data.
Swarm configs, and daemon storage-usage buckets from the documented runtime
API, then publish those
records through the Docker agent report for unified-resource ingestion.
+ Swarm service records must preserve documented service update status
+ (`UpdateStatus.State`, message, and completion time when reported) so the
+ container runtime surface can distinguish stable services from active or
+ failed rollouts without inventing frontend-only state.
Failures in image, volume, network, node, secret, config, or storage-usage
collection are best-effort warnings and must not make the whole host report
fail when container/runtime health data is otherwise usable. Podman libpod
@@ -205,10 +209,13 @@ truth for live infrastructure data.
their API-native target, current, ready/succeeded, availability, exception,
service-name, schedule, and timing fields so the native services,
networking, storage, and workload-controller tabs exercise the same
- report/resource contract as live agents. Monitoring must preserve those
- objects as native cluster inventory instead of flattening them into pods,
- deployments, or generic networking, storage, configuration, or controller
- rows.
+ report/resource contract as live agents. Deployment inventory must preserve
+ Kubernetes object metadata creation time and `status.observedGeneration`
+ from the agent report through monitoring models so the frontend can show
+ API-native age and generation evidence instead of reconstructing those
+ fields locally. Monitoring must preserve those objects as native cluster
+ inventory instead of flattening them into pods, deployments, or generic
+ networking, storage, configuration, or controller rows.
## Forbidden Paths
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 70166a1e72..540edccc31 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -158,7 +158,11 @@ DaemonSet, Job, and CronJob rows render through
for desired replica/node/job targets, current or active counts, ready/succeeded
counts, availability, misscheduled/unavailable/failed/suspended exceptions,
service names, schedules, and controller timing fields instead of falling back
-to infrastructure columns.
+to infrastructure columns. Deployment rows render through
+`frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx` with
+Deployment status replica counts, `status.observedGeneration`, and metadata
+creation age carried by the canonical Kubernetes resource facet rather than
+page-local derivation or generic host columns.
Container runtime navigation is a unified-resource consumer boundary: the
`/docker` route is the Docker / Podman runtime lens, not an exclusive owning
@@ -192,7 +196,10 @@ Docker / Podman runtime inventory is a unified-resource consumer boundary: the
container runtime page must render Engine container, image, volume, network,
Swarm node, task, secret, and config resources through API-object-native tables
that preserve the fields documented by the Docker Engine API instead of routing
-those rows through a variant-switched generic inventory table.
+those rows through a variant-switched generic inventory table. Swarm service
+rows must preserve the service update status emitted by the Docker adapter, and
+engine storage rows must stay host-scoped with table proof hooks so browser
+proof can distinguish a populated disk-usage tab from an empty fixture.
1. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts` shared with `performance-and-scalability`: the infrastructure selector pipeline is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
2. `frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx` shared with `performance-and-scalability`: the infrastructure summary surface is both a canonical unified-resource consumer and a fleet-scale summary chart hot-path boundary.
diff --git a/frontend-modern/src/features/docker/DockerServicesTable.tsx b/frontend-modern/src/features/docker/DockerServicesTable.tsx
index 44ebbb45db..2be66097f0 100644
--- a/frontend-modern/src/features/docker/DockerServicesTable.tsx
+++ b/frontend-modern/src/features/docker/DockerServicesTable.tsx
@@ -34,7 +34,7 @@ import type { Resource } from '@/types/resource';
// dashes for those columns on docker-service rows. This service-native
// table reuses canonical shared primitives (Card, Table, SearchInput,
// FilterButtonGroup, StatusDot) but surfaces operator columns that the
-// data actually backs: image, mode, replica counts, ports, host.
+// data actually backs: image, mode, replica counts, update state, ports, host.
const formatPorts = (ports: Resource['docker'] extends infer T ? T : never): string => {
const entries =
@@ -63,6 +63,21 @@ const replicaCount = (value: number | undefined): JSX.Element => (
<span class="tabular-nums">{value ?? 0}</span>
);
+const formatServiceUpdate = (
+ update: NonNullable<Resource['docker']>['serviceUpdate'],
+): { label: string; title: string } => {
+ const state = asTrimmedString(update?.state);
+ const message = asTrimmedString(update?.message);
+ const completedAt = asTrimmedString(update?.completedAt);
+ if (!state && !message && !completedAt) {
+ return { label: 'Stable', title: 'No active service update reported' };
+ }
+
+ const label = state || 'Updating';
+ const title = [state, message, completedAt].filter(Boolean).join(' | ') || label;
+ return { label, title };
+};
+
export const DockerServicesTable: Component<{
resources: Resource[];
sourceCount?: number;
@@ -124,34 +139,51 @@ export const DockerServicesTable: Component<{
>
<TableCard class={PLATFORM_TABLE_CARD_CLASS}>
<TableCardHeader title={props.title ?? 'Swarm Services'} />
- <Table class="min-w-full table-fixed text-xs md:min-w-[1080px]">
+ <Table class="min-w-full table-fixed text-xs md:min-w-[1320px]">
<TableHeader>
<TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>
{/*
Desktop widths: Service and Image take the lion's share
because their content is long (registry refs, fully
qualified service names). Mode / Desired / Running trim
- to short text and 1-2 digit counts. Ports and Host get
- a middle slice for port lists and hostnames. Mobile
- widths are unchanged.
+ to short text and 1-2 digit counts. Update, Ports, and
+ Host get middle slices for rollout state, port lists, and
+ hostnames. Mobile widths are unchanged.
*/}
- <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[22%]`}>
+ <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[18%]`}>
Service
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[25%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[22%]`}
+ >
Image
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[9%]`}>Mode</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[8%]`}>
+ <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[8%]`}>
+ Mode
+ </TableHead>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[8%]`}
+ >
Desired
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[8%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[8%]`}
+ >
Running
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[14%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[12%]`}
+ >
+ Update
+ </TableHead>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[14%]`}
+ >
Ports
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[14%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[10%]`}
+ >
Host
</TableHead>
</TableRow>
@@ -164,8 +196,9 @@ export const DockerServicesTable: Component<{
const mode = () => asTrimmedString(service.docker?.mode) || '—';
const host = () => asTrimmedString(service.docker?.hostname) || '—';
const indicator = () => getSimpleStatusIndicator(service.status);
+ const update = () => formatServiceUpdate(service.docker?.serviceUpdate);
return (
- <TableRow class="text-[11px] sm:text-xs">
+ <TableRow class="text-[11px] sm:text-xs" data-docker-service-row={service.id}>
<TableCell class={getPlatformTableCellClassForKind('name')}>
<div class="flex min-w-0 items-center gap-2">
<StatusDot
@@ -186,7 +219,9 @@ export const DockerServicesTable: Component<{
{image()}
</span>
</TableCell>
- <TableCell class={`${getPlatformTableCellClassForKind('text')} text-base-content`}>
+ <TableCell
+ class={`${getPlatformTableCellClassForKind('text')} text-base-content`}
+ >
{mode()}
</TableCell>
<TableCell
@@ -199,6 +234,13 @@ export const DockerServicesTable: Component<{
>
{replicaCount(service.docker?.runningTasks)}
</TableCell>
+ <TableCell
+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}
+ >
+ <span class="truncate inline-block max-w-[10rem]" title={update().title}>
+ {update().label}
+ </span>
+ </TableCell>
<TableCell
class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}
>
diff --git a/frontend-modern/src/features/docker/DockerStorageUsageTable.tsx b/frontend-modern/src/features/docker/DockerStorageUsageTable.tsx
index 1c3b36f0b3..6e628b08f5 100644
--- a/frontend-modern/src/features/docker/DockerStorageUsageTable.tsx
+++ b/frontend-modern/src/features/docker/DockerStorageUsageTable.tsx
@@ -31,10 +31,10 @@ import type { DockerStorageUsageMeta, Resource } from '@/types/resource';
const hasStorageBucket = (bucket?: DockerStorageUsageMeta): boolean =>
Boolean(
bucket &&
- ((bucket.totalCount ?? 0) > 0 ||
- (bucket.activeCount ?? 0) > 0 ||
- (bucket.totalSizeBytes ?? 0) > 0 ||
- (bucket.reclaimableBytes ?? 0) > 0),
+ ((bucket.totalCount ?? 0) > 0 ||
+ (bucket.activeCount ?? 0) > 0 ||
+ (bucket.totalSizeBytes ?? 0) > 0 ||
+ (bucket.reclaimableBytes ?? 0) > 0),
);
const hasEngineStorageUsage = (host: Resource): boolean =>
@@ -80,9 +80,7 @@ export const DockerStorageUsageTable: Component<{
fallback={
<PlatformTableEmptyState
icon={props.emptyIcon}
- title={
- hasFilteredSourceRows() ? 'No engine storage usage reported' : props.emptyTitle
- }
+ title={hasFilteredSourceRows() ? 'No engine storage usage reported' : props.emptyTitle}
description={
hasFilteredSourceRows()
? 'Hosts are present, but none have reported the Docker / Podman disk-usage snapshot yet.'
@@ -150,7 +148,7 @@ export const DockerStorageUsageTable: Component<{
const name = () => asTrimmedString(host.name) || host.id;
const indicator = () => getSimpleStatusIndicator(host.status);
return (
- <TableRow class="text-[11px] sm:text-xs">
+ <TableRow class="text-[11px] sm:text-xs" data-docker-storage-row={host.id}>
<TableCell class={getPlatformTableCellClassForKind('name')}>
<div class="flex min-w-0 items-center gap-2">
<StatusDot
diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
index c93cd34e4a..f282b13cd5 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
@@ -7,6 +7,8 @@ import { DockerConfigsTable } from '../DockerConfigsTable';
import { DockerImagesTable } from '../DockerImagesTable';
import { DockerNetworksTable } from '../DockerNetworksTable';
import { DockerSecretsTable } from '../DockerSecretsTable';
+import { DockerServicesTable } from '../DockerServicesTable';
+import { DockerStorageUsageTable } from '../DockerStorageUsageTable';
import { DockerSwarmNodesTable } from '../DockerSwarmNodesTable';
import { DockerTasksTable } from '../DockerTasksTable';
import { DockerVolumesTable } from '../DockerVolumesTable';
@@ -232,6 +234,103 @@ describe('Docker native tables', () => {
expect(screen.getByText('10.0.0.11')).toBeInTheDocument();
});
+ it('renders Docker Swarm service API fields including update status', () => {
+ render(() => (
+ <DockerServicesTable
+ resources={[
+ makeResource({
+ id: 'service-1',
+ type: 'docker-service',
+ name: 'checkout-api',
+ docker: {
+ hostname: 'manager-1',
+ image: 'registry.example.com/checkout-api:2026.05',
+ mode: 'replicated',
+ desiredTasks: 4,
+ runningTasks: 2,
+ endpointPorts: [
+ { protocol: 'tcp', targetPort: 8080, publishedPort: 18080, publishMode: 'ingress' },
+ ],
+ serviceUpdate: {
+ state: 'rollback_started',
+ message: 'Service replicas below desired',
+ },
+ },
+ }),
+ ]}
+ emptyIcon={<span />}
+ emptyTitle="No services"
+ emptyDescription="No services"
+ showToolbar={false}
+ />
+ ));
+
+ expect(screen.getByText('Update')).toBeInTheDocument();
+ expect(screen.getByText('checkout-api')).toBeInTheDocument();
+ expect(screen.getByText('registry.example.com/checkout-api:2026.05')).toBeInTheDocument();
+ expect(screen.getByText('replicated')).toBeInTheDocument();
+ expect(screen.getByText('4')).toBeInTheDocument();
+ expect(screen.getByText('2')).toBeInTheDocument();
+ expect(screen.getByText('rollback_started')).toBeInTheDocument();
+ expect(screen.getByText('18080:8080/tcp')).toBeInTheDocument();
+ expect(screen.getByText('manager-1')).toBeInTheDocument();
+ expect(document.querySelector('[data-docker-service-row="service-1"]')).not.toBeNull();
+ });
+
+ it('renders Docker engine storage usage fields from the disk usage API shape', () => {
+ render(() => (
+ <DockerStorageUsageTable
+ hosts={[
+ makeResource({
+ id: 'host-1',
+ type: 'agent',
+ name: 'edge-01',
+ docker: {
+ imagesUsage: {
+ totalCount: 6,
+ activeCount: 4,
+ totalSizeBytes: 2 * 1024 * 1024 * 1024,
+ reclaimableBytes: 512 * 1024 * 1024,
+ },
+ containersUsage: {
+ totalCount: 8,
+ activeCount: 5,
+ totalSizeBytes: 3 * 1024 * 1024 * 1024,
+ reclaimableBytes: 256 * 1024 * 1024,
+ },
+ volumesUsage: {
+ totalCount: 3,
+ activeCount: 2,
+ totalSizeBytes: 12 * 1024 * 1024 * 1024,
+ reclaimableBytes: 1024 * 1024 * 1024,
+ },
+ buildCacheUsage: {
+ totalCount: 4,
+ activeCount: 1,
+ totalSizeBytes: 5 * 1024 * 1024 * 1024,
+ reclaimableBytes: 4 * 1024 * 1024 * 1024,
+ },
+ },
+ }),
+ ]}
+ emptyIcon={<span />}
+ emptyTitle="No storage"
+ emptyDescription="No storage"
+ />
+ ));
+
+ expect(screen.getByText('Images')).toBeInTheDocument();
+ expect(screen.getByText('Containers')).toBeInTheDocument();
+ expect(screen.getByText('Volumes')).toBeInTheDocument();
+ expect(screen.getByText('Build Cache')).toBeInTheDocument();
+ expect(screen.getByText('edge-01')).toBeInTheDocument();
+ expect(screen.getByText('2.00 GB')).toBeInTheDocument();
+ expect(screen.getByText('6 total, 4 active, 512 MB reclaimable')).toBeInTheDocument();
+ expect(screen.getByText('5.00 GB')).toBeInTheDocument();
+ expect(screen.getByText('4 total, 1 active, 4.00 GB reclaimable')).toBeInTheDocument();
+ expect(document.querySelector('[data-docker-storage-row="host-1"]')).not.toBeNull();
+ });
+
it('renders Docker Swarm task API fields', () => {
render(() => (
<DockerTasksTable
diff --git a/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx
index 95a5129735..c5329ccd81 100644
--- a/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx
+++ b/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx
@@ -12,6 +12,7 @@ import {
} from '@/components/shared/Table';
import { getSimpleStatusIndicator } from '@/utils/status';
import { asTrimmedString } from '@/utils/stringUtils';
+import { formatRelativeTime } from '@/utils/format';
import {
PLATFORM_TABLE_BODY_CLASS,
PLATFORM_TABLE_CARD_CLASS,
@@ -33,12 +34,16 @@ import type { Resource } from '@/types/resource';
// render as dashes. This deployment-native table reuses canonical shared
// primitives (Card, Table, SearchInput, FilterButtonGroup, StatusDot) but
// surfaces deployment-meaningful columns only: namespace, cluster,
-// desired / updated / ready / available replicas.
+// desired / updated / ready / available replicas, observed generation, and
+// metadata age.
const replicaCount = (value: number | undefined): JSX.Element => (
<span class="tabular-nums">{value ?? 0}</span>
);
+const formatAge = (createdAt: string | undefined): string =>
+ formatRelativeTime(createdAt, { compact: true, emptyText: '—' }) || '—';
+
export const KubernetesDeploymentsTable: Component<{
resources: Resource[];
emptyIcon: JSX.Element;
@@ -91,37 +96,59 @@ export const KubernetesDeploymentsTable: Component<{
>
<TableCard class={PLATFORM_TABLE_CARD_CLASS}>
<TableCardHeader title={props.title ?? 'Deployments'} />
- <Table class="min-w-full table-fixed text-xs md:min-w-[1080px]">
+ <Table class="min-w-full table-fixed text-xs md:min-w-[1320px]">
<TableHeader>
<TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>
{/*
Desktop widths: Deployment, Namespace, and Cluster take
the biggest shares because their content can be long.
- The four integer-count columns (Desired / Updated /
- Ready / Available) trim to what their headers plus
+ The integer-count columns (Desired / Updated / Ready /
+ Available / Observed) trim to what their headers plus
1-2 digit values need. Mobile widths are unchanged.
*/}
- <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[27%]`}>
+ <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[22%]`}>
Deployment
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[21%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[17%]`}
+ >
Namespace
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[16%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[14%]`}
+ >
Cluster
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[9%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[8%]`}
+ >
Desired
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[9%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[8%]`}
+ >
Updated
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[9%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[7%]`}
+ >
Ready
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[9%]`}>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[9%]`}
+ >
Available
</TableHead>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[9%]`}
+ >
+ Observed
+ </TableHead>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[6%]`}
+ >
+ Age
+ </TableHead>
</TableRow>
</TableHeader>
<TableBody class={PLATFORM_TABLE_BODY_CLASS}>
@@ -134,8 +161,12 @@ export const KubernetesDeploymentsTable: Component<{
asTrimmedString(deployment.kubernetes?.clusterId) ||
'—';
const indicator = () => getSimpleStatusIndicator(deployment.status);
+ const age = () => formatAge(deployment.kubernetes?.createdAt);
return (
- <TableRow class="text-[11px] sm:text-xs">
+ <TableRow
+ class="text-[11px] sm:text-xs"
+ data-kubernetes-deployment-row={deployment.id}
+ >
<TableCell class={getPlatformTableCellClassForKind('name')}>
<div class="flex min-w-0 items-center gap-2">
<StatusDot
@@ -179,6 +210,18 @@ export const KubernetesDeploymentsTable: Component<{
>
{replicaCount(deployment.kubernetes?.availableReplicas)}
</TableCell>
+ <TableCell
+ class={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content md:table-cell`}
+ >
+ {replicaCount(deployment.kubernetes?.observedGeneration)}
+ </TableCell>
+ <TableCell
+ class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
+ >
+ <span class="tabular-nums" title={deployment.kubernetes?.createdAt || ''}>
+ {age()}
+ </span>
+ </TableCell>
</TableRow>
);
}}
diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesDeploymentsTable.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesDeploymentsTable.test.tsx
new file mode 100644
index 0000000000..bf61a7f4ac
--- /dev/null
+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesDeploymentsTable.test.tsx
@@ -0,0 +1,84 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+import type { Resource } from '@/types/resource';
+import { KubernetesDeploymentsTable } from '../KubernetesDeploymentsTable';
+
+const makeResource = ({
+ id,
+ type = 'k8s-deployment',
+ ...overrides
+}: Partial<Resource> & Pick<Resource, 'id'>): Resource => ({
+ id,
+ name: id,
+ displayName: id,
+ platformId: 'cluster-1',
+ platformType: 'kubernetes',
+ sourceType: 'agent',
+ sources: ['kubernetes'],
+ status: 'online',
+ type,
+ lastSeen: 1_700_000_000_000,
+ ...overrides,
+});
+
+afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+});
+
+describe('KubernetesDeploymentsTable', () => {
+ it('renders Deployment status fields from the Kubernetes apps API contract', () => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date('2026-05-24T17:00:00Z'));
+
+ render(() => (
+ <KubernetesDeploymentsTable
+ resources={[
+ makeResource({
+ id: 'checkout-api',
+ kubernetes: {
+ clusterId: 'prod-euw1',
+ clusterName: 'Production EUW1',
+ namespace: 'services',
+ resourceKind: 'Deployment',
+ resourceUid: 'deploy-uid-1',
+ deploymentUid: 'deploy-uid-1',
+ desiredReplicas: 4,
+ updatedReplicas: 3,
+ readyReplicas: 2,
+ availableReplicas: 2,
+ observedGeneration: 12,
+ createdAt: '2026-05-24T15:00:00Z',
+ },
+ }),
+ ]}
+ emptyIcon={<span />}
+ emptyTitle="No deployments"
+ emptyDescription="No deployments"
+ showToolbar={false}
+ />
+ ));
+
+ expect(screen.getByText('Deployment')).toBeInTheDocument();
+ expect(screen.getByText('Namespace')).toBeInTheDocument();
+ expect(screen.getByText('Desired')).toBeInTheDocument();
+ expect(screen.getByText('Updated')).toBeInTheDocument();
+ expect(screen.getByText('Ready')).toBeInTheDocument();
+ expect(screen.getByText('Available')).toBeInTheDocument();
+ expect(screen.getByText('Observed')).toBeInTheDocument();
+ expect(screen.getByText('Age')).toBeInTheDocument();
+
+ expect(screen.getByText('checkout-api')).toBeInTheDocument();
+ expect(screen.getByText('services')).toBeInTheDocument();
+ expect(screen.getByText('Production EUW1')).toBeInTheDocument();
+ expect(screen.getByText('4')).toBeInTheDocument();
+ expect(screen.getByText('3')).toBeInTheDocument();
+ expect(screen.getAllByText('2')).toHaveLength(2);
+ expect(screen.getByText('12')).toBeInTheDocument();
+ expect(screen.getByText('2h ago')).toBeInTheDocument();
+ expect(
+ document.querySelector('[data-kubernetes-deployment-row="checkout-api"]'),
+ ).not.toBeNull();
+ });
+});
diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts
index 2908c39e22..a319801595 100644
--- a/frontend-modern/src/types/resource.ts
+++ b/frontend-modern/src/types/resource.ts
@@ -639,6 +639,11 @@ export interface ResourceDockerMeta {
lastChecked?: string;
error?: string;
};
+ serviceUpdate?: {
+ state?: string;
+ message?: string;
+ completedAt?: string;
+ };
mode?: string;
desiredTasks?: number;
runningTasks?: number;
diff --git a/internal/kubernetesagent/agent.go b/internal/kubernetesagent/agent.go
index 3143151e2e..9df070bb5f 100644
--- a/internal/kubernetesagent/agent.go
+++ b/internal/kubernetesagent/agent.go
@@ -1921,14 +1921,16 @@ func (a *Agent) collectDeployments(ctx context.Context) ([]agentsk8s.Deployment,
}
items = insertDeploymentSortedBounded(items, agentsk8s.Deployment{
- UID: string(dep.UID),
- Name: dep.Name,
- Namespace: dep.Namespace,
- DesiredReplicas: desiredReplicas(dep),
- UpdatedReplicas: dep.Status.UpdatedReplicas,
- ReadyReplicas: dep.Status.ReadyReplicas,
- AvailableReplicas: dep.Status.AvailableReplicas,
- Labels: labelsCopy,
+ UID: string(dep.UID),
+ Name: dep.Name,
+ Namespace: dep.Namespace,
+ CreatedAt: dep.CreationTimestamp.Time,
+ DesiredReplicas: desiredReplicas(dep),
+ UpdatedReplicas: dep.Status.UpdatedReplicas,
+ ReadyReplicas: dep.Status.ReadyReplicas,
+ AvailableReplicas: dep.Status.AvailableReplicas,
+ ObservedGeneration: dep.Status.ObservedGeneration,
+ Labels: labelsCopy,
}, maxDeployments)
}
diff --git a/internal/kubernetesagent/agent_inventory_test.go b/internal/kubernetesagent/agent_inventory_test.go
index 1020ce93db..1da2bf37e3 100644
--- a/internal/kubernetesagent/agent_inventory_test.go
+++ b/internal/kubernetesagent/agent_inventory_test.go
@@ -4,7 +4,9 @@ import (
"context"
"errors"
"testing"
+ "time"
+ appsv1 "k8s.io/api/apps/v1"
autoscalingv2 "k8s.io/api/autoscaling/v2"
corev1 "k8s.io/api/core/v1"
policyv1 "k8s.io/api/policy/v1"
@@ -149,6 +151,44 @@ func TestCollectNativePolicyConfigAndAutoscalingInventory(t *testing.T) {
}
}
+func TestCollectDeploymentInventoryPreservesAPIMetadata(t *testing.T) {
+ replicas := int32(4)
+ createdAt := metav1.NewTime(time.Date(2026, 5, 24, 15, 0, 0, 0, time.UTC))
+ clientset := fake.NewSimpleClientset(&appsv1.Deployment{
+ ObjectMeta: metav1.ObjectMeta{
+ UID: "deployment-uid-1",
+ Namespace: "services",
+ Name: "checkout-api",
+ CreationTimestamp: createdAt,
+ Labels: map[string]string{"app": "checkout"},
+ },
+ Spec: appsv1.DeploymentSpec{Replicas: &replicas},
+ Status: appsv1.DeploymentStatus{
+ ObservedGeneration: 12,
+ UpdatedReplicas: 3,
+ ReadyReplicas: 2,
+ AvailableReplicas: 2,
+ },
+ })
+ a := &Agent{kubeClient: clientset}
+
+ deployments, err := a.collectDeployments(context.Background())
+ if err != nil {
+ t.Fatalf("collectDeployments: %v", err)
+ }
+ if len(deployments) != 1 {
+ t.Fatalf("expected one deployment, got %+v", deployments)
+ }
+
+ deployment := deployments[0]
+ if deployment.UID != "deployment-uid-1" || deployment.Name != "checkout-api" || deployment.Namespace != "services" {
+ t.Fatalf("deployment identity metadata not preserved: %+v", deployment)
+ }
+ if !deployment.CreatedAt.Equal(createdAt.Time) || deployment.ObservedGeneration != 12 {
+ t.Fatalf("deployment API metadata not preserved: %+v", deployment)
+ }
+}
+
func int32Ptr(value int32) *int32 {
return &value
}
diff --git a/internal/kubernetesagent/agent_test.go b/internal/kubernetesagent/agent_test.go
index 1bf86e5e6d..eb42d82848 100644
--- a/internal/kubernetesagent/agent_test.go
+++ b/internal/kubernetesagent/agent_test.go
@@ -145,12 +145,18 @@ func TestCollectPods_FiltersProblemsAndSorts(t *testing.T) {
func TestCollectDeployments_FiltersProblems(t *testing.T) {
replicas := int32(3)
okReplicas := int32(2)
+ createdAt := metav1.NewTime(time.Date(2026, 5, 24, 15, 0, 0, 0, time.UTC))
clientset := fake.NewSimpleClientset(
&appsv1.Deployment{
- ObjectMeta: metav1.ObjectMeta{Namespace: "a", Name: "bad"},
- Spec: appsv1.DeploymentSpec{Replicas: &replicas},
- Status: appsv1.DeploymentStatus{AvailableReplicas: 2, ReadyReplicas: 2, UpdatedReplicas: 2},
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: "a",
+ Name: "bad",
+ UID: "deploy-uid-1",
+ CreationTimestamp: createdAt,
+ },
+ Spec: appsv1.DeploymentSpec{Replicas: &replicas},
+ Status: appsv1.DeploymentStatus{AvailableReplicas: 2, ReadyReplicas: 2, UpdatedReplicas: 2, ObservedGeneration: 8},
},
&appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{Namespace: "a", Name: "ok"},
@@ -181,6 +187,9 @@ func TestCollectDeployments_FiltersProblems(t *testing.T) {
if deps[0].Name != "bad" {
t.Fatalf("unexpected deployment: %+v", deps[0])
}
+ if deps[0].UID != "deploy-uid-1" || !deps[0].CreatedAt.Equal(createdAt.Time) || deps[0].ObservedGeneration != 8 {
+ t.Fatalf("deployment API metadata not captured: %+v", deps[0])
+ }
}
func TestCollectDeployments_IncludeAllDeployments(t *testing.T) {
diff --git a/internal/mock/generator.go b/internal/mock/generator.go
index d416a94dc3..4c5b6d85ce 100644
--- a/internal/mock/generator.go
+++ b/internal/mock/generator.go
@@ -1308,7 +1308,7 @@ func generateKubernetesClusters(config MockConfig) []models.KubernetesCluster {
nodes := generateKubernetesNodes(clusterID, nodeCount)
pods := generateKubernetesPods(clusterID, nodes, podCount)
- deployments := generateKubernetesDeployments(clusterID, deploymentCount)
+ deployments := generateKubernetesDeployments(clusterID, deploymentCount, now)
services, ingresses, endpointSlices := generateKubernetesNetworkingInventory(clusterID, now)
storageClasses, persistentVolumes, persistentVolumeClaims := generateKubernetesStorageInventory(clusterID, now)
@@ -2142,7 +2142,7 @@ func generateKubernetesPods(clusterID string, nodes []models.KubernetesNode, cou
return pods
}
-func generateKubernetesDeployments(clusterID string, count int) []models.KubernetesDeployment {
+func generateKubernetesDeployments(clusterID string, count int, now time.Time) []models.KubernetesDeployment {
if count <= 0 {
return []models.KubernetesDeployment{}
}
@@ -2166,13 +2166,15 @@ func generateKubernetesDeployments(clusterID string, count int) []models.Kuberne
}
deployments = append(deployments, models.KubernetesDeployment{
- UID: fmt.Sprintf("%s-%s", name, mockStableHexString(10, clusterID, namespace, name, fmt.Sprintf("%d", i), "k8s-deployment-uid")),
- Name: name,
- Namespace: namespace,
- DesiredReplicas: desired,
- UpdatedReplicas: updated,
- ReadyReplicas: ready,
- AvailableReplicas: available,
+ UID: fmt.Sprintf("%s-%s", name, mockStableHexString(10, clusterID, namespace, name, fmt.Sprintf("%d", i), "k8s-deployment-uid")),
+ Name: name,
+ Namespace: namespace,
+ CreatedAt: now.Add(-time.Duration(6+i*3+rand.Intn(48)) * time.Hour),
+ DesiredReplicas: desired,
+ UpdatedReplicas: updated,
+ ReadyReplicas: ready,
+ AvailableReplicas: available,
+ ObservedGeneration: int64(1 + i + rand.Intn(20)),
Labels: map[string]string{
"app.kubernetes.io/name": prefix,
"cluster": clusterID,
diff --git a/internal/mock/generator_test.go b/internal/mock/generator_test.go
index ffb0dbfe16..75d423f359 100644
--- a/internal/mock/generator_test.go
+++ b/internal/mock/generator_test.go
@@ -370,6 +370,36 @@ func TestBuildFixtureStatePopulatesKubernetesUsageMetrics(t *testing.T) {
}
}
+func TestBuildFixtureStateIncludesKubernetesDeploymentAPIMetadata(t *testing.T) {
+ cfg := DefaultConfig
+ cfg.K8sClusterCount = 1
+ cfg.K8sNodesPerCluster = 3
+ cfg.K8sPodsPerCluster = 8
+ cfg.K8sDeploymentsPerCluster = 6
+ cfg.RandomMetrics = false
+
+ data := buildFixtureState(cfg)
+ if len(data.KubernetesClusters) != 1 {
+ t.Fatalf("expected exactly one kubernetes cluster, got %d", len(data.KubernetesClusters))
+ }
+
+ cluster := data.KubernetesClusters[0]
+ if len(cluster.Deployments) == 0 {
+ t.Fatal("expected kubernetes deployment inventory")
+ }
+ for _, deployment := range cluster.Deployments {
+ if deployment.UID == "" {
+ t.Fatalf("deployment missing uid: %+v", deployment)
+ }
+ if deployment.CreatedAt.IsZero() {
+ t.Fatalf("deployment missing creation metadata: %+v", deployment)
+ }
+ if deployment.ObservedGeneration == 0 {
+ t.Fatalf("deployment missing observed generation: %+v", deployment)
+ }
+ }
+}
+
func TestBuildFixtureStateCreatesHostEntriesForKubernetesNodes(t *testing.T) {
cfg := DefaultConfig
cfg.K8sClusterCount = 1
diff --git a/internal/models/converters.go b/internal/models/converters.go
index 36f20b6d45..a14d9cfe66 100644
--- a/internal/models/converters.go
+++ b/internal/models/converters.go
@@ -440,14 +440,16 @@ func (c KubernetesCluster) ToFrontend() KubernetesClusterFrontend {
labels[k] = v
}
cluster.Deployments[i] = KubernetesDeploymentFrontend{
- UID: d.UID,
- Name: d.Name,
- Namespace: d.Namespace,
- DesiredReplicas: d.DesiredReplicas,
- UpdatedReplicas: d.UpdatedReplicas,
- ReadyReplicas: d.ReadyReplicas,
- AvailableReplicas: d.AvailableReplicas,
- Labels: labels,
+ UID: d.UID,
+ Name: d.Name,
+ Namespace: d.Namespace,
+ CreatedAt: timeToUnixMillis(d.CreatedAt),
+ DesiredReplicas: d.DesiredReplicas,
+ UpdatedReplicas: d.UpdatedReplicas,
+ ReadyReplicas: d.ReadyReplicas,
+ AvailableReplicas: d.AvailableReplicas,
+ ObservedGeneration: d.ObservedGeneration,
+ Labels: labels,
}.NormalizeCollections()
}
}
diff --git a/internal/models/converters_additional_test.go b/internal/models/converters_additional_test.go
index 9a281b3a35..4627650bd1 100644
--- a/internal/models/converters_additional_test.go
+++ b/internal/models/converters_additional_test.go
@@ -49,11 +49,13 @@ func TestKubernetesClusterToFrontend(t *testing.T) {
},
Deployments: []KubernetesDeployment{
{
- UID: "dep-1",
- Name: "deploy-a",
- Namespace: "ns",
- DesiredReplicas: 2,
- Labels: map[string]string{"tier": "web"},
+ UID: "dep-1",
+ Name: "deploy-a",
+ Namespace: "ns",
+ CreatedAt: now,
+ DesiredReplicas: 2,
+ ObservedGeneration: 7,
+ Labels: map[string]string{"tier": "web"},
},
},
}
@@ -74,6 +76,9 @@ func TestKubernetesClusterToFrontend(t *testing.T) {
if len(frontend.Deployments) != 1 || frontend.Deployments[0].Name != "deploy-a" {
t.Fatalf("Deployments = %#v, want 1 deployment", frontend.Deployments)
}
+ if frontend.Deployments[0].CreatedAt != now.Unix()*1000 || frontend.Deployments[0].ObservedGeneration != 7 {
+ t.Fatalf("Deployment API metadata = %#v", frontend.Deployments[0])
+ }
}
func TestKubernetesClusterToFrontend_DisplayNameFallback(t *testing.T) {
diff --git a/internal/models/models.go b/internal/models/models.go
index 51834caeaa..6556e7edc6 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -1276,14 +1276,16 @@ type KubernetesPodContainer struct {
}
type KubernetesDeployment struct {
- UID string `json:"uid"`
- Name string `json:"name"`
- Namespace string `json:"namespace"`
- DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
- UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
- ReadyReplicas int32 `json:"readyReplicas,omitempty"`
- AvailableReplicas int32 `json:"availableReplicas,omitempty"`
- Labels map[string]string `json:"labels,omitempty"`
+ UID string `json:"uid"`
+ Name string `json:"name"`
+ Namespace string `json:"namespace"`
+ CreatedAt time.Time `json:"createdAt,omitempty"`
+ DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
+ UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
+ ReadyReplicas int32 `json:"readyReplicas,omitempty"`
+ AvailableReplicas int32 `json:"availableReplicas,omitempty"`
+ ObservedGeneration int64 `json:"observedGeneration,omitempty"`
+ Labels map[string]string `json:"labels,omitempty"`
}
func (d KubernetesDeployment) NormalizeCollections() KubernetesDeployment {
diff --git a/internal/models/models_frontend.go b/internal/models/models_frontend.go
index b654673862..6545735a4c 100644
--- a/internal/models/models_frontend.go
+++ b/internal/models/models_frontend.go
@@ -417,14 +417,16 @@ type KubernetesPodContainerFrontend struct {
}
type KubernetesDeploymentFrontend struct {
- UID string `json:"uid"`
- Name string `json:"name"`
- Namespace string `json:"namespace"`
- DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
- UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
- ReadyReplicas int32 `json:"readyReplicas,omitempty"`
- AvailableReplicas int32 `json:"availableReplicas,omitempty"`
- Labels map[string]string `json:"labels"`
+ UID string `json:"uid"`
+ Name string `json:"name"`
+ Namespace string `json:"namespace"`
+ CreatedAt int64 `json:"createdAt,omitempty"`
+ DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
+ UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
+ ReadyReplicas int32 `json:"readyReplicas,omitempty"`
+ AvailableReplicas int32 `json:"availableReplicas,omitempty"`
+ ObservedGeneration int64 `json:"observedGeneration,omitempty"`
+ Labels map[string]string `json:"labels"`
}
func (d KubernetesDeploymentFrontend) NormalizeCollections() KubernetesDeploymentFrontend {
diff --git a/internal/monitoring/kubernetes_agents.go b/internal/monitoring/kubernetes_agents.go
index 6aa31444d1..f55399fdc7 100644
--- a/internal/monitoring/kubernetes_agents.go
+++ b/internal/monitoring/kubernetes_agents.go
@@ -241,14 +241,16 @@ func (m *Monitor) ApplyKubernetesReport(report agentsk8s.Report, tokenRecord *co
labels[k] = v
}
deployments = append(deployments, models.KubernetesDeployment{
- UID: strings.TrimSpace(d.UID),
- Name: strings.TrimSpace(d.Name),
- Namespace: strings.TrimSpace(d.Namespace),
- DesiredReplicas: d.DesiredReplicas,
- UpdatedReplicas: d.UpdatedReplicas,
- ReadyReplicas: d.ReadyReplicas,
- AvailableReplicas: d.AvailableReplicas,
- Labels: labels,
+ UID: strings.TrimSpace(d.UID),
+ Name: strings.TrimSpace(d.Name),
+ Namespace: strings.TrimSpace(d.Namespace),
+ CreatedAt: d.CreatedAt,
+ DesiredReplicas: d.DesiredReplicas,
+ UpdatedReplicas: d.UpdatedReplicas,
+ ReadyReplicas: d.ReadyReplicas,
+ AvailableReplicas: d.AvailableReplicas,
+ ObservedGeneration: d.ObservedGeneration,
+ Labels: labels,
})
}
diff --git a/internal/monitoring/kubernetes_agents_test.go b/internal/monitoring/kubernetes_agents_test.go
index 8a99715932..f66795dffa 100644
--- a/internal/monitoring/kubernetes_agents_test.go
+++ b/internal/monitoring/kubernetes_agents_test.go
@@ -113,6 +113,18 @@ func TestApplyKubernetesReportPreservesNativeAPIInventory(t *testing.T) {
Selector: map[string]string{"app": "checkout"},
CreatedAt: now,
}},
+ Deployments: []agentsk8s.Deployment{{
+ UID: "deploy-1",
+ Name: "checkout-api",
+ Namespace: "services",
+ CreatedAt: now,
+ DesiredReplicas: 4,
+ UpdatedReplicas: 3,
+ ReadyReplicas: 2,
+ AvailableReplicas: 2,
+ ObservedGeneration: 12,
+ Labels: map[string]string{"app": "checkout"},
+ }},
StatefulSets: []agentsk8s.StatefulSet{{UID: "sts-1", Name: "db", Namespace: "services", DesiredReplicas: 3, ReadyReplicas: 2, ServiceName: "db-headless"}},
DaemonSets: []agentsk8s.DaemonSet{{UID: "ds-1", Name: "node-agent", Namespace: "kube-system", DesiredNumberScheduled: 3, NumberReady: 3}},
Jobs: []agentsk8s.Job{{UID: "job-1", Name: "backup", Namespace: "services", DesiredCompletions: 1, Succeeded: 1}},
@@ -157,6 +169,9 @@ func TestApplyKubernetesReportPreservesNativeAPIInventory(t *testing.T) {
if len(cluster.ReplicaSets) != 1 || cluster.ReplicaSets[0].OwnerName != "checkout" || cluster.ReplicaSets[0].FullyLabeledReplicas != 3 {
t.Fatalf("expected replicaset inventory, got %+v", cluster.ReplicaSets)
}
+ if len(cluster.Deployments) != 1 || cluster.Deployments[0].CreatedAt.IsZero() || cluster.Deployments[0].ObservedGeneration != 12 {
+ t.Fatalf("expected deployment API metadata inventory, got %+v", cluster.Deployments)
+ }
if len(cluster.StatefulSets) != 1 || cluster.StatefulSets[0].ReadyReplicas != 2 {
t.Fatalf("expected statefulset inventory, got %+v", cluster.StatefulSets)
}
diff --git a/internal/unifiedresources/adapter_coverage_test.go b/internal/unifiedresources/adapter_coverage_test.go
index dd3d1cdda0..9588b9ab57 100644
--- a/internal/unifiedresources/adapter_coverage_test.go
+++ b/internal/unifiedresources/adapter_coverage_test.go
@@ -397,6 +397,39 @@ func TestDockerNativeInventoryAdapters(t *testing.T) {
t.Fatalf("unexpected network resource: %+v", networkResource)
}
+ completedAt := now.Add(5 * time.Minute)
+ serviceResource, _ := resourceFromDockerService(models.DockerService{
+ ID: "service-1",
+ Name: "checkout-api",
+ Image: "registry.example.com/checkout-api:2026.05",
+ Mode: "replicated",
+ DesiredTasks: 4,
+ RunningTasks: 2,
+ UpdateStatus: &models.DockerServiceUpdate{
+ State: "rollback_started",
+ Message: "Service replicas below desired",
+ CompletedAt: &completedAt,
+ },
+ EndpointPorts: []models.DockerServicePort{{
+ Protocol: "tcp",
+ TargetPort: 8080,
+ PublishedPort: 18080,
+ PublishMode: "ingress",
+ }},
+ }, host)
+ if serviceResource.Type != ResourceTypeDockerService || serviceResource.Docker == nil || serviceResource.Docker.ServiceUpdate == nil {
+ t.Fatalf("unexpected service resource: %+v", serviceResource)
+ }
+ if serviceResource.Docker.ServiceUpdate.State != "rollback_started" || serviceResource.Docker.ServiceUpdate.Message != "Service replicas below desired" {
+ t.Fatalf("service update status not preserved: %+v", serviceResource.Docker.ServiceUpdate)
+ }
+ if serviceResource.Docker.ServiceUpdate.CompletedAt == nil || !serviceResource.Docker.ServiceUpdate.CompletedAt.Equal(completedAt) {
+ t.Fatalf("service update completion time = %+v, want %s", serviceResource.Docker.ServiceUpdate.CompletedAt, completedAt)
+ }
+ if len(serviceResource.Docker.EndpointPorts) != 1 || serviceResource.Docker.EndpointPorts[0].PublishedPort != 18080 {
+ t.Fatalf("service endpoint ports not preserved: %+v", serviceResource.Docker.EndpointPorts)
+ }
+
taskResource, taskIdentity := resourceFromDockerTask(models.DockerTask{
ID: "task-1", ServiceName: "api", ServiceID: "svc-1", Slot: 2, DesiredState: "running", CurrentState: "running", NodeName: "edge",
}, host)
diff --git a/internal/unifiedresources/adapters.go b/internal/unifiedresources/adapters.go
index acdfc2d1ee..20e38743c4 100644
--- a/internal/unifiedresources/adapters.go
+++ b/internal/unifiedresources/adapters.go
@@ -2470,6 +2470,8 @@ func resourceFromKubernetesPod(cluster models.KubernetesCluster, pod models.Kube
Kubernetes: &K8sData{
ClusterID: cluster.ID,
ClusterName: clusterName,
+ ResourceUID: pod.UID,
+ ResourceKind: "Pod",
AgentID: cluster.AgentID,
Context: cluster.Context,
Server: cluster.Server,
@@ -2499,6 +2501,7 @@ func resourceFromKubernetesPod(cluster models.KubernetesCluster, pod models.Kube
OwnerName: pod.OwnerName,
Image: primaryImage,
Labels: labels,
+ CreatedAt: zeroTimeToPtr(pod.CreatedAt),
MetricCapabilities: cloneKubernetesMetricCapabilities(capabilities),
},
Tags: labelsToTags(labels),
@@ -2526,6 +2529,8 @@ func resourceFromKubernetesDeployment(cluster models.KubernetesCluster, deployme
Kubernetes: &K8sData{
ClusterID: cluster.ID,
ClusterName: clusterName,
+ ResourceUID: deployment.UID,
+ ResourceKind: "Deployment",
AgentID: cluster.AgentID,
Context: cluster.Context,
Server: cluster.Server,
@@ -2536,7 +2541,9 @@ func resourceFromKubernetesDeployment(cluster models.KubernetesCluster, deployme
UpdatedReplicas: deployment.UpdatedReplicas,
ReadyReplicas: deployment.ReadyReplicas,
AvailableReplicas: deployment.AvailableReplicas,
+ ObservedGeneration: deployment.ObservedGeneration,
Labels: labels,
+ CreatedAt: zeroTimeToPtr(deployment.CreatedAt),
MetricCapabilities: cloneKubernetesMetricCapabilities(capabilities),
},
Tags: labelsToTags(labels),
diff --git a/internal/unifiedresources/adapters_test.go b/internal/unifiedresources/adapters_test.go
index 7de82f2cc8..c5f021693b 100644
--- a/internal/unifiedresources/adapters_test.go
+++ b/internal/unifiedresources/adapters_test.go
@@ -671,16 +671,30 @@ func TestResourceFromKubernetesDeployment_PopulatesMetricsUnderMockMode(t *testi
Name: "production",
}
deployment := models.KubernetesDeployment{
- UID: "dep-uid-1",
- Name: "checkout-api",
- Namespace: "services",
- DesiredReplicas: 3,
- UpdatedReplicas: 3,
- ReadyReplicas: 2,
- AvailableReplicas: 2,
+ UID: "dep-uid-1",
+ Name: "checkout-api",
+ Namespace: "services",
+ CreatedAt: time.Date(2026, 5, 24, 15, 0, 0, 0, time.UTC),
+ DesiredReplicas: 3,
+ UpdatedReplicas: 3,
+ ReadyReplicas: 2,
+ AvailableReplicas: 2,
+ ObservedGeneration: 12,
}
resource, _ := resourceFromKubernetesDeployment(cluster, deployment, nil)
+ if resource.Kubernetes == nil {
+ t.Fatal("expected kubernetes payload")
+ }
+ if resource.Kubernetes.ResourceKind != "Deployment" || resource.Kubernetes.ResourceUID != "dep-uid-1" {
+ t.Fatalf("deployment resource identity fields = kind %q uid %q", resource.Kubernetes.ResourceKind, resource.Kubernetes.ResourceUID)
+ }
+ if resource.Kubernetes.ObservedGeneration != 12 {
+ t.Fatalf("observedGeneration = %d, want 12", resource.Kubernetes.ObservedGeneration)
+ }
+ if resource.Kubernetes.CreatedAt == nil || !resource.Kubernetes.CreatedAt.Equal(deployment.CreatedAt) {
+ t.Fatalf("createdAt = %+v, want %s", resource.Kubernetes.CreatedAt, deployment.CreatedAt)
+ }
if resource.Metrics == nil {
t.Fatal("expected mock-mode deployment to carry synthetic Metrics, got nil")
}
diff --git a/pkg/agents/kubernetes/report.go b/pkg/agents/kubernetes/report.go
index a21cc36a23..41a3229efb 100644
--- a/pkg/agents/kubernetes/report.go
+++ b/pkg/agents/kubernetes/report.go
@@ -125,14 +125,16 @@ type PodContainer struct {
// Deployment represents a Kubernetes deployment at report time.
type Deployment struct {
- UID string `json:"uid"`
- Name string `json:"name"`
- Namespace string `json:"namespace"`
- DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
- UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
- ReadyReplicas int32 `json:"readyReplicas,omitempty"`
- AvailableReplicas int32 `json:"availableReplicas,omitempty"`
- Labels map[string]string `json:"labels,omitempty"`
+ UID string `json:"uid"`
+ Name string `json:"name"`
+ Namespace string `json:"namespace"`
+ CreatedAt time.Time `json:"createdAt,omitempty"`
+ DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
+ UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
+ ReadyReplicas int32 `json:"readyReplicas,omitempty"`
+ AvailableReplicas int32 `json:"availableReplicas,omitempty"`
+ ObservedGeneration int64 `json:"observedGeneration,omitempty"`
+ Labels map[string]string `json:"labels,omitempty"`
}
// ReplicaSet represents a Kubernetes replica set at report time.