@skyhook-io/radar-app 1.22.1 → 1.23.0
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 +8 -8
- package/src/App.tsx +131 -38
- package/src/RadarApp.basename.test.tsx +177 -0
- package/src/RadarApp.settings.test.tsx +33 -0
- package/src/RadarApp.tsx +5 -0
- package/src/api/agentSandbox.ts +259 -0
- package/src/api/client.autoPromConnect.test.tsx +43 -0
- package/src/api/client.metricsRelayCheck.test.tsx +134 -0
- package/src/api/client.ts +128 -25
- package/src/api/cloudInstallDiscover.test.tsx +76 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/kagent.test.ts +82 -0
- package/src/api/kagent.ts +230 -0
- package/src/api/prometheusCharts.ts +5 -0
- package/src/api/radarFeatures.test.ts +9 -0
- package/src/api/radarFeatures.ts +13 -0
- package/src/api/substrateWorkspace.test.ts +72 -0
- package/src/api/substrateWorkspace.ts +1394 -0
- package/src/api/vulnerabilities.ts +207 -9
- package/src/api/workloadSource.test.tsx +1172 -0
- package/src/api/workloadSource.ts +408 -0
- package/src/components/APIUnreachableBanner.test.tsx +19 -0
- package/src/components/APIUnreachableBanner.tsx +20 -0
- package/src/components/CloudConnectFlow.tsx +46 -7
- package/src/components/CloudFunnelButton.test.tsx +193 -7
- package/src/components/CloudFunnelButton.tsx +127 -32
- package/src/components/ConnectionErrorView.test.tsx +63 -2
- package/src/components/ConnectionErrorView.tsx +88 -68
- package/src/components/SelfManagedStart.tsx +12 -2
- package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
- package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
- package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
- package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
- package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
- package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
- package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
- package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
- package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
- package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
- package/src/components/agentsandbox/data.ts +135 -0
- package/src/components/agentsandbox/host.test.ts +27 -0
- package/src/components/agentsandbox/host.tsx +85 -0
- package/src/components/agentsandbox/labels.test.ts +42 -0
- package/src/components/agentsandbox/labels.ts +146 -0
- package/src/components/agentsandbox/listFilters.ts +85 -0
- package/src/components/agentsandbox/lists.ts +52 -0
- package/src/components/agentsandbox/routes.ts +23 -0
- package/src/components/agentsandbox/shared.tsx +321 -0
- package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
- package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
- package/src/components/agentsandbox/workspace.tsx +258 -0
- package/src/components/agentsandbox/workspaceRoute.ts +18 -0
- package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
- package/src/components/applications/ApplicationsView.tsx +156 -3
- package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
- package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
- package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
- package/src/components/audit/VulnerabilitiesView.tsx +639 -199
- package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
- package/src/components/cloudHints/CloudHintLink.tsx +29 -0
- package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
- package/src/components/cloudHints/cloudHints.test.ts +126 -0
- package/src/components/cloudHints/cloudHints.ts +131 -0
- package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
- package/src/components/cloudHints/cloudLinks.test.ts +52 -0
- package/src/components/cloudHints/cloudLinks.ts +31 -0
- package/src/components/cloudHints/hintStorage.ts +28 -0
- package/src/components/cnpg/CNPGView.tsx +4 -7
- package/src/components/diagnose/ActivityTurn.tsx +6 -4
- package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
- package/src/components/diagnose/AssessmentCard.tsx +1 -2
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +7 -0
- package/src/components/diagnose/DiagnoseContext.tsx +7 -0
- package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
- package/src/components/diagnose/Home.test.tsx +6 -0
- package/src/components/diagnose/Home.tsx +10 -3
- package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +1 -1
- package/src/components/diagnose/InvestigationEvidencePane.tsx +19 -2
- package/src/components/diagnose/InvestigationFindingsFooter.test.tsx +413 -0
- package/src/components/diagnose/InvestigationView.tsx +120 -23
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +1 -1
- package/src/components/diagnose/investigationState.ts +9 -0
- package/src/components/diagnose/parts.test.tsx +11 -3
- package/src/components/diagnose/toolCallLabel.ts +3 -0
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
- package/src/components/home/ActivitySummary.tsx +3 -8
- package/src/components/home/ClusterHealthCard.tsx +91 -17
- package/src/components/home/ClusterHealthCard.utilization.test.tsx +187 -0
- package/src/components/home/HomeAgentBlock.tsx +2 -0
- package/src/components/home/HomeView.tsx +9 -29
- package/src/components/home/MCPSetupDialog.test.tsx +9 -0
- package/src/components/home/MCPSetupDialog.tsx +6 -2
- package/src/components/home/McpCloudLine.test.tsx +162 -0
- package/src/components/home/McpCloudLine.tsx +95 -0
- package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
- package/src/components/home/TopologyPreview.test.tsx +31 -30
- package/src/components/home/TopologyPreview.tsx +19 -28
- package/src/components/home/mcpToolCatalog.test.ts +10 -0
- package/src/components/home/mcpToolCatalog.ts +7 -7
- package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
- package/src/components/issues/IssuesPane.render.test.tsx +36 -1
- package/src/components/issues/IssuesPane.tsx +181 -23
- package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
- package/src/components/issues/SinceLastVisitRow.tsx +71 -0
- package/src/components/issues/sinceLastVisit.test.ts +266 -0
- package/src/components/issues/sinceLastVisit.ts +439 -0
- package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
- package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
- package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
- package/src/components/kagent/KagentAgentSessions.tsx +124 -0
- package/src/components/kagent/KagentDetailPage.tsx +106 -0
- package/src/components/kagent/KagentLists.tsx +412 -0
- package/src/components/kagent/KagentOverview.tsx +234 -0
- package/src/components/kagent/KagentPages.tsx +690 -0
- package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
- package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
- package/src/components/kagent/KagentSidebar.test.tsx +112 -0
- package/src/components/kagent/KagentView.tsx +109 -0
- package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
- package/src/components/kagent/host.tsx +144 -0
- package/src/components/kagent/routes.ts +31 -0
- package/src/components/kagent/shared.tsx +336 -0
- package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
- package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
- package/src/components/kagent/workspace.fixtures.ts +108 -0
- package/src/components/kagent/workspaceRoute.ts +18 -0
- package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
- package/src/components/resource/MetricsNotConnected.tsx +10 -7
- package/src/components/resource/PrometheusCharts.tsx +10 -1
- package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
- package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
- package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
- package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
- package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
- package/src/components/resources/ResourcesView.tsx +2 -6
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +5 -4
- package/src/components/resources/renderers/PodRenderer.tsx +8 -2
- package/src/components/resources/renderers/RolloutRenderer.tsx +4 -1
- package/src/components/resources/renderers/WorkloadRenderer.tsx +4 -1
- package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
- package/src/components/settings/SettingsDialog.tsx +84 -16
- package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
- package/src/components/settings/SubstrateSettings.test.tsx +131 -0
- package/src/components/settings/SubstrateSettings.tsx +544 -0
- package/src/components/settings/settings-state.test.ts +21 -3
- package/src/components/settings/settings-state.ts +13 -3
- package/src/components/share/ShareLinkButton.test.tsx +360 -0
- package/src/components/share/ShareLinkButton.tsx +391 -0
- package/src/components/share/openShareInCloud.test.ts +29 -0
- package/src/components/share/openShareInCloud.ts +10 -0
- package/src/components/share/shareLink.test.ts +129 -0
- package/src/components/share/shareLink.ts +175 -0
- package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
- package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
- package/src/components/substrate/SubstrateActorPage.tsx +384 -0
- package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
- package/src/components/substrate/SubstrateActors.tsx +612 -0
- package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
- package/src/components/substrate/SubstrateConnect.tsx +88 -0
- package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
- package/src/components/substrate/SubstrateOverview.tsx +575 -0
- package/src/components/substrate/SubstratePages.test.tsx +478 -0
- package/src/components/substrate/SubstratePool.test.tsx +462 -0
- package/src/components/substrate/SubstratePoolPage.tsx +95 -0
- package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
- package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
- package/src/components/substrate/SubstrateStateBar.tsx +63 -0
- package/src/components/substrate/SubstrateTemplates.tsx +376 -0
- package/src/components/substrate/SubstrateView.tsx +173 -0
- package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
- package/src/components/substrate/SubstrateWorkers.tsx +389 -0
- package/src/components/substrate/attention.ts +81 -0
- package/src/components/substrate/contextPin.tsx +69 -0
- package/src/components/substrate/host.tsx +83 -0
- package/src/components/substrate/kubectlTarget.test.tsx +77 -0
- package/src/components/substrate/readings.test.ts +484 -0
- package/src/components/substrate/readings.ts +997 -0
- package/src/components/substrate/routes.ts +103 -0
- package/src/components/substrate/shared.tsx +426 -0
- package/src/components/substrate/substrate.fixtures.ts +325 -0
- package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
- package/src/components/substrate/workspaceRoute.ts +23 -0
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
- package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
- package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -5
- package/src/components/traffic/TrafficGraph.test.tsx +26 -0
- package/src/components/traffic/TrafficGraph.tsx +17 -14
- package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
- package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
- package/src/components/traffic/TrafficView.tsx +26 -56
- package/src/components/traffic/trafficFilters.test.ts +61 -1
- package/src/components/traffic/trafficFilters.ts +68 -8
- package/src/components/velero/VeleroOverview.tsx +2 -2
- package/src/components/velero/VeleroView.tsx +3 -6
- package/src/components/vulnerabilities/columns.tsx +132 -0
- package/src/components/vulnerabilities/filters.tsx +317 -0
- package/src/components/vulnerabilities/owner.test.ts +54 -0
- package/src/components/vulnerabilities/owner.tsx +163 -0
- package/src/components/vulnerabilities/parts.test.ts +126 -12
- package/src/components/vulnerabilities/parts.tsx +612 -52
- package/src/components/vulnerabilities/traffic.test.tsx +65 -0
- package/src/components/vulnerabilities/traffic.tsx +40 -0
- package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
- package/src/components/workload/WorkloadView.tsx +119 -14
- package/src/components/workload/WorkloadView.workloadSource.test.tsx +121 -0
- package/src/components/workspace/layout.tsx +13 -7
- package/src/components/workspace/sidebar.test.ts +48 -0
- package/src/components/workspace/sidebar.ts +73 -3
- package/src/components/workspace/table.ts +2 -1
- package/src/context/ConnectionContext.tsx +24 -5
- package/src/context/ConnectionProvider.connectionId.test.tsx +14 -0
- package/src/context/ConnectionProvider.handover.test.tsx +94 -0
- package/src/context/DiagnoseCustomization.tsx +20 -2
- package/src/contexts/RegistryAccessMode.test.tsx +51 -0
- package/src/contexts/RegistryAccessMode.tsx +25 -0
- package/src/hooks/useEventSource.test.tsx +275 -4
- package/src/hooks/useEventSource.ts +278 -51
- package/src/index.ts +1 -0
- package/src/integrations/resourceHost.ts +12 -6
- package/src/integrations/resourceHosts.test.tsx +27 -1
- package/src/integrations/resourceHosts.tsx +15 -7
- package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
- package/src/integrations/sidebarWorkspaces.ts +41 -0
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.ts +7 -1
- package/src/integrations/workspaceScreens.tsx +6 -0
- package/src/utils/navigation.test.ts +1 -6
- package/src/utils/navigation.ts +9 -44
- package/src/utils/network-policy-navigation.test.ts +21 -36
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRef, useEffect, useState, useCallback } from 'react'
|
|
1
|
+
import { useRef, useEffect, useState, useCallback, type ReactNode } from 'react'
|
|
2
2
|
import { X, Copy, Check, Radio, Terminal, MessageSquare, Code2, Pin } from 'lucide-react'
|
|
3
3
|
import { apiUrl, getAuthHeaders, getCredentialsMode } from '../../api/config'
|
|
4
4
|
import { MCP_TOOL_CATALOG } from './mcpToolCatalog'
|
|
@@ -22,6 +22,8 @@ interface MCPSetupDialogProps {
|
|
|
22
22
|
mcpUrl: string
|
|
23
23
|
/** Opens Radar's own investigation composer. Omit where investigations can't run. */
|
|
24
24
|
onInvestigate?: () => void
|
|
25
|
+
/** A line under the endpoint about Radar Cloud's endpoint; it gates itself. */
|
|
26
|
+
cloudLine?: ReactNode
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
function CopyButton({ text }: { text: string }) {
|
|
@@ -61,7 +63,7 @@ function CodeBlock({ children }: { children: string }) {
|
|
|
61
63
|
)
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false, execTools, httpTools, helmTools, vulnerabilityTools = false, onInvestigate, applicationEvidenceAvailable = false }: MCPSetupDialogProps) {
|
|
66
|
+
export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false, execTools, httpTools, helmTools, vulnerabilityTools = false, onInvestigate, applicationEvidenceAvailable = false, cloudLine }: MCPSetupDialogProps) {
|
|
65
67
|
const dialogRef = useRef<HTMLDivElement>(null)
|
|
66
68
|
const [isDesktop, setIsDesktop] = useState(false)
|
|
67
69
|
const [portPinned, setPortPinned] = useState(false)
|
|
@@ -298,6 +300,8 @@ export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false, execTo
|
|
|
298
300
|
</button>.
|
|
299
301
|
</p>
|
|
300
302
|
)}
|
|
303
|
+
|
|
304
|
+
{cloudLine}
|
|
301
305
|
</div>
|
|
302
306
|
|
|
303
307
|
{/* Setup instructions */}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
5
|
+
import { McpCloudLine } from './McpCloudLine'
|
|
6
|
+
import { clearHintMemory } from '../cloudHints/hintStorage'
|
|
7
|
+
|
|
8
|
+
type CloudConnect = { lane: 'driver' | 'wizard'; appUrl?: string } | undefined
|
|
9
|
+
|
|
10
|
+
const state = vi.hoisted(() => ({
|
|
11
|
+
embedded: false,
|
|
12
|
+
cloudConnect: undefined as CloudConnect,
|
|
13
|
+
mode: 'local' as string | undefined,
|
|
14
|
+
connection: 'connected',
|
|
15
|
+
discovered: { data: undefined as unknown, isError: false, isPending: false },
|
|
16
|
+
discoverEnabled: [] as boolean[],
|
|
17
|
+
}))
|
|
18
|
+
const openCloudFunnel = vi.hoisted(() => vi.fn())
|
|
19
|
+
|
|
20
|
+
vi.mock('../../context/NavCustomization', () => ({ useNavCustomization: () => ({ embedded: state.embedded }) }))
|
|
21
|
+
vi.mock('../../context/ConnectionContext', () => ({
|
|
22
|
+
useConnection: () => ({ connection: { state: state.connection } }),
|
|
23
|
+
}))
|
|
24
|
+
vi.mock('../../api/client', () => ({
|
|
25
|
+
useCapabilities: () => ({ data: { cloudConnect: state.cloudConnect, deployment: { mode: state.mode } } }),
|
|
26
|
+
useClusterInfo: () => ({ data: { context: 'kind-dev' } }),
|
|
27
|
+
useCloudInstallDiscover: (enabled: boolean) => {
|
|
28
|
+
state.discoverEnabled.push(enabled)
|
|
29
|
+
return enabled ? state.discovered : { data: undefined, isError: false, isPending: false }
|
|
30
|
+
},
|
|
31
|
+
}))
|
|
32
|
+
vi.mock('../cloudHints/cloudHints', async (importOriginal) => ({
|
|
33
|
+
...(await importOriginal<typeof import('../cloudHints/cloudHints')>()),
|
|
34
|
+
openCloudFunnel,
|
|
35
|
+
}))
|
|
36
|
+
|
|
37
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
38
|
+
let root: Root
|
|
39
|
+
let host: HTMLDivElement
|
|
40
|
+
|
|
41
|
+
function render(onBeforeOpen?: () => void) {
|
|
42
|
+
act(() => root.render(<McpCloudLine onBeforeOpen={onBeforeOpen} />))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function remount() {
|
|
46
|
+
act(() => root.unmount())
|
|
47
|
+
root = createRoot(host)
|
|
48
|
+
render()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const button = (name: RegExp) => [...host.querySelectorAll('button')].find((b) => name.test(b.textContent ?? '') || name.test(b.getAttribute('aria-label') ?? ''))
|
|
52
|
+
|
|
53
|
+
beforeEach(() => {
|
|
54
|
+
state.embedded = false
|
|
55
|
+
state.cloudConnect = { lane: 'driver', appUrl: 'https://app.radarhq.io' }
|
|
56
|
+
state.mode = 'local'
|
|
57
|
+
state.connection = 'connected'
|
|
58
|
+
state.discovered = { data: { connected: [], partialScan: false }, isError: false, isPending: false }
|
|
59
|
+
state.discoverEnabled = []
|
|
60
|
+
openCloudFunnel.mockReset()
|
|
61
|
+
window.localStorage.clear()
|
|
62
|
+
clearHintMemory()
|
|
63
|
+
host = document.createElement('div')
|
|
64
|
+
document.body.appendChild(host)
|
|
65
|
+
root = createRoot(host)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
afterEach(() => {
|
|
69
|
+
act(() => root.unmount())
|
|
70
|
+
host.remove()
|
|
71
|
+
vi.restoreAllMocks()
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
describe('McpCloudLine', () => {
|
|
75
|
+
it('names the local limit and opens the Radar Cloud dialog after closing its host', () => {
|
|
76
|
+
const order: string[] = []
|
|
77
|
+
openCloudFunnel.mockImplementation(() => order.push('cloud'))
|
|
78
|
+
render(() => order.push('close'))
|
|
79
|
+
expect(host.textContent).toContain('This endpoint covers this cluster while Radar runs on this machine.')
|
|
80
|
+
expect(host.textContent).toContain('gives one endpoint for every connected cluster, reachable from anywhere.')
|
|
81
|
+
act(() => button(/^Radar Cloud$/)!.click())
|
|
82
|
+
expect(order).toEqual(['close', 'cloud'])
|
|
83
|
+
expect(openCloudFunnel).toHaveBeenCalledWith('mcp')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('does not talk about this machine for an in-cluster Radar', () => {
|
|
87
|
+
state.cloudConnect = { lane: 'wizard', appUrl: 'https://app.radarhq.io' }
|
|
88
|
+
state.mode = 'in-cluster'
|
|
89
|
+
render()
|
|
90
|
+
expect(host.textContent).toContain('This endpoint covers this cluster only.')
|
|
91
|
+
expect(host.textContent).not.toContain('this machine')
|
|
92
|
+
expect(state.discoverEnabled.every((e) => !e)).toBe(true)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it.each([
|
|
96
|
+
['the server sends no cloudConnect (cloud mode, tunneled, out of cohort)', () => { state.cloudConnect = undefined }],
|
|
97
|
+
['an embedding host renders Radar', () => { state.embedded = true }],
|
|
98
|
+
])('renders nothing when %s', (_, arrange) => {
|
|
99
|
+
arrange()
|
|
100
|
+
render()
|
|
101
|
+
expect(host.innerHTML).toBe('')
|
|
102
|
+
expect(state.discoverEnabled.every((e) => !e)).toBe(true)
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('stays hidden after dismissal across remounts', () => {
|
|
106
|
+
render()
|
|
107
|
+
act(() => button(/Hide this line/)!.click())
|
|
108
|
+
expect(host.innerHTML).toBe('')
|
|
109
|
+
expect(window.localStorage.getItem('radar.cloudHint.mcp.dismissed')).toBe('true')
|
|
110
|
+
remount()
|
|
111
|
+
expect(host.innerHTML).toBe('')
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('renders and holds a dismissal when storage is denied', () => {
|
|
115
|
+
const denied = () => { throw new DOMException('denied', 'SecurityError') }
|
|
116
|
+
vi.spyOn(Storage.prototype, 'getItem').mockImplementation(denied)
|
|
117
|
+
vi.spyOn(Storage.prototype, 'setItem').mockImplementation(denied)
|
|
118
|
+
render()
|
|
119
|
+
expect(host.textContent).toContain('Radar Cloud')
|
|
120
|
+
act(() => button(/Hide this line/)!.click())
|
|
121
|
+
expect(host.innerHTML).toBe('')
|
|
122
|
+
remount()
|
|
123
|
+
expect(host.innerHTML).toBe('')
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
it('points to Radar Cloud agent setup when this cluster is already connected to this Hub', () => {
|
|
127
|
+
state.discovered = {
|
|
128
|
+
data: { connected: [{ namespace: 'radar', deployment: 'radar', clusterUrl: 'https://app.radarhq.io/clusters/c1' }], partialScan: false },
|
|
129
|
+
isError: false,
|
|
130
|
+
isPending: false,
|
|
131
|
+
}
|
|
132
|
+
render()
|
|
133
|
+
const link = host.querySelector('a')
|
|
134
|
+
expect(link?.textContent).toBe('Radar Cloud')
|
|
135
|
+
expect(host.textContent).toContain('This cluster is already connected to Radar Cloud. Set up an agent there to use one endpoint for every connected cluster.')
|
|
136
|
+
expect(link?.getAttribute('href')).toBe('https://app.radarhq.io/agents?utm_source=radar-oss&utm_medium=app&utm_campaign=cloud-modal&utm_content=mcp-dialog-agents-link')
|
|
137
|
+
expect(button(/^Radar Cloud$/)).toBeUndefined()
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
it.each([
|
|
141
|
+
['the connected Radar names no cluster page on this Hub', { data: { connected: [{ namespace: 'radar', deployment: 'radar', hubHost: 'hub.example.com' }], partialScan: false }, isError: false, isPending: false }],
|
|
142
|
+
['the lookup failed', { data: undefined, isError: true, isPending: false }],
|
|
143
|
+
])('keeps the dialog link when %s', (_, discovered) => {
|
|
144
|
+
state.discovered = discovered
|
|
145
|
+
render()
|
|
146
|
+
expect(host.querySelector('a')).toBeNull()
|
|
147
|
+
expect(button(/^Radar Cloud$/)).toBeTruthy()
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('shows nothing until the lookup answers', () => {
|
|
151
|
+
state.discovered = { data: undefined, isError: false, isPending: true }
|
|
152
|
+
render()
|
|
153
|
+
expect(host.innerHTML).toBe('')
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it('skips the lookup while the cluster is unreachable', () => {
|
|
157
|
+
state.connection = 'disconnected'
|
|
158
|
+
render()
|
|
159
|
+
expect(state.discoverEnabled.every((e) => !e)).toBe(true)
|
|
160
|
+
expect(button(/^Radar Cloud$/)).toBeTruthy()
|
|
161
|
+
})
|
|
162
|
+
})
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { X } from 'lucide-react'
|
|
3
|
+
import { useCapabilities, useClusterInfo, useCloudInstallDiscover } from '../../api/client'
|
|
4
|
+
import { useConnection } from '../../context/ConnectionContext'
|
|
5
|
+
import { CloudHintLink } from '../cloudHints/CloudHintLink'
|
|
6
|
+
import { useCloudHintsEnabled } from '../cloudHints/cloudHints'
|
|
7
|
+
import { local, safeGet, safeSet } from '../cloudHints/hintStorage'
|
|
8
|
+
import { SIGNUP_QUERY } from '../cloudConnectHandoff'
|
|
9
|
+
|
|
10
|
+
// One line in the MCP setup dialog, under the local endpoint, saying what that
|
|
11
|
+
// endpoint covers and what Radar Cloud's covers. It shows only where the top
|
|
12
|
+
// bar's Radar Cloud button does (the server sends cloudConnect, and no host
|
|
13
|
+
// embeds Radar) and stays hidden once dismissed. The copy is about Radar
|
|
14
|
+
// Cloud's endpoint, never about other kubeconfig contexts: the in-product
|
|
15
|
+
// connect flow connects one cluster.
|
|
16
|
+
|
|
17
|
+
const DISMISS_KEY = 'radar.cloudHint.mcp.dismissed'
|
|
18
|
+
const DISCOVER_MAX_AGE_MS = 5 * 60_000
|
|
19
|
+
|
|
20
|
+
export function McpCloudLine({ onBeforeOpen }: { onBeforeOpen?: () => void }) {
|
|
21
|
+
const hintsEnabled = useCloudHintsEnabled()
|
|
22
|
+
const capabilities = useCapabilities()
|
|
23
|
+
const cloudConnect = capabilities.data?.cloudConnect
|
|
24
|
+
const clusterConnected = useConnection().connection.state === 'connected'
|
|
25
|
+
const clusterInfo = useClusterInfo()
|
|
26
|
+
const inCluster = capabilities.data?.deployment?.mode === 'in-cluster'
|
|
27
|
+
const [dismissed, setDismissed] = useState(() => safeGet(local, DISMISS_KEY) === 'true')
|
|
28
|
+
|
|
29
|
+
const enabled = hintsEnabled && !!cloudConnect && !dismissed
|
|
30
|
+
// The same lookup the Cloud dialog runs when it opens: a Radar in this
|
|
31
|
+
// cluster that already carries Cloud settings. Only the driver lane can run
|
|
32
|
+
// it, and this line mounts only while the MCP dialog is open. An answer a few
|
|
33
|
+
// minutes old is good enough for one line of wording.
|
|
34
|
+
const lookup = enabled && cloudConnect?.lane === 'driver' && clusterConnected
|
|
35
|
+
const discovered = useCloudInstallDiscover(lookup, clusterInfo.data?.context, { maxAgeMs: DISCOVER_MAX_AGE_MS })
|
|
36
|
+
|
|
37
|
+
// Wait for the answer rather than swap one sentence for the other under the
|
|
38
|
+
// reader's eyes.
|
|
39
|
+
if (!enabled || (lookup && discovered.isPending)) return null
|
|
40
|
+
|
|
41
|
+
// A cluster page link means that Radar points at this same Hub, so its
|
|
42
|
+
// agent setup page is the right place to send someone setting up MCP.
|
|
43
|
+
const connected = discovered.isError ? undefined : discovered.data?.connected[0]
|
|
44
|
+
const agentsUrl = connected?.clusterUrl && cloudConnect.appUrl
|
|
45
|
+
? `${cloudConnect.appUrl}/agents${SIGNUP_QUERY}&utm_content=mcp-dialog-agents-link`
|
|
46
|
+
: null
|
|
47
|
+
|
|
48
|
+
const dismiss = () => {
|
|
49
|
+
safeSet(local, DISMISS_KEY, 'true')
|
|
50
|
+
setDismissed(true)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div className="flex items-start gap-2 px-0.5 text-xs leading-relaxed text-theme-text-tertiary">
|
|
55
|
+
<p className="flex-1">
|
|
56
|
+
{agentsUrl ? (
|
|
57
|
+
<>
|
|
58
|
+
This cluster is already connected to{' '}
|
|
59
|
+
<a
|
|
60
|
+
href={agentsUrl}
|
|
61
|
+
target="_blank"
|
|
62
|
+
rel="noopener noreferrer"
|
|
63
|
+
className="underline decoration-theme-border underline-offset-2 hover:text-theme-text-primary"
|
|
64
|
+
>
|
|
65
|
+
Radar Cloud
|
|
66
|
+
</a>
|
|
67
|
+
. Set up an agent there to use one endpoint for every connected cluster.
|
|
68
|
+
</>
|
|
69
|
+
) : (
|
|
70
|
+
<>
|
|
71
|
+
{inCluster
|
|
72
|
+
? 'This endpoint covers this cluster only.'
|
|
73
|
+
: 'This endpoint covers this cluster while Radar runs on this machine.'}{' '}
|
|
74
|
+
<CloudHintLink
|
|
75
|
+
entry="mcp"
|
|
76
|
+
onBeforeOpen={(open) => {
|
|
77
|
+
onBeforeOpen?.()
|
|
78
|
+
open()
|
|
79
|
+
}}
|
|
80
|
+
/>{' '}
|
|
81
|
+
gives one endpoint for every connected cluster, reachable from anywhere.
|
|
82
|
+
</>
|
|
83
|
+
)}
|
|
84
|
+
</p>
|
|
85
|
+
<button
|
|
86
|
+
type="button"
|
|
87
|
+
onClick={dismiss}
|
|
88
|
+
aria-label="Hide this line"
|
|
89
|
+
className="mt-0.5 shrink-0 rounded p-0.5 text-theme-text-tertiary transition-colors hover:bg-theme-hover hover:text-theme-text-secondary"
|
|
90
|
+
>
|
|
91
|
+
<X className="h-3 w-3" aria-hidden />
|
|
92
|
+
</button>
|
|
93
|
+
</div>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
@@ -42,7 +42,7 @@ let root: Root
|
|
|
42
42
|
let container: HTMLDivElement
|
|
43
43
|
const onResourceClick = vi.fn()
|
|
44
44
|
|
|
45
|
-
function render(rowIssue: Issue = issue, onNavigateToIssue?: (
|
|
45
|
+
function render(rowIssue: Issue = issue, onNavigateToIssue?: (issue: Issue) => void) {
|
|
46
46
|
act(() => {
|
|
47
47
|
root.render(
|
|
48
48
|
<ProblemsPanel
|
|
@@ -95,7 +95,7 @@ describe('Home Active Issues Investigate action', () => {
|
|
|
95
95
|
render(issue, onNavigateToIssue)
|
|
96
96
|
const row = buttons().find((b) => b.textContent?.includes('checkout'))
|
|
97
97
|
act(() => row!.click())
|
|
98
|
-
expect(onNavigateToIssue).toHaveBeenCalledWith(issue
|
|
98
|
+
expect(onNavigateToIssue).toHaveBeenCalledWith(issue)
|
|
99
99
|
expect(onResourceClick).not.toHaveBeenCalled()
|
|
100
100
|
})
|
|
101
101
|
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
import { act } from 'react'
|
|
3
3
|
import { createRoot, type Root } from 'react-dom/client'
|
|
4
4
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
5
|
-
import type {
|
|
5
|
+
import type { DashboardResourceCounts } from '../../api/client'
|
|
6
6
|
import { TopologyPreview } from './TopologyPreview'
|
|
7
7
|
|
|
8
8
|
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} as
|
|
10
|
+
const workloads = (total: number) => ({ total, ready: total, unready: 0 })
|
|
11
|
+
const counts = (over: Partial<DashboardResourceCounts> = {}) => ({
|
|
12
|
+
services: 12,
|
|
13
|
+
deployments: { total: 7, available: 7, unavailable: 0 },
|
|
14
|
+
statefulSets: workloads(2),
|
|
15
|
+
daemonSets: workloads(3),
|
|
16
|
+
...over,
|
|
17
|
+
}) as DashboardResourceCounts
|
|
18
18
|
|
|
19
19
|
let container: HTMLDivElement
|
|
20
20
|
let root: Root
|
|
@@ -30,43 +30,44 @@ afterEach(() => {
|
|
|
30
30
|
container.remove()
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
-
function render(
|
|
34
|
-
act(() => root.render(<TopologyPreview
|
|
33
|
+
function render(resourceCounts: DashboardResourceCounts, onNavigate = vi.fn()) {
|
|
34
|
+
act(() => root.render(<TopologyPreview counts={resourceCounts} onNavigate={onNavigate} />))
|
|
35
35
|
return onNavigate
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const header = () => container.querySelector('button > div > div')!.textContent
|
|
39
39
|
|
|
40
40
|
describe('TopologyPreview', () => {
|
|
41
|
-
it('
|
|
42
|
-
render(
|
|
43
|
-
expect(header()).toContain('
|
|
41
|
+
it('counts the services and workloads the picture connects', () => {
|
|
42
|
+
render(counts())
|
|
43
|
+
expect(header()).toContain('12 services · 12 workloads')
|
|
44
44
|
expect(container.textContent).toContain('How ingresses, services and workloads connect, grouped by namespace.')
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
-
it('
|
|
48
|
-
render(
|
|
49
|
-
|
|
50
|
-
render(
|
|
51
|
-
expect(header()).
|
|
52
|
-
expect(container.querySelector('[data-testid="topology-counts-loading"]')).toBeNull()
|
|
53
|
-
expect(container.querySelector('svg')!.innerHTML.replace(/_r_\w+_/g, '')).toBe(smallDrawing)
|
|
47
|
+
it('shows an empty scope as an honest zero, in the singular where it reads so', () => {
|
|
48
|
+
render(counts({ services: 1, deployments: { total: 0, available: 0, unavailable: 0 }, statefulSets: workloads(0), daemonSets: workloads(1) }))
|
|
49
|
+
expect(header()).toContain('1 service · 1 workload')
|
|
50
|
+
render(counts({ services: 0, deployments: { total: 0, available: 0, unavailable: 0 }, statefulSets: workloads(0), daemonSets: workloads(0) }))
|
|
51
|
+
expect(header()).toContain('0 services · 0 workloads')
|
|
54
52
|
})
|
|
55
53
|
|
|
56
|
-
it('
|
|
57
|
-
render(
|
|
58
|
-
expect(
|
|
54
|
+
it('leaves out a count the user cannot fully list rather than showing it short', () => {
|
|
55
|
+
render(counts({ restricted: ['statefulsets'] }))
|
|
56
|
+
expect(header()).toContain('12 services')
|
|
57
|
+
expect(header()).not.toContain('workload')
|
|
58
|
+
render(counts({ restricted: ['services', 'deployments'] }))
|
|
59
|
+
expect(header()).toBe('Topology')
|
|
59
60
|
})
|
|
60
61
|
|
|
61
|
-
it('
|
|
62
|
-
render(
|
|
63
|
-
|
|
64
|
-
render(
|
|
65
|
-
expect(container.querySelector('
|
|
62
|
+
it('draws the same picture whatever the cluster holds', () => {
|
|
63
|
+
render(counts())
|
|
64
|
+
const drawing = container.querySelector('svg')!.innerHTML.replace(/_r_\w+_/g, '')
|
|
65
|
+
render(counts({ services: 900 }))
|
|
66
|
+
expect(container.querySelector('svg')!.innerHTML.replace(/_r_\w+_/g, '')).toBe(drawing)
|
|
66
67
|
})
|
|
67
68
|
|
|
68
69
|
it('opens Topology from anywhere on the card', () => {
|
|
69
|
-
const onNavigate = render(
|
|
70
|
+
const onNavigate = render(counts())
|
|
70
71
|
act(() => container.querySelector('svg')!.dispatchEvent(new MouseEvent('click', { bubbles: true })))
|
|
71
72
|
expect(onNavigate).toHaveBeenCalledTimes(1)
|
|
72
73
|
})
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { useId
|
|
2
|
-
import type {
|
|
1
|
+
import { useId } from 'react'
|
|
2
|
+
import type { DashboardResourceCounts } from '../../api/client'
|
|
3
3
|
import { Network } from 'lucide-react'
|
|
4
4
|
import { useElementSize } from '../../hooks/useElementSize'
|
|
5
5
|
import { HomeDiagramCard } from './HomeDiagramCard'
|
|
6
6
|
|
|
7
7
|
interface TopologyPreviewProps {
|
|
8
|
-
|
|
9
|
-
namespaceSelected: boolean
|
|
8
|
+
counts: DashboardResourceCounts
|
|
10
9
|
onNavigate: () => void
|
|
11
10
|
}
|
|
12
11
|
|
|
@@ -112,31 +111,23 @@ function TopologySchematic() {
|
|
|
112
111
|
)
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
// honest zero.
|
|
130
|
-
const counts = useMemo(() => {
|
|
131
|
-
if (!topology || topology.requiresNamespaceFilter) return null
|
|
132
|
-
return { nodeCount: topology.nodes.length, edgeCount: topology.edges.length }
|
|
133
|
-
}, [topology])
|
|
114
|
+
// What the graph connects, counted from the dashboard's own totals rather than
|
|
115
|
+
// a graph build: it says Radar knows this cluster's services and workloads,
|
|
116
|
+
// not what Topology will draw after its filters. A count the user can't fully
|
|
117
|
+
// list is left out rather than shown short.
|
|
118
|
+
function topologyFact(counts: DashboardResourceCounts): string | undefined {
|
|
119
|
+
const restricted = new Set(counts.restricted ?? [])
|
|
120
|
+
const parts: string[] = []
|
|
121
|
+
if (!restricted.has('services')) parts.push(`${counts.services} ${counts.services === 1 ? 'service' : 'services'}`)
|
|
122
|
+
if (!['deployments', 'statefulsets', 'daemonsets'].some(kind => restricted.has(kind))) {
|
|
123
|
+
const workloads = counts.deployments.total + counts.statefulSets.total + counts.daemonSets.total
|
|
124
|
+
parts.push(`${workloads} ${workloads === 1 ? 'workload' : 'workloads'}`)
|
|
125
|
+
}
|
|
126
|
+
return parts.length > 0 ? parts.join(' · ') : undefined
|
|
127
|
+
}
|
|
134
128
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
) : needsNamespaceFilter ? undefined : (
|
|
138
|
-
<span data-testid="topology-counts-loading" className="inline-block h-3 w-28 rounded bg-theme-text-tertiary/20 animate-pulse align-middle" />
|
|
139
|
-
)
|
|
129
|
+
export function TopologyPreview({ counts, onNavigate }: TopologyPreviewProps) {
|
|
130
|
+
const fact = topologyFact(counts)
|
|
140
131
|
|
|
141
132
|
return (
|
|
142
133
|
<HomeDiagramCard
|
|
@@ -20,3 +20,13 @@ describe('diagnose catalog copy', () => {
|
|
|
20
20
|
expect(diagnose?.params.find((param) => param.arg === 'group')?.desc).toContain('argoproj.io')
|
|
21
21
|
})
|
|
22
22
|
})
|
|
23
|
+
|
|
24
|
+
describe('get_changes catalog copy', () => {
|
|
25
|
+
const description = MCP_TOOL_CATALOG.find((tool) => tool.name === 'get_changes')?.desc
|
|
26
|
+
|
|
27
|
+
it('describes live running-code changes without advertising a non-existent replicaset_history source', () => {
|
|
28
|
+
expect(description).toContain('live running-code changes')
|
|
29
|
+
expect(description).toContain('rebuilt ReplicaSet history is excluded')
|
|
30
|
+
expect(description).not.toContain('replicaset_history')
|
|
31
|
+
})
|
|
32
|
+
})
|
|
@@ -27,9 +27,9 @@ export interface MCPToolInfo {
|
|
|
27
27
|
|
|
28
28
|
export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
29
29
|
{
|
|
30
|
-
name: '
|
|
31
|
-
desc: '
|
|
32
|
-
params: [{ arg: 'namespace', desc: '
|
|
30
|
+
name: 'get_cluster_overview',
|
|
31
|
+
desc: 'Where am I and where should I look: which cluster this is, its nodes and workload counts, what you can see, and live issue counts by severity, category and namespace with a few headlines. Start here, then call issues for the problems themselves.',
|
|
32
|
+
params: [{ arg: 'namespace', desc: 'orient on one namespace' }],
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
name: 'top_resources',
|
|
@@ -53,13 +53,13 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
name: 'get_resource',
|
|
56
|
-
desc: 'A single resource: minified spec/status/metadata plus resourceContext (relationships, refs, issue/audit/policy rollups). Optionally include heavier event/metrics/change/revision data.',
|
|
56
|
+
desc: 'A single resource: minified spec/status/metadata plus resourceContext (relationships, refs, issue/audit/policy rollups) and, for workloads, cached runningCode and GitOps configRevision. Optionally include heavier event/metrics/change/revision/source data.',
|
|
57
57
|
params: [
|
|
58
58
|
{ arg: 'kind', required: true, desc: 'resource kind, e.g. pod, deployment, service' },
|
|
59
59
|
{ arg: 'name', required: true, desc: 'resource name' },
|
|
60
60
|
{ arg: 'namespace', desc: 'omit for cluster-scoped kinds (Node, ClusterRole, IngressClass, etc.)' },
|
|
61
61
|
{ arg: 'group', desc: 'API group when the kind is ambiguous (e.g. serving.knative.dev for Knative Service vs core Service)' },
|
|
62
|
-
{ arg: 'include', desc: 'identity (observed UID and resourceVersion), events, metrics, changes, issues, drain-plan (Node pod/PDB estimate), revisions (rollback targets for Deployment/StatefulSet/DaemonSet/Rollout)' },
|
|
62
|
+
{ arg: 'include', desc: 'identity (observed UID and resourceVersion), events, metrics, changes, issues, drain-plan (Node pod/PDB estimate), revisions (rollback targets for Deployment/StatefulSet/DaemonSet/Rollout), source (reads registries for code repo/commit, runningSince/previous, imageSetBy, and GitOps revision for workloads)' },
|
|
63
63
|
{ arg: 'context', desc: 'resourceContext tier: basic (default) or none' },
|
|
64
64
|
{ arg: 'relationship', desc: 'one relationship field a partial-preview warning named (e.g. dependents), returned with up to 200 entries' },
|
|
65
65
|
],
|
|
@@ -111,7 +111,7 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
name: 'diagnose',
|
|
114
|
-
desc: 'Bounded, point-in-time evidence bundle for one narrowed target — not an agent run and not an authoritative root-cause verdict. Batch targets return cached context, Issues and events without runtime logs or metrics. For pod-backed workloads, including Argo Rollout, Radar attempts selected, capped current and previous logs where available, alongside resource context, a capped warning-event sample, and startup blockers; GitOps reconcilers, including Flux HelmRelease, get status summary + parsed related issues; network entry kinds (Service / Ingress / HTTPRoute / GRPCRoute / Gateway) get a coverage-honest path trace that identifies a broken hop only when the evidence establishes one, with an optional one-shot reachability test.',
|
|
114
|
+
desc: 'Bounded, point-in-time evidence bundle for one narrowed target — not an agent run and not an authoritative root-cause verdict. Batch targets return cached context, Issues and events without runtime logs or metrics. For pod-backed workloads, including Argo Rollout, Radar attempts selected, capped current and previous logs where available, alongside resource context, cached runningCode (for Pods, scoped to the owning workload\'s cohorts), GitOps configRevision, a capped warning-event sample, and startup blockers; GitOps reconcilers, including Flux HelmRelease, get status summary + parsed related issues; network entry kinds (Service / Ingress / HTTPRoute / GRPCRoute / Gateway) get a coverage-honest path trace that identifies a broken hop only when the evidence establishes one, with an optional one-shot reachability test.',
|
|
115
115
|
params: [
|
|
116
116
|
{ arg: 'kind', required: true, desc: 'pod, deployment, statefulset, daemonset, Argo Rollout, Job, JobSet, RayJob, Kueue Workload, application, kustomization, Flux HelmRelease, service, ingress, httproute, grpcroute, or gateway' },
|
|
117
117
|
{ arg: 'group', desc: 'API group for CRDs or kind collisions (for example argoproj.io for Rollout); built-ins are inferred' },
|
|
@@ -131,7 +131,7 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
name: 'get_changes',
|
|
134
|
-
desc: 'Recent meaningful changes from the Kubernetes timeline
|
|
134
|
+
desc: 'Recent meaningful changes from the Kubernetes timeline, live running-code changes (old → new commit per container; rebuilt ReplicaSet history is excluded), and native Helm deployment history (source=helm). Includes failed upgrades, rollbacks, and current Helm revisions; sourcesErrored marks partial source failures.',
|
|
135
135
|
params: [
|
|
136
136
|
{ arg: 'namespace', desc: 'filter to a specific namespace' },
|
|
137
137
|
{ arg: 'kind', desc: 'filter to a resource kind (e.g. Deployment)' },
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { SchedulingBlockerRow, type IssueResourceRef, type SchedulingBlockerSummary } from "@skyhook-io/k8s-ui";
|
|
3
|
+
import { useSchedulingBlockerMembers } from "../../api/client";
|
|
4
|
+
|
|
5
|
+
export function ClusterSchedulingBlockerRow({
|
|
6
|
+
blocker, namespaces, onResourceClick, isNew,
|
|
7
|
+
}: {
|
|
8
|
+
blocker: SchedulingBlockerSummary;
|
|
9
|
+
namespaces: string[];
|
|
10
|
+
onResourceClick: (ref: IssueResourceRef) => void;
|
|
11
|
+
isNew: boolean;
|
|
12
|
+
}) {
|
|
13
|
+
const [open, setOpen] = useState(false);
|
|
14
|
+
const query = useSchedulingBlockerMembers(blocker, namespaces, open);
|
|
15
|
+
const pages = query.data?.pages ?? [];
|
|
16
|
+
const incomplete = query.isError || pages.some(page => page.scheduling_node_gap);
|
|
17
|
+
const visibility = pages.find(page => page.visibility?.impact)?.visibility?.impact;
|
|
18
|
+
const workloads = [...new Map(pages.flatMap(page => page.issues).map(issue => [issue.id, issue])).values()];
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<SchedulingBlockerRow
|
|
22
|
+
blocker={blocker}
|
|
23
|
+
open={open}
|
|
24
|
+
onToggle={() => setOpen(!open)}
|
|
25
|
+
workloads={workloads}
|
|
26
|
+
status={query.isPending ? "loading" : incomplete ? "incomplete" : "ready"}
|
|
27
|
+
visibility={visibility}
|
|
28
|
+
onRetry={() => { void query.refetch(); }}
|
|
29
|
+
loadingMore={query.isFetchingNextPage}
|
|
30
|
+
onLoadMore={query.hasNextPage && !incomplete ? () => { void query.fetchNextPage(); } : undefined}
|
|
31
|
+
onResourceClick={onResourceClick}
|
|
32
|
+
isNew={isNew}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -13,7 +13,10 @@ const state = vi.hoisted(() => ({
|
|
|
13
13
|
fleet: { data: undefined as IssuesResponse | undefined, isLoading: false, error: null as Error | null, dataUpdatedAt: 0, refetch: vi.fn() },
|
|
14
14
|
subject: { data: undefined as SubjectIssuesResponse | undefined, isLoading: false, error: null as Error | null, dataUpdatedAt: 0, refetch: vi.fn() },
|
|
15
15
|
}))
|
|
16
|
-
vi.mock('../../api/client', () => ({ useApplications: state.applications, useIssues: () => state.fleet, useSubjectIssues: () => state.subject, useIssueCorrelation: () => ({ data: undefined, error: null, isFetching: false, dataUpdatedAt: 0, refetch: vi.fn() }), useIssueRowChanges: () => undefined }))
|
|
16
|
+
vi.mock('../../api/client', () => ({ useCapabilities: () => ({ data: undefined }), useApplications: state.applications, useIssues: () => state.fleet, useSchedulingBlockerMembers: () => ({ isPending: true }), useSubjectIssues: () => state.subject, useIssueCorrelation: () => ({ data: undefined, error: null, isFetching: false, dataUpdatedAt: 0, refetch: vi.fn() }), useIssueRowChanges: () => undefined, useClusterInfo: () => ({ data: undefined }), useAuthMe: () => ({ isPending: false, data: undefined }), useRadarVersion: () => undefined }))
|
|
17
|
+
// The Radar Cloud hints are off here; their gating has its own tests.
|
|
18
|
+
vi.mock('../cloudHints/cloudHints', () => ({ useCloudHintsEnabled: () => false }))
|
|
19
|
+
vi.mock('../diagnose/DiagnoseContext', () => ({ useDiagnose: () => ({ setupState: 'ready', unavailableReason: '' }) }))
|
|
17
20
|
vi.mock('../../api/apiResources', () => ({ useAPIResources: () => ({ data: undefined }), karpenterCapacityAvailable: () => false }))
|
|
18
21
|
vi.mock('../../contexts/CapabilitiesContext', () => ({ useCapabilitiesContext: () => ({}) }))
|
|
19
22
|
vi.mock('../../context/ConnectionContext', () => ({ useConnection: () => ({ connection: { state: 'connected' } }) }))
|
|
@@ -217,3 +220,35 @@ describe('Helm notice in subject mode', () => {
|
|
|
217
220
|
expect(html).not.toContain('Helm releases couldn')
|
|
218
221
|
})
|
|
219
222
|
})
|
|
223
|
+
|
|
224
|
+
describe('shared scheduling blockers', () => {
|
|
225
|
+
const blocker = {
|
|
226
|
+
id: 'missing-pool',
|
|
227
|
+
blocker: { kind: 'missing_node_selector' as const, key: 'workload-pool', value: 'batch' },
|
|
228
|
+
severity: 'warning' as const,
|
|
229
|
+
affected_workloads: 720,
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
it('counts a blocker once and keeps critical workload issues ahead of a warning blocker', () => {
|
|
233
|
+
state.fleet.data = { issues: [issue], scheduling_blockers: [blocker], total: 2, total_matched: 2 }
|
|
234
|
+
const html = render('/issues')
|
|
235
|
+
expect(html).toContain('720 workloads affected')
|
|
236
|
+
expect(html.indexOf(issue.message)).toBeLessThan(html.indexOf('720 workloads affected'))
|
|
237
|
+
expect(html).not.toContain('(capped)')
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
it('keeps a blocker-only list out of the empty state and counts both kinds of rows at the cap', () => {
|
|
241
|
+
state.fleet.data = { issues: [], scheduling_blockers: [blocker], total: 1, total_matched: 2 }
|
|
242
|
+
const html = render('/issues')
|
|
243
|
+
expect(html).toContain('Showing 1 of 2 issues')
|
|
244
|
+
expect(html).not.toContain('No issues detected')
|
|
245
|
+
expect(html).toContain('720 workloads affected')
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
it('renders the selected resource issue in a resource-scoped view', () => {
|
|
249
|
+
state.fleet.data = { issues: [], scheduling_blockers: [blocker], total: 1, total_matched: 1 }
|
|
250
|
+
const html = render(subjectUrl)
|
|
251
|
+
expect(html).toContain(issue.message)
|
|
252
|
+
expect(html).not.toContain('workloads affected')
|
|
253
|
+
})
|
|
254
|
+
})
|