@skyhook-io/radar-app 1.20.3 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -9
- package/src/App.tsx +67 -15
- package/src/api/client.audit-gating.test.tsx +105 -5
- package/src/api/client.auditBadgesSync.test.tsx +118 -0
- package/src/api/client.capabilitiesPoll.test.ts +61 -0
- package/src/api/client.ts +129 -5
- package/src/api/namespaceScopeRetry.test.ts +14 -0
- package/src/api/radarFeatures.ts +11 -0
- package/src/api/substrateHealth.ts +134 -0
- package/src/api/velero.test.ts +60 -0
- package/src/api/velero.ts +377 -0
- package/src/api/vulnerabilities.ts +313 -0
- package/src/components/NamespaceSwitcher.tsx +3 -1
- package/src/components/audit/AuditView.tsx +4 -0
- package/src/components/audit/ChecksViewTabs.test.tsx +35 -5
- package/src/components/audit/ChecksViewTabs.tsx +12 -1
- package/src/components/audit/Java4ShellPanel.test.tsx +31 -0
- package/src/components/audit/Java4ShellPanel.tsx +313 -0
- package/src/components/audit/UpgradeReadinessView.test.ts +35 -1
- package/src/components/audit/UpgradeReadinessView.tsx +60 -2
- package/src/components/audit/VulnerabilitiesView.tsx +944 -0
- package/src/components/cnpg/CNPGClusterTabs.tsx +3 -1
- package/src/components/cnpg/CNPGDrawerTrail.tsx +5 -26
- package/src/components/cnpg/CNPGInvestigationAction.test.tsx +27 -6
- package/src/components/cnpg/CNPGView.tsx +43 -117
- package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +30 -0
- package/src/components/cnpg/host.tsx +2 -2
- package/src/components/cnpg/routes.ts +3 -1
- package/src/components/cnpg/shared.tsx +5 -53
- package/src/components/cnpg/useCNPGNavigate.ts +1 -21
- package/src/components/cnpg/useCNPGSidebarWorkspace.ts +16 -13
- package/src/components/community.tsx +42 -0
- package/src/components/diagnose/diagnoseEvidenceTypes.ts +2 -0
- package/src/components/diagnose/investigationMetrics.test.ts +20 -0
- package/src/components/diagnose/investigationMetrics.ts +2 -1
- package/src/components/dock/BottomDock.tsx +1 -0
- package/src/components/dock/LogsTab.tsx +3 -0
- package/src/components/gitops/FluxOperatorCard.test.tsx +37 -0
- package/src/components/gitops/FluxOperatorCard.tsx +27 -0
- package/src/components/gitops/GitOpsView.rowsSummary.test.tsx +59 -0
- package/src/components/gitops/GitOpsView.tsx +8 -5
- package/src/components/gitops/gitopsRowEvents.test.ts +48 -0
- package/src/components/gitops/gitopsRowEvents.ts +31 -0
- package/src/components/helm/HelmDrawerFrame.tsx +1 -1
- package/src/components/helm/HelmView.tsx +20 -16
- package/src/components/helm/OwnedResources.tsx +4 -3
- package/src/components/home/ClusterHealthCard.tsx +3 -1
- package/src/components/home/HomeAgentBlock.tsx +3 -0
- package/src/components/home/HomeView.tsx +7 -0
- package/src/components/home/MCPSetupDialog.test.tsx +19 -12
- package/src/components/home/MCPSetupDialog.tsx +4 -2
- package/src/components/home/mcpToolCatalog.ts +15 -2
- package/src/components/home/useVulnerabilitiesRow.test.ts +26 -0
- package/src/components/home/useVulnerabilitiesRow.ts +50 -0
- package/src/components/logs/LogsViewer.tsx +3 -1
- package/src/components/logs/MultiPodLogsTab.test.tsx +24 -4
- package/src/components/logs/MultiPodLogsTab.tsx +9 -5
- package/src/components/nav/PrimaryNavRail.test.tsx +17 -0
- package/src/components/nav/PrimaryNavRail.tsx +174 -29
- package/src/components/resource/PrometheusChartsGrid.tsx +5 -1
- package/src/components/resource/SubstrateHealthCharts.test.tsx +143 -0
- package/src/components/resource/SubstrateHealthCharts.tsx +254 -0
- package/src/components/resource/SubstrateVerdictLine.test.tsx +131 -0
- package/src/components/resource/SubstrateVerdictLine.tsx +180 -0
- package/src/components/resources/ResourcesView.tsx +12 -6
- package/src/components/resources/renderers/UpgradePlanRenderer.test.tsx +20 -0
- package/src/components/resources/renderers/UpgradePlanRenderer.tsx +22 -0
- package/src/components/resources/renderers/VeleroBackupRenderer.tsx +16 -36
- package/src/components/resources/renderers/VeleroRestoreRenderer.tsx +6 -19
- package/src/components/resources/renderers/WorkloadRenderer.tsx +8 -0
- package/src/components/rightsizing/RightsizingScanView.tsx +3 -2
- package/src/components/shared/LargeClusterNamespacePicker.test.tsx +27 -0
- package/src/components/shared/LargeClusterNamespacePicker.tsx +8 -2
- package/src/components/timeline/TimelineView.tsx +3 -1
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +94 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +21 -5
- package/src/components/traffic/TrafficData.test.tsx +37 -0
- package/src/components/traffic/TrafficData.tsx +27 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -7
- package/src/components/traffic/TrafficGraph.layoutEngine.test.tsx +193 -0
- package/src/components/traffic/TrafficGraph.test.tsx +269 -0
- package/src/components/traffic/TrafficGraph.tsx +135 -64
- package/src/components/traffic/TrafficGraphUnavailable.tsx +57 -0
- package/src/components/traffic/TrafficView.layoutUnavailable.test.tsx +211 -0
- package/src/components/traffic/TrafficView.tsx +46 -129
- package/src/components/traffic/trafficFilters.test.ts +172 -1
- package/src/components/traffic/trafficFilters.ts +139 -0
- package/src/components/ui/DiagnosticsOverlay.tsx +14 -1
- package/src/components/ui/UpdateNotification.manual.test.tsx +5 -2
- package/src/components/ui/UpdateNotification.test.tsx +31 -2
- package/src/components/ui/UpdateNotification.tsx +34 -17
- package/src/components/ui/command-items.ts +24 -1
- package/src/components/velero/VeleroBackupNow.test.tsx +165 -0
- package/src/components/velero/VeleroBackupNow.tsx +143 -0
- package/src/components/velero/VeleroDeleteBackup.test.tsx +364 -0
- package/src/components/velero/VeleroDeleteBackup.tsx +306 -0
- package/src/components/velero/VeleroDetailPage.tsx +158 -0
- package/src/components/velero/VeleroKindLists.test.tsx +48 -0
- package/src/components/velero/VeleroKindLists.tsx +43 -0
- package/src/components/velero/VeleroLocations.expand.test.tsx +27 -0
- package/src/components/velero/VeleroLocations.test.tsx +86 -0
- package/src/components/velero/VeleroLocations.tsx +240 -0
- package/src/components/velero/VeleroOverview.test.tsx +311 -0
- package/src/components/velero/VeleroOverview.tsx +485 -0
- package/src/components/velero/VeleroPages.test.tsx +516 -0
- package/src/components/velero/VeleroPages.tsx +1056 -0
- package/src/components/velero/VeleroRunArtifacts.test.tsx +241 -0
- package/src/components/velero/VeleroRunArtifacts.tsx +112 -0
- package/src/components/velero/VeleroRunLists.tsx +309 -0
- package/src/components/velero/VeleroRunMessagesHost.test.tsx +25 -0
- package/src/components/velero/VeleroRunMessagesHost.tsx +54 -0
- package/src/components/velero/VeleroRunVolumes.test.tsx +247 -0
- package/src/components/velero/VeleroRunVolumes.tsx +122 -0
- package/src/components/velero/VeleroSchedulePause.test.tsx +211 -0
- package/src/components/velero/VeleroSchedulePause.tsx +191 -0
- package/src/components/velero/VeleroScheduleStatusBadge.test.tsx +28 -0
- package/src/components/velero/VeleroScheduleStatusBadge.tsx +21 -0
- package/src/components/velero/VeleroSchedules.tsx +255 -0
- package/src/components/velero/VeleroView.tsx +59 -0
- package/src/components/velero/VeleroWorkspace.gate.test.tsx +97 -0
- package/src/components/velero/attention.test.ts +178 -0
- package/src/components/velero/attention.ts +281 -0
- package/src/components/velero/backupDelete.test.tsx +91 -0
- package/src/components/velero/backupDelete.tsx +182 -0
- package/src/components/velero/coverage.test.ts +87 -0
- package/src/components/velero/coverage.ts +150 -0
- package/src/components/velero/host.tsx +92 -0
- package/src/components/velero/routes.ts +78 -0
- package/src/components/velero/runs.tsx +121 -0
- package/src/components/velero/shared.test.ts +84 -0
- package/src/components/velero/shared.tsx +423 -0
- package/src/components/velero/useVeleroSidebarWorkspace.test.tsx +28 -0
- package/src/components/velero/useVeleroSidebarWorkspace.ts +71 -0
- package/src/components/velero/velero.fixtures.ts +61 -0
- package/src/components/velero/workspaceRoute.ts +21 -0
- package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.tsx +179 -0
- package/src/components/vulnerabilities/parts.test.ts +72 -0
- package/src/components/vulnerabilities/parts.tsx +291 -0
- package/src/components/whats-new/WhatsNewDialog.test.tsx +6 -4
- package/src/components/whats-new/releaseNotes.ts +67 -1
- package/src/components/workload/WorkloadView.tsx +64 -27
- package/src/components/workspace/DrawerTrailBack.tsx +32 -0
- package/src/components/workspace/WorkspaceFrame.tsx +71 -0
- package/src/components/workspace/coverage.ts +61 -0
- package/src/components/workspace/layout.test.tsx +29 -1
- package/src/components/workspace/layout.tsx +15 -5
- package/src/components/workspace/sidebar.ts +9 -0
- package/src/components/workspace/useWorkspaceDrawer.ts +63 -0
- package/src/components/workspace/useWorkspaceNavigate.ts +21 -0
- package/src/desktop/AboutDialog.test.ts +12 -0
- package/src/desktop/AboutDialog.tsx +151 -0
- package/src/desktop/WindowsTitleBar.tsx +359 -0
- package/src/desktop/titleBar.test.ts +61 -0
- package/src/desktop/titleBar.ts +45 -0
- package/src/index.css +19 -0
- package/src/integrations/resourceHost.ts +5 -1
- package/src/integrations/resourceHosts.test.tsx +14 -2
- package/src/integrations/resourceHosts.tsx +22 -6
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.test.ts +11 -0
- package/src/integrations/workspaceRoutes.ts +3 -1
- package/src/integrations/workspaceScreens.tsx +2 -0
- package/src/main.tsx +8 -0
- package/src/utils/desktop-zoom.test.ts +53 -0
- package/src/utils/desktop-zoom.ts +30 -0
- package/src/utils/staleAssetPrompt.test.tsx +76 -0
- package/src/utils/staleAssetPrompt.tsx +32 -0
|
@@ -20,7 +20,7 @@ describe('MCP setup in read-only mode', () => {
|
|
|
20
20
|
setBasename('/radar')
|
|
21
21
|
try {
|
|
22
22
|
const url = mcpEndpointUrl(true)
|
|
23
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools readOnly applicationEvidenceAvailable mcpUrl={url} onClose={() => {}} />)
|
|
23
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools readOnly applicationEvidenceAvailable mcpUrl={url} onClose={() => {}} />)
|
|
24
24
|
expect(html).toContain(`claude mcp add --transport http radar ${url}`)
|
|
25
25
|
expect(html).toContain(`codex mcp add radar --url ${url}`)
|
|
26
26
|
expect(html).toContain('/radar/mcp-readonly')
|
|
@@ -37,7 +37,7 @@ describe('MCP setup in read-only mode', () => {
|
|
|
37
37
|
})
|
|
38
38
|
|
|
39
39
|
it('explains disabled exec without including it in the available tool count', () => {
|
|
40
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools execTools={false} mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
40
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools execTools={false} mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
41
41
|
expect(html).toContain('apply_resource')
|
|
42
42
|
expect(html).toContain('in_cluster')
|
|
43
43
|
expect(html).toContain('exec_pod')
|
|
@@ -47,14 +47,21 @@ describe('MCP setup in read-only mode', () => {
|
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
it('does not suggest an unsupported flag when the capability is absent', () => {
|
|
50
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
50
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
51
51
|
expect(html).not.toContain('exec_pod')
|
|
52
52
|
expect(html).not.toContain('curl_service')
|
|
53
53
|
expect(html).not.toContain('--mcp-exec-tools')
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
+
it('lists list_vulnerabilities only where Trivy reports are served', () => {
|
|
57
|
+
const without = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
58
|
+
expect(without).not.toContain('list_vulnerabilities')
|
|
59
|
+
const withReports = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
60
|
+
expect(withReports).toContain('list_vulnerabilities')
|
|
61
|
+
})
|
|
62
|
+
|
|
56
63
|
it('shows exec without enabling HTTP', () => {
|
|
57
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools execTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
64
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools execTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
58
65
|
expect(html).toContain('exec_pod')
|
|
59
66
|
expect(html).not.toContain('curl_service')
|
|
60
67
|
expect(html).toContain(`${MCP_TOOL_CATALOG.length - 2} tools`)
|
|
@@ -62,21 +69,21 @@ describe('MCP setup in read-only mode', () => {
|
|
|
62
69
|
})
|
|
63
70
|
|
|
64
71
|
it('hides exec in read-only mode even if exec is requested', () => {
|
|
65
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools readOnly execTools mcpUrl={mcpEndpointUrl(true)} onClose={() => {}} />)
|
|
72
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools readOnly execTools mcpUrl={mcpEndpointUrl(true)} onClose={() => {}} />)
|
|
66
73
|
expect(html).not.toContain('exec_pod')
|
|
67
74
|
expect(html).not.toContain('curl_service')
|
|
68
75
|
expect(html).toContain(`${MCP_TOOL_CATALOG.filter((tool) => !tool.write && !tool.localOnly).length} tools`)
|
|
69
76
|
})
|
|
70
77
|
|
|
71
78
|
it('keeps the full catalog in default mode', () => {
|
|
72
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools applicationEvidenceAvailable mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
79
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools applicationEvidenceAvailable mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
73
80
|
expect(html).toContain('apply_resource')
|
|
74
81
|
expect(html).toContain('in_cluster')
|
|
75
82
|
expect(html).toContain('collect_application_evidence')
|
|
76
83
|
})
|
|
77
84
|
|
|
78
85
|
it('hides local-only tools unless the server advertises availability', () => {
|
|
79
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
86
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
80
87
|
expect(html).toContain('apply_resource')
|
|
81
88
|
expect(html).not.toContain('collect_application_evidence')
|
|
82
89
|
})
|
|
@@ -85,7 +92,7 @@ describe('MCP setup in read-only mode', () => {
|
|
|
85
92
|
describe('MCP setup prompt tip', () => {
|
|
86
93
|
it('tips to name Radar under the client setups, as plain text, without the in-Radar link when no handler is given', () => {
|
|
87
94
|
const host = document.createElement('div')
|
|
88
|
-
host.innerHTML = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
95
|
+
host.innerHTML = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
89
96
|
const tip = [...host.querySelectorAll('p')].find((p) => p.textContent?.startsWith('Tip:'))
|
|
90
97
|
expect(tip?.textContent).toBe(
|
|
91
98
|
"Tip: name Radar in your prompt so your agent uses Radar instead of kubectl, e.g. Use Radar to find what's broken in my cluster and why.",
|
|
@@ -135,7 +142,7 @@ describe('MCP setup prompt tip', () => {
|
|
|
135
142
|
document.body.appendChild(host)
|
|
136
143
|
const root = createRoot(host)
|
|
137
144
|
try {
|
|
138
|
-
act(() => root.render(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />))
|
|
145
|
+
act(() => root.render(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />))
|
|
139
146
|
const endpoint = [...host.querySelectorAll('code')].find((c) => c.textContent === mcpEndpointUrl())!
|
|
140
147
|
const copy = endpoint.closest('.relative')!.querySelector('button')!
|
|
141
148
|
await act(async () => copy.click())
|
|
@@ -149,11 +156,11 @@ describe('MCP setup prompt tip', () => {
|
|
|
149
156
|
})
|
|
150
157
|
|
|
151
158
|
it('shows HTTP independently of exec', () => {
|
|
152
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools httpTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
159
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools httpTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
153
160
|
expect(html).toContain('curl_service')
|
|
154
161
|
expect(html).not.toContain('exec_pod')
|
|
155
162
|
expect(html).toContain(`${MCP_TOOL_CATALOG.length - 2} tools`)
|
|
156
|
-
const readOnly = renderToStaticMarkup(<MCPSetupDialog open helmTools readOnly httpTools mcpUrl={mcpEndpointUrl(true)} onClose={() => {}} />)
|
|
163
|
+
const readOnly = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools readOnly httpTools mcpUrl={mcpEndpointUrl(true)} onClose={() => {}} />)
|
|
157
164
|
expect(readOnly).not.toContain('curl_service')
|
|
158
165
|
})
|
|
159
166
|
|
|
@@ -166,6 +173,6 @@ it('hides disabled Helm writes while retaining release reads and other writes',
|
|
|
166
173
|
})
|
|
167
174
|
|
|
168
175
|
it('shows registered Helm tools independently of target namespace permissions', () => {
|
|
169
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
176
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
170
177
|
expect(html).toContain('manage_helm')
|
|
171
178
|
})
|
|
@@ -16,6 +16,8 @@ interface MCPSetupDialogProps {
|
|
|
16
16
|
httpTools?: boolean
|
|
17
17
|
/** Whether the native Helm MCP tool is registered; target Kubernetes permissions still required. */
|
|
18
18
|
helmTools?: boolean
|
|
19
|
+
/** Whether the cluster serves Trivy's reports, the only place list_vulnerabilities is listed. */
|
|
20
|
+
vulnerabilityTools?: boolean
|
|
19
21
|
applicationEvidenceAvailable?: boolean
|
|
20
22
|
mcpUrl: string
|
|
21
23
|
/** Opens Radar's own investigation composer. Omit where investigations can't run. */
|
|
@@ -59,7 +61,7 @@ function CodeBlock({ children }: { children: string }) {
|
|
|
59
61
|
)
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false, execTools, httpTools, helmTools, onInvestigate, applicationEvidenceAvailable = false }: MCPSetupDialogProps) {
|
|
64
|
+
export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false, execTools, httpTools, helmTools, vulnerabilityTools = false, onInvestigate, applicationEvidenceAvailable = false }: MCPSetupDialogProps) {
|
|
63
65
|
const dialogRef = useRef<HTMLDivElement>(null)
|
|
64
66
|
const [isDesktop, setIsDesktop] = useState(false)
|
|
65
67
|
const [portPinned, setPortPinned] = useState(false)
|
|
@@ -133,7 +135,7 @@ export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false, execTo
|
|
|
133
135
|
const currentPort = Number(window.location.port) || 80
|
|
134
136
|
|
|
135
137
|
const tools = MCP_TOOL_CATALOG
|
|
136
|
-
.filter((tool) => (!readOnly || !tool.write) && (tool.name !== 'exec_pod' || execTools) && (tool.name !== 'curl_service' || httpTools) && (tool.name !== 'manage_helm' || helmTools) && (!tool.localOnly || (!readOnly && applicationEvidenceAvailable)))
|
|
138
|
+
.filter((tool) => (!readOnly || !tool.write) && (tool.name !== 'exec_pod' || execTools) && (tool.name !== 'curl_service' || httpTools) && (tool.name !== 'manage_helm' || helmTools) && (tool.name !== 'list_vulnerabilities' || vulnerabilityTools) && (!tool.localOnly || (!readOnly && applicationEvidenceAvailable)))
|
|
137
139
|
.map((tool) => readOnly && tool.name === 'diagnose'
|
|
138
140
|
? { ...tool, params: tool.params.filter((param) => param.arg !== 'in_cluster') }
|
|
139
141
|
: tool)
|
|
@@ -38,7 +38,7 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
38
38
|
{ arg: 'kind', desc: 'pods (default), workloads, or nodes' },
|
|
39
39
|
{ arg: 'namespace', desc: 'filter pods/workloads to a namespace' },
|
|
40
40
|
{ arg: 'sort', desc: 'cpu (default) or memory' },
|
|
41
|
-
{ arg: 'limit', desc: 'max rows (default
|
|
41
|
+
{ arg: 'limit', desc: 'max rows (default 10, max 100)' },
|
|
42
42
|
],
|
|
43
43
|
},
|
|
44
44
|
{
|
|
@@ -161,6 +161,19 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
161
161
|
{ arg: 'refresh', desc: 'bypass the cached scan after changing something' },
|
|
162
162
|
],
|
|
163
163
|
},
|
|
164
|
+
{
|
|
165
|
+
name: 'list_vulnerabilities',
|
|
166
|
+
desc: 'Which running images carry known CVEs and which workloads run them, from Trivy Operator reports: by image, by CVE, by package upgrade (fix), or by workload. Running images without a report are listed as unscanned, not clean. Listed only where Trivy Operator runs.',
|
|
167
|
+
params: [
|
|
168
|
+
{ arg: 'view', desc: 'image (default), cve, fix, workload, or summary' },
|
|
169
|
+
{ arg: 'namespace', desc: 'limit to one namespace' },
|
|
170
|
+
{ arg: 'severity', desc: 'comma-separated: critical, high, medium, low, unknown' },
|
|
171
|
+
{ arg: 'fixable', desc: 'only findings with a fixed version' },
|
|
172
|
+
{ arg: 'query', desc: 'image, CVE ID, package, or workload substring' },
|
|
173
|
+
{ arg: 'workload', desc: 'one workload as Kind/namespace/name' },
|
|
174
|
+
{ arg: 'limit', desc: 'max rows (default 10, max 100)' },
|
|
175
|
+
],
|
|
176
|
+
},
|
|
164
177
|
{
|
|
165
178
|
name: 'get_runtime_versions',
|
|
166
179
|
desc: 'Which running workloads use which runtime version (PHP, Node, Python, Go, Java, …), read from the version each running image declares in its config, for runtime CVEs. Declared, not proof; misses runtimes installed from distro packages.',
|
|
@@ -286,7 +299,7 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
286
299
|
{ arg: 'name', desc: 'workloads: exact workload name (needs kind); nodes: exact node name' },
|
|
287
300
|
{ arg: 'range', desc: 'trend only: 6h, 24h (default), or 7d' },
|
|
288
301
|
{ arg: 'include_points', desc: 'trend only: include raw points (default false); summaries are always returned' },
|
|
289
|
-
{ arg: 'limit', desc: 'max rows (default
|
|
302
|
+
{ arg: 'limit', desc: 'max rows (default 10, max 100)' },
|
|
290
303
|
],
|
|
291
304
|
},
|
|
292
305
|
{
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { ApiError } from '../../api/client'
|
|
3
|
+
import { rowOnError } from './useVulnerabilitiesRow'
|
|
4
|
+
|
|
5
|
+
describe('rowOnError', () => {
|
|
6
|
+
const api = (status: number, code?: string) => new ApiError('x', status, code ? { error: 'x', error_code: code } : { error: 'x' })
|
|
7
|
+
|
|
8
|
+
it('keeps the last answer while Radar settles', () => {
|
|
9
|
+
expect(rowOnError(api(409, 'connection_changed'))).toBe('keep')
|
|
10
|
+
expect(rowOnError(api(503, 'kind_sync_pending'))).toBe('keep')
|
|
11
|
+
expect(rowOnError(api(503, 'cluster_connecting'))).toBe('keep')
|
|
12
|
+
expect(rowOnError(api(503))).toBe('keep')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it("says the read failed when Radar's own identity can't read the reports", () => {
|
|
16
|
+
expect(rowOnError(api(503, 'radar_forbidden'))).toBe('failed')
|
|
17
|
+
expect(rowOnError(api(503, 'list_too_large'))).toBe('failed')
|
|
18
|
+
expect(rowOnError(api(500))).toBe('failed')
|
|
19
|
+
expect(rowOnError(new Error('network'))).toBe('failed')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('hides the row when it has nothing to say', () => {
|
|
23
|
+
expect(rowOnError(api(404, 'kind_unknown'))).toBe('hide')
|
|
24
|
+
expect(rowOnError(api(403, 'user_forbidden'))).toBe('hide')
|
|
25
|
+
})
|
|
26
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useNavigate } from 'react-router-dom'
|
|
2
|
+
import type { AuditCardVulnerabilities } from '@skyhook-io/k8s-ui'
|
|
3
|
+
import { useAPIResources } from '../../api/apiResources'
|
|
4
|
+
import { ApiError, useRadarFeature } from '../../api/client'
|
|
5
|
+
import { isRadarFeatureUnsupported } from '../../api/radarFeatures'
|
|
6
|
+
import { hasVulnerabilityReports, isKindUnknown, readSettles, useVulnerabilities } from '../../api/vulnerabilities'
|
|
7
|
+
import { findingsCertainty } from '../vulnerabilities/parts'
|
|
8
|
+
|
|
9
|
+
// The Vulnerabilities row of the Home Checks card: present only where a
|
|
10
|
+
// scanner writes VulnerabilityReports and this Radar serves the rollup.
|
|
11
|
+
export function useVulnerabilitiesRow(namespaces: string[]): AuditCardVulnerabilities | undefined {
|
|
12
|
+
const navigate = useNavigate()
|
|
13
|
+
const { data: resources } = useAPIResources()
|
|
14
|
+
const { support } = useRadarFeature('vulnerabilities')
|
|
15
|
+
const available = hasVulnerabilityReports(resources) && support !== 'unsupported'
|
|
16
|
+
// Only the totals: the rows would be the whole tab's payload, every minute.
|
|
17
|
+
const { data, error } = useVulnerabilities({ view: 'summary', namespaces }, available)
|
|
18
|
+
if (!available) return undefined
|
|
19
|
+
const onNavigate = () => {
|
|
20
|
+
const params = new URLSearchParams()
|
|
21
|
+
if (namespaces.length > 0) params.set('namespaces', namespaces.join(','))
|
|
22
|
+
navigate({ pathname: '/checks/vulnerabilities', search: params.toString() })
|
|
23
|
+
}
|
|
24
|
+
// The query keeps its last answer through a failed poll; a failure that
|
|
25
|
+
// persists decides the row over it.
|
|
26
|
+
const failure = error ? rowOnError(error) : 'keep'
|
|
27
|
+
if (failure === 'failed') return { imagesWithCritical: 0, fixableCriticalHigh: 0, certainty: 'unknown', readFailed: true, onNavigate }
|
|
28
|
+
if (failure === 'hide') return undefined
|
|
29
|
+
if (!data) return undefined
|
|
30
|
+
const s = data.summary
|
|
31
|
+
if (s.imagesScanned === 0 && s.imagesUnscanned === 0) return undefined
|
|
32
|
+
return {
|
|
33
|
+
imagesWithCritical: s.imagesWithCritical,
|
|
34
|
+
fixableCriticalHigh: s.fixableCriticalHighCves,
|
|
35
|
+
certainty: findingsCertainty(data),
|
|
36
|
+
onNavigate,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// What a failed read does to the row: keep the last answer through one that
|
|
41
|
+
// settles by itself (Radar still loading, its connection just changed), hide
|
|
42
|
+
// the row when it has nothing to say (an older Radar, Trivy removed, no
|
|
43
|
+
// access to the reports), and otherwise say the read failed. A 503 naming
|
|
44
|
+
// something to fix, such as Radar's own identity denied the reports, doesn't
|
|
45
|
+
// settle by itself.
|
|
46
|
+
export function rowOnError(error: unknown): 'keep' | 'hide' | 'failed' {
|
|
47
|
+
if (isRadarFeatureUnsupported(error) || isKindUnknown(error)) return 'hide'
|
|
48
|
+
if (readSettles(error)) return 'keep'
|
|
49
|
+
return error instanceof ApiError && error.status === 403 ? 'hide' : 'failed'
|
|
50
|
+
}
|
|
@@ -10,11 +10,12 @@ interface LogsViewerProps {
|
|
|
10
10
|
podName: string
|
|
11
11
|
containers: string[]
|
|
12
12
|
initialContainer?: string
|
|
13
|
+
initContainers?: string[]
|
|
13
14
|
/** Start streaming on mount. Default true — callers pass false for terminal (completed/failed) pods. */
|
|
14
15
|
autoStream?: boolean
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export function LogsViewer({ namespace, podName, containers, initialContainer, autoStream = true }: LogsViewerProps) {
|
|
18
|
+
export function LogsViewer({ namespace, podName, containers, initialContainer, initContainers, autoStream = true }: LogsViewerProps) {
|
|
18
19
|
const desktopDownload = useDesktopDownload()
|
|
19
20
|
const { theme } = useTheme()
|
|
20
21
|
|
|
@@ -40,6 +41,7 @@ export function LogsViewer({ namespace, podName, containers, initialContainer, a
|
|
|
40
41
|
podName={podName}
|
|
41
42
|
containers={containers}
|
|
42
43
|
initialContainer={initialContainer}
|
|
44
|
+
initContainers={initContainers}
|
|
43
45
|
fetchLogs={fetchLogs}
|
|
44
46
|
createStream={makeStream}
|
|
45
47
|
overrideDownload={desktopDownload}
|
|
@@ -3,13 +3,13 @@ import { act } from 'react'
|
|
|
3
3
|
import { createRoot } from 'react-dom/client'
|
|
4
4
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
5
5
|
|
|
6
|
-
const state = vi.hoisted(() => ({ logs: {} as Record<string, { data?: unknown; error?: unknown }>, viewer: [] as string[], requested: [] as string[] }))
|
|
6
|
+
const state = vi.hoisted(() => ({ logs: {} as Record<string, { data?: unknown; error?: unknown }>, viewer: [] as string[], requested: [] as string[], resource: undefined as { data?: unknown; isLoading?: boolean } | undefined, viewerProps: [] as Record<string, unknown>[] }))
|
|
7
7
|
vi.mock('../../api/client', async (original) => ({
|
|
8
8
|
...await original<typeof import('../../api/client')>(),
|
|
9
9
|
usePodLogs: (_ns: string, pod: string) => { if (pod) state.requested.push(pod); return state.logs[pod] ?? {} },
|
|
10
|
-
useResource: () =>
|
|
10
|
+
useResource: () => state.resource ?? { data: { status: { phase: 'Running' } } },
|
|
11
11
|
}))
|
|
12
|
-
vi.mock('./LogsViewer', () => ({ LogsViewer: (
|
|
12
|
+
vi.mock('./LogsViewer', () => ({ LogsViewer: (props: { podName: string }) => { state.viewer.push(props.podName); state.viewerProps.push(props); return <div>viewer:{props.podName}</div> } }))
|
|
13
13
|
|
|
14
14
|
const { ApiError } = await import('../../api/client')
|
|
15
15
|
const { MultiPodLogsTab } = await import('./MultiPodLogsTab')
|
|
@@ -18,7 +18,7 @@ const { MultiPodLogsTab } = await import('./MultiPodLogsTab')
|
|
|
18
18
|
const pods = [{ kind: 'Pod', namespace: 'ml', name: 'gone-pod' }, { kind: 'Pod', namespace: 'ml', name: 'live-pod' }]
|
|
19
19
|
let host: HTMLDivElement
|
|
20
20
|
let root: ReturnType<typeof createRoot>
|
|
21
|
-
beforeEach(() => { state.logs = {}; state.viewer = []; state.requested = []; host = document.createElement('div'); root = createRoot(host) })
|
|
21
|
+
beforeEach(() => { state.logs = {}; state.viewer = []; state.requested = []; state.resource = undefined; state.viewerProps = []; host = document.createElement('div'); root = createRoot(host) })
|
|
22
22
|
afterEach(() => act(() => root.unmount()))
|
|
23
23
|
|
|
24
24
|
function render(selected: string, onSelectPod = vi.fn()) {
|
|
@@ -84,6 +84,26 @@ describe('MultiPodLogsTab', () => {
|
|
|
84
84
|
expect(host.textContent).toContain('This RayCluster has no Pods right now.')
|
|
85
85
|
})
|
|
86
86
|
|
|
87
|
+
it('lists init containers in run order and opens the one the Pod is stuck on', () => {
|
|
88
|
+
state.logs['live-pod'] = { data: { containers: ['job', 'fetch-config', 'migrate'] } }
|
|
89
|
+
state.resource = { isLoading: true }
|
|
90
|
+
render('live-pod')
|
|
91
|
+
expect(state.viewer).toEqual([])
|
|
92
|
+
|
|
93
|
+
state.resource = { data: {
|
|
94
|
+
spec: { initContainers: [{ name: 'fetch-config' }, { name: 'migrate' }], containers: [{ name: 'job' }] },
|
|
95
|
+
status: { phase: 'Pending', initContainerStatuses: [
|
|
96
|
+
{ name: 'fetch-config', state: { terminated: { exitCode: 0 } } },
|
|
97
|
+
{ name: 'migrate', state: { waiting: { reason: 'CrashLoopBackOff' } } },
|
|
98
|
+
] },
|
|
99
|
+
} }
|
|
100
|
+
render('live-pod')
|
|
101
|
+
expect(state.viewerProps.at(-1)).toMatchObject({ containers: ['fetch-config', 'migrate', 'job'], initialContainer: 'migrate', initContainers: ['fetch-config', 'migrate'] })
|
|
102
|
+
|
|
103
|
+
act(() => root.render(<MultiPodLogsTab pods={pods} namespace="ml" selectedPod="live-pod" onSelectPod={vi.fn()} initialContainer="job" />))
|
|
104
|
+
expect(state.viewerProps.at(-1)).toMatchObject({ initialContainer: 'job' })
|
|
105
|
+
})
|
|
106
|
+
|
|
87
107
|
it('keeps the viewer for a Pod whose containers loaded even if a later refetch fails', () => {
|
|
88
108
|
state.logs['live-pod'] = { data: { containers: ['app'] }, error: new ApiError('Pod not found', 404) }
|
|
89
109
|
render('live-pod')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect } from 'react'
|
|
2
2
|
import { clsx } from 'clsx'
|
|
3
3
|
import { Terminal } from 'lucide-react'
|
|
4
|
-
import { Tooltip } from '@skyhook-io/k8s-ui'
|
|
4
|
+
import { Tooltip, getDefaultLogContainerName, getInitContainerNames, getLogContainerNames } from '@skyhook-io/k8s-ui'
|
|
5
5
|
import { usePodLogs, useResource } from '../../api/client'
|
|
6
6
|
import type { ResourceRef } from '../../types'
|
|
7
7
|
import { LogsViewer } from './LogsViewer'
|
|
@@ -40,14 +40,17 @@ export function MultiPodLogsTab({
|
|
|
40
40
|
const { data: logsData, error: containersError } = usePodLogs(podNamespace, readable, {
|
|
41
41
|
tailLines: 1,
|
|
42
42
|
})
|
|
43
|
-
const
|
|
43
|
+
const serverContainers = logsData?.containers || []
|
|
44
44
|
|
|
45
45
|
// A terminated pod (common for Job/CronJob children) has nothing to follow —
|
|
46
46
|
// only stream live ones. Wait for the pod to load before deciding so we don't
|
|
47
47
|
// briefly auto-stream a completed pod while its phase is still unknown.
|
|
48
|
-
const { data: selectedPodResource } = useResource<any>('Pod', podNamespace, readable)
|
|
48
|
+
const { data: selectedPodResource, isLoading: podLoading } = useResource<any>('Pod', podNamespace, readable)
|
|
49
49
|
const phase = selectedPodResource?.status?.phase
|
|
50
50
|
const autoStream = !!phase && phase !== 'Succeeded' && phase !== 'Failed'
|
|
51
|
+
// The server lists regular containers before init ones; follow the Pod's run order like the other log views.
|
|
52
|
+
const specContainers = getLogContainerNames(selectedPodResource)
|
|
53
|
+
const containers = serverContainers.length > 0 && specContainers.length > 0 ? specContainers : serverContainers
|
|
51
54
|
|
|
52
55
|
// A selected Pod that left the list (deleted, replaced, or not in a newer
|
|
53
56
|
// list) stays selectable so its loaded lines aren't thrown away, but is
|
|
@@ -103,14 +106,15 @@ export function MultiPodLogsTab({
|
|
|
103
106
|
{selectedPod && !selectedPodNote && containersError && !logsData && (
|
|
104
107
|
<PodLogsUnavailable podName={selectedPod} error={containersError} />
|
|
105
108
|
)}
|
|
106
|
-
{selectedPod && !selectedPodNote && containers.length > 0 && (
|
|
109
|
+
{selectedPod && !selectedPodNote && containers.length > 0 && !podLoading && (
|
|
107
110
|
<div className="flex-1 min-h-0">
|
|
108
111
|
<LogsViewer
|
|
109
112
|
key={selectedPod}
|
|
110
113
|
namespace={podNamespace}
|
|
111
114
|
podName={selectedPod}
|
|
112
115
|
containers={containers}
|
|
113
|
-
initialContainer={initialContainer ||
|
|
116
|
+
initialContainer={initialContainer || getDefaultLogContainerName(selectedPodResource)}
|
|
117
|
+
initContainers={getInitContainerNames(selectedPodResource)}
|
|
114
118
|
autoStream={autoStream}
|
|
115
119
|
/>
|
|
116
120
|
</div>
|
|
@@ -26,4 +26,21 @@ describe("PrimaryNavRail", () => {
|
|
|
26
26
|
expect(read).not.toContain("(unread)");
|
|
27
27
|
expect(renderRail({ unread: true, onOpen: () => {} })).toContain("(unread)");
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
it("links the community as an external link in both rail modes", () => {
|
|
31
|
+
const render = (pinned: boolean) =>
|
|
32
|
+
renderToString(
|
|
33
|
+
<PrimaryNavRail
|
|
34
|
+
activeView="home"
|
|
35
|
+
onNavigate={() => {}}
|
|
36
|
+
pinned={pinned}
|
|
37
|
+
onTogglePinned={() => {}}
|
|
38
|
+
communityUrl="https://radarhq.io/slack"
|
|
39
|
+
/>,
|
|
40
|
+
);
|
|
41
|
+
expect(renderRail()).not.toContain("radarhq.io/slack");
|
|
42
|
+
const pinned = render(true);
|
|
43
|
+
expect(pinned).toMatch(/<a[^>]*href="https:\/\/radarhq.io\/slack"[^>]*target="_blank"/);
|
|
44
|
+
expect(render(false)).toContain('href="https://radarhq.io/slack"');
|
|
45
|
+
});
|
|
29
46
|
});
|