@skyhook-io/radar-app 1.20.0 → 1.20.3

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.
Files changed (109) hide show
  1. package/package.json +1 -1
  2. package/src/App.tsx +18 -11
  3. package/src/api/client.namespaceSwitch.hook.test.tsx +170 -1
  4. package/src/api/client.pauseDeployment.test.tsx +77 -0
  5. package/src/api/client.restartError.test.ts +14 -0
  6. package/src/api/client.revisionRefresh.test.tsx +44 -0
  7. package/src/api/client.rollbackError.test.ts +14 -0
  8. package/src/api/client.ts +287 -21
  9. package/src/api/helmInventory.test.tsx +108 -0
  10. package/src/api/networkAttachments.test.tsx +120 -0
  11. package/src/api/networkAttachments.ts +30 -0
  12. package/src/api/radarFeatures.test.ts +5 -0
  13. package/src/api/radarFeatures.ts +5 -0
  14. package/src/api/secretsStore.test.ts +33 -0
  15. package/src/api/secretsStore.ts +37 -0
  16. package/src/components/ConnectionErrorView.test.tsx +11 -0
  17. package/src/components/ConnectionErrorView.tsx +19 -0
  18. package/src/components/ContextSwitcher.tsx +9 -2
  19. package/src/components/applications/ApplicationsView.openResource.test.tsx +118 -0
  20. package/src/components/applications/ApplicationsView.tsx +8 -11
  21. package/src/components/cost/CostView.tsx +27 -9
  22. package/src/components/curl/ServiceCurlAvailability.test.tsx +32 -0
  23. package/src/components/curl/ServiceCurlButton.tsx +2 -2
  24. package/src/components/diagnose/InvestigationView.tsx +12 -3
  25. package/src/components/diagnose/investigationCase.test.tsx +41 -0
  26. package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +72 -0
  27. package/src/components/diagnose/investigationEvidence/adapters/helm.test.tsx +52 -0
  28. package/src/components/diagnose/investigationEvidence/adapters/helm.ts +61 -16
  29. package/src/components/diagnose/investigationEvidence/adapters/listings.ts +34 -4
  30. package/src/components/diagnose/investigationEvidence/adapters/resource.ts +3 -2
  31. package/src/components/diagnose/investigationEvidence/bodies/platform.tsx +82 -51
  32. package/src/components/diagnose/investigationEvidence/types.ts +5 -0
  33. package/src/components/dock/TerminalPreferences.query.test.tsx +57 -0
  34. package/src/components/dock/TerminalPreferences.test.tsx +68 -0
  35. package/src/components/dock/TerminalPreferences.tsx +73 -0
  36. package/src/components/gitops/GitOpsView.tsx +1 -9
  37. package/src/components/helm/HelmDrawerFrame.tsx +101 -0
  38. package/src/components/helm/HelmDrawerRouting.test.tsx +86 -0
  39. package/src/components/helm/HelmReleaseDrawer.tsx +47 -98
  40. package/src/components/helm/HelmView.tsx +215 -71
  41. package/src/components/helm/NotCheckedBadge.test.tsx +62 -0
  42. package/src/components/helm/NotCheckedBadge.tsx +39 -0
  43. package/src/components/helm/ObservedHelmNotice.tsx +146 -0
  44. package/src/components/helm/ObservedHelmRelease.test.tsx +261 -0
  45. package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +80 -0
  46. package/src/components/helm/ObservedHelmReleaseDrawer.tsx +228 -0
  47. package/src/components/helm/OwnedResources.test.tsx +86 -0
  48. package/src/components/helm/OwnedResources.tsx +69 -10
  49. package/src/components/home/ClusterHealthCard.heading.test.tsx +72 -0
  50. package/src/components/home/ClusterHealthCard.restricted.test.tsx +76 -0
  51. package/src/components/home/ClusterHealthCard.test.ts +44 -1
  52. package/src/components/home/ClusterHealthCard.tsx +49 -14
  53. package/src/components/home/HelmSummary.tsx +38 -19
  54. package/src/components/home/HelmSummary.unread.test.ts +16 -0
  55. package/src/components/home/HomeAgentBlock.tsx +7 -0
  56. package/src/components/home/MCPSetupDialog.test.tsx +38 -12
  57. package/src/components/home/MCPSetupDialog.tsx +5 -2
  58. package/src/components/home/mcpToolCatalog.ts +45 -5
  59. package/src/components/issues/uncheckedSources.test.ts +2 -0
  60. package/src/components/issues/uncheckedSources.ts +3 -0
  61. package/src/components/resource/RightsizingStrip.test.ts +57 -0
  62. package/src/components/resource/RightsizingStrip.tsx +53 -4
  63. package/src/components/resources/ImageFilesystemModal.test.tsx +74 -6
  64. package/src/components/resources/ImageFilesystemModal.tsx +98 -6
  65. package/src/components/resources/PodFileUploadPanel.tsx +150 -0
  66. package/src/components/resources/PodFilesystemModal.tsx +246 -3
  67. package/src/components/resources/pod-file-upload.test.tsx +223 -0
  68. package/src/components/resources/pod-file-upload.ts +266 -0
  69. package/src/components/resources/renderers/HTTPRouteRenderer.test.tsx +50 -0
  70. package/src/components/resources/renderers/HTTPRouteRenderer.tsx +27 -0
  71. package/src/components/resources/renderers/PodRenderer.tsx +26 -1
  72. package/src/components/resources/renderers/SecretProviderClassRenderer.tsx +25 -0
  73. package/src/components/resources/renderers/ServiceRenderer.test.tsx +15 -2
  74. package/src/components/resources/renderers/ServiceRenderer.tsx +1 -1
  75. package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.test.tsx +160 -0
  76. package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.tsx +128 -0
  77. package/src/components/rightsizing/RightsizingScanView.tsx +16 -1
  78. package/src/components/rightsizing/model.test.ts +11 -0
  79. package/src/components/rightsizing/model.ts +3 -1
  80. package/src/components/rightsizing/presentation.test.ts +46 -0
  81. package/src/components/rightsizing/presentation.ts +17 -2
  82. package/src/components/traffic/TrafficView.tsx +27 -27
  83. package/src/components/traffic/trafficFilters.test.ts +18 -1
  84. package/src/components/traffic/trafficFilters.ts +30 -1
  85. package/src/components/ui/Omnibar.tsx +4 -1
  86. package/src/components/ui/RadarOmnibar.test.tsx +55 -2
  87. package/src/components/ui/RadarOmnibar.tsx +7 -1
  88. package/src/components/ui/SearchSyntaxHelp.test.tsx +9 -2
  89. package/src/components/ui/SearchSyntaxHelp.tsx +3 -2
  90. package/src/components/ui/UpdateNotification.test.tsx +23 -1
  91. package/src/components/ui/UpdateNotification.tsx +26 -2
  92. package/src/components/ui/omnibar-match.test.ts +7 -0
  93. package/src/components/ui/omnibar-match.ts +1 -0
  94. package/src/components/ui/searchCoverageNote.test.ts +17 -0
  95. package/src/components/ui/searchCoverageNote.ts +31 -7
  96. package/src/components/useContextSwitchFlow.tsx +9 -1
  97. package/src/components/whats-new/releaseNotes.ts +1 -1
  98. package/src/components/workload/NodeCertificateEvidence.test.tsx +51 -0
  99. package/src/components/workload/NodeCertificateEvidence.tsx +44 -0
  100. package/src/components/workload/WorkloadView.tsx +51 -11
  101. package/src/context/ConnectionContext.test.ts +1 -0
  102. package/src/context/ConnectionContext.tsx +2 -2
  103. package/src/contexts/CapabilitiesContext.tsx +2 -0
  104. package/src/hooks/useResolvedGitOpsOwner.test.ts +22 -0
  105. package/src/hooks/useResolvedGitOpsOwner.ts +6 -3
  106. package/src/integrations/resourceHosts.test.tsx +2 -2
  107. package/src/integrations/resourceHosts.tsx +9 -0
  108. package/src/utils/namespacePick.test.ts +87 -0
  109. package/src/utils/namespacePick.ts +88 -0
@@ -0,0 +1,128 @@
1
+ import { Link2 } from 'lucide-react'
2
+ import {
3
+ RelationshipGroup,
4
+ ResourceLink,
5
+ Section,
6
+ type ResourceRef,
7
+ } from '@skyhook-io/k8s-ui'
8
+ import { LookupFailureNote } from '@skyhook-io/k8s-ui/components/resources/renderers/LookupFailureNote'
9
+ import {
10
+ ValidatingAdmissionPolicyBindingRenderer as BaseBindingRenderer,
11
+ ValidatingAdmissionPolicyRenderer as BasePolicyRenderer,
12
+ } from '@skyhook-io/k8s-ui/components/resources/renderers/ValidatingAdmissionPolicyRenderers'
13
+ import { useResources, useResourceWithRelationships } from '../../../api/client'
14
+
15
+ const ADMISSION_REGISTRATION_GROUP = 'admissionregistration.k8s.io'
16
+
17
+ export function ValidatingAdmissionPolicyRenderer({
18
+ data,
19
+ onNavigate,
20
+ }: {
21
+ data: any
22
+ onNavigate?: (ref: ResourceRef) => void
23
+ }) {
24
+ const name = data?.metadata?.name
25
+ const query = useResources<any>(
26
+ 'validatingadmissionpolicybindings',
27
+ undefined,
28
+ ADMISSION_REGISTRATION_GROUP,
29
+ { enabled: Boolean(name), refetchInterval: 30000 },
30
+ )
31
+ const bindings = (query.data ?? []).filter(binding => binding?.spec?.policyName === name)
32
+ const bindingLookupComplete = query.coverage?.status === 'complete' && !query.error
33
+ const bindingTitle = bindingLookupComplete
34
+ ? `Bindings (${bindings.length})`
35
+ : bindings.length > 0 ? `Bindings (${bindings.length}+)` : 'Bindings'
36
+ const refs = bindings.map(binding => ({
37
+ kind: 'ValidatingAdmissionPolicyBinding',
38
+ namespace: '',
39
+ name: binding?.metadata?.name ?? '',
40
+ group: ADMISSION_REGISTRATION_GROUP,
41
+ }))
42
+
43
+ return (
44
+ <BasePolicyRenderer
45
+ data={data}
46
+ onNavigate={onNavigate}
47
+ bindings={
48
+ <Section title={bindingTitle} icon={Link2} defaultExpanded>
49
+ {query.isLoading ? (
50
+ <div className="text-sm text-theme-text-tertiary">Looking for readable bindings…</div>
51
+ ) : query.error && bindings.length === 0 ? (
52
+ <LookupFailureNote errors={[query.error]} what="which bindings select this policy" />
53
+ ) : bindings.length === 0 && bindingLookupComplete ? (
54
+ <div className="text-sm text-theme-text-tertiary">
55
+ No readable bindings select this policy; this policy has no effect.
56
+ </div>
57
+ ) : bindings.length === 0 ? (
58
+ <div className="text-sm text-theme-text-tertiary">
59
+ Binding availability could not be established; this policy may still have readable bindings.
60
+ </div>
61
+ ) : (
62
+ <div className="space-y-2">
63
+ {!bindingLookupComplete && !query.error && (
64
+ <div className="text-sm text-theme-text-tertiary">
65
+ This list may be incomplete; binding coverage could not be confirmed.
66
+ </div>
67
+ )}
68
+ <LookupFailureNote
69
+ errors={[query.error]}
70
+ what="which bindings select this policy"
71
+ incomplete
72
+ />
73
+ <RelationshipGroup label="Select this policy" refs={refs} onNavigate={onNavigate} />
74
+ </div>
75
+ )}
76
+ </Section>
77
+ }
78
+ />
79
+ )
80
+ }
81
+
82
+ export function ValidatingAdmissionPolicyBindingRenderer({
83
+ data,
84
+ onNavigate,
85
+ }: {
86
+ data: any
87
+ onNavigate?: (ref: ResourceRef) => void
88
+ }) {
89
+ const policyName = data?.spec?.policyName ?? ''
90
+ const query = useResourceWithRelationships<any>(
91
+ 'validatingadmissionpolicies',
92
+ '',
93
+ policyName,
94
+ ADMISSION_REGISTRATION_GROUP,
95
+ )
96
+ const status = typeof query.error === 'object' && query.error !== null && 'status' in query.error
97
+ ? (query.error as { status?: unknown }).status
98
+ : undefined
99
+ const reference = query.isLoading ? (
100
+ <ReferenceState name={policyName} note="Checking policy availability…" />
101
+ ) : status === 404 ? (
102
+ <ReferenceState name={policyName} note="Referenced policy was not found." />
103
+ ) : status === 403 ? (
104
+ <ReferenceState name={policyName} note="Not permitted to check policy availability." />
105
+ ) : query.error ? (
106
+ <ReferenceState name={policyName} note="Could not check policy availability." />
107
+ ) : query.data ? (
108
+ <ResourceLink
109
+ name={policyName}
110
+ kind="validatingadmissionpolicies"
111
+ namespace=""
112
+ group={ADMISSION_REGISTRATION_GROUP}
113
+ onNavigate={onNavigate}
114
+ />
115
+ ) : (
116
+ <ReferenceState name={policyName} note="Policy availability was not checked." />
117
+ )
118
+ return <BaseBindingRenderer data={data} onNavigate={onNavigate} policyReference={reference} />
119
+ }
120
+
121
+ function ReferenceState({ name, note }: { name: string; note: string }) {
122
+ return (
123
+ <span className="space-y-0.5">
124
+ <span className="block">{name || 'Not specified'}</span>
125
+ <span className="block text-xs text-theme-text-tertiary">{note}</span>
126
+ </span>
127
+ )
128
+ }
@@ -19,7 +19,7 @@ import {
19
19
  useRightsizingScan,
20
20
  type RightsizingRow,
21
21
  } from '../../api/client'
22
- import { RIGHTSIZING_DOCS_URL } from '../resource/RightsizingStrip'
22
+ import { podLevelOverUseNote, RIGHTSIZING_DOCS_URL } from '../resource/RightsizingStrip'
23
23
  import { buildWorkloadPath } from '../../utils/navigation'
24
24
  import { CostViewTabs } from '../cost/CostViewTabs'
25
25
  import {
@@ -962,6 +962,13 @@ function EvidenceNote({ row }: { row: RightsizingRow }) {
962
962
  }
963
963
 
964
964
  function primaryEvidenceNote(row: RightsizingRow) {
965
+ if (row.fit === 'pod_level_request' && !row.queryError)
966
+ return (
967
+ <p className="mt-1 text-xs text-theme-text-tertiary">
968
+ {podLevelOverUseNote(row) ??
969
+ "This pod sets a pod-level request in spec.resources, which the scheduler reserves instead of container requests. Radar shows this container's usage but doesn't size the pod-level request."}
970
+ </p>
971
+ )
965
972
  if (row.hpaManaged)
966
973
  return (
967
974
  <p className="mt-1 text-xs text-theme-text-tertiary">
@@ -987,6 +994,14 @@ function primaryEvidenceNote(row: RightsizingRow) {
987
994
  Radar could not verify restart history before suggesting a lower memory request.
988
995
  </p>
989
996
  )
997
+ if (row.recommendationReason === 'requests_exceed_pod_limit')
998
+ return (
999
+ <p className="mt-1 text-xs text-theme-text-tertiary">
1000
+ Together with the other containers&apos; requests and suggested increases, the calculated
1001
+ request would take the pod above its pod-level limit. Decide how to split the limit, or
1002
+ raise it.
1003
+ </p>
1004
+ )
990
1005
  if (row.limitConflict)
991
1006
  return (
992
1007
  <p className="mt-1 text-xs text-theme-text-tertiary">
@@ -343,3 +343,14 @@ it('ranks known safety risks and increases above savings, while routine reviews
343
343
  expect(names.slice(6, 9)).toEqual(['bursty', 'hpa', 'idle'])
344
344
  expect(names.slice(9)).toEqual(['failed-risk', 'steady'])
345
345
  })
346
+
347
+ describe('pod-level requests', () => {
348
+ it('puts a container under a pod-level request in review, with no impact', () => {
349
+ const rows = [
350
+ metric({ fit: 'pod_level_request', resource: 'cpu', podLevelRequest: '200m' }),
351
+ metric({ fit: 'pod_level_request', resource: 'memory', podLevelRequest: '128Mi' }),
352
+ ]
353
+ expect(classifyRows(rows, 2)).toBe('review')
354
+ expect(calculateImpact(rows, 2)).toMatchObject({ cpuChange: 0, memoryChange: 0 })
355
+ })
356
+ })
@@ -62,7 +62,9 @@ function needsManualReview(row: RightsizingRow): boolean {
62
62
  needsSafetyReview(row) ||
63
63
  (isReduction(row) && row.bursty === true) ||
64
64
  row.recommendationReason === 'hpa_evidence_unavailable' ||
65
- row.recommendationReason === 'oom_evidence_unavailable'
65
+ row.recommendationReason === 'oom_evidence_unavailable' ||
66
+ // Mirrors ManualReviewReasons: Radar does not size a pod-level request.
67
+ row.fit === 'pod_level_request'
66
68
  )
67
69
  }
68
70
 
@@ -102,3 +102,49 @@ describe('rightsizing request presentation', () => {
102
102
  )
103
103
  })
104
104
  })
105
+
106
+ describe('pod-level request presentation', () => {
107
+ it('shows the pod-level value and asks for review instead of a per-container change', () => {
108
+ const result = getResourceRequestPresentation(
109
+ metric({
110
+ fit: 'pod_level_request',
111
+ podLevelRequest: '200m',
112
+ recommendationReason: 'pod_level_request',
113
+ }),
114
+ )
115
+ expect(result.primary).toContain('200m')
116
+ expect(result.tone).toBe('review')
117
+ })
118
+ })
119
+
120
+ describe('pod-level limit conflict presentation', () => {
121
+ it('points at the pod limit rather than the container limit', () => {
122
+ const podLimit = getResourceRequestPresentation(
123
+ metric({
124
+ fit: 'under_requested',
125
+ limitConflict: true,
126
+ recommendationReason: 'requests_exceed_pod_limit',
127
+ }),
128
+ )
129
+ const containerLimit = getResourceRequestPresentation(
130
+ metric({
131
+ fit: 'under_requested',
132
+ limitConflict: true,
133
+ recommendationReason: 'recommended_request_exceeds_limit',
134
+ }),
135
+ )
136
+ expect(podLimit.tone).toBe('review')
137
+ expect(podLimit.secondary).not.toBe(containerLimit.secondary)
138
+ })
139
+ })
140
+
141
+ describe('pod-level request without usage evidence', () => {
142
+ it('still shows the pod-level request instead of Unset', () => {
143
+ for (const row of [
144
+ metric({ fit: 'insufficient_history', podLevelRequest: '128Mi' }),
145
+ metric({ fit: 'insufficient_history', podLevelRequest: '128Mi', queryError: 'usage query failed' }),
146
+ ]) {
147
+ expect(getResourceRequestPresentation(row).primary).toContain('128Mi')
148
+ }
149
+ })
150
+ })
@@ -23,12 +23,24 @@ export function getResourceRequestPresentation(
23
23
  if (!row) return { primary: '—', secondary: 'No result returned', signals: [], tone: 'neutral' }
24
24
 
25
25
  const current = row.currentRequest && row.currentRequestValue !== 0 ? row.currentRequest : 'Unset'
26
- const currentOnly = current === 'Unset' ? current : `${current} current`
26
+ // A pod-level request is what the pod reserves, whether or not usage evidence arrived.
27
+ const currentOnly = row.podLevelRequest
28
+ ? `${row.podLevelRequest} for the pod`
29
+ : current === 'Unset'
30
+ ? current
31
+ : `${current} current`
27
32
  const signals = resourceSignals(row)
28
33
  const reason = row.recommendationReason
29
34
 
30
35
  if (row.queryError)
31
36
  return { primary: currentOnly, secondary: 'Metrics query failed', signals, tone: 'neutral' }
37
+ if (row.fit === 'pod_level_request')
38
+ return {
39
+ primary: currentOnly,
40
+ secondary: 'Review the pod-level request',
41
+ signals,
42
+ tone: 'review',
43
+ }
32
44
  if (row.fit === 'insufficient_history')
33
45
  return { primary: currentOnly, secondary: 'Not enough history', signals, tone: 'neutral' }
34
46
  if (scaledToZero)
@@ -63,7 +75,10 @@ export function getResourceRequestPresentation(
63
75
  if (row.limitConflict)
64
76
  return {
65
77
  primary: comparison,
66
- secondary: 'Raise the limit before changing',
78
+ secondary:
79
+ reason === 'requests_exceed_pod_limit'
80
+ ? 'Review against the pod limit'
81
+ : 'Raise the limit before changing',
67
82
  signals,
68
83
  tone: 'review',
69
84
  }
@@ -17,7 +17,19 @@ import { AlertBanner, EmptyState, PaneLoader, FreshnessControl } from '@skyhook-
17
17
  import { useConnection } from '../../context/ConnectionContext'
18
18
  import { Tooltip } from '../ui/Tooltip'
19
19
  import { SEVERITY_TEXT } from '@skyhook-io/k8s-ui/utils/badge-colors'
20
- import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, type VolumeUnit, isExternalKind, mergeFlowVolume, coverageLabel, type GraphFlow, endpointPair, graphEndpoint, graphEndpointId, mergeRawPairs, mergedEdgePort, selectedEdgeMatcher, selectionRawPairs, selectionMatch, graphSize, GRAPH_DRAW_BUDGET, GRAPH_DRAW_CEILING, parseFocus, focusParam, focusId, focusNeighborhood, touchesFocus, endpointSummaries, namespaceSummaries, verdictChoices, type TrafficFocus } from './trafficFilters'
20
+ import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, type VolumeUnit, isExternalKind, mergeFlowVolume, coverageLabel, type GraphFlow, endpointPair, graphEndpoint, graphEndpointId, mergeRawPairs, mergedEdgePort, selectedEdgeMatcher, selectionRawPairs, selectionMatch, graphSize, GRAPH_DRAW_BUDGET, GRAPH_DRAW_CEILING, parseFocus, focusParam, focusId, focusNeighborhood, touchesFocus, endpointSummaries, namespaceSummaries, verdictChoices, type TrafficFocus, warningRetries, warningBannerTitle, emptyWarningHeadline } from './trafficFilters'
21
+
22
+ // Where a warning about which cluster the traffic belongs to points: how the map
23
+ // keeps to this cluster in a shared metrics store, and how to set its label.
24
+ const CLUSTER_SCOPE_DOCS_URL = 'https://github.com/skyhook-io/radar/blob/main/docs/configuration.md#traffic-map-in-a-shared-metrics-store'
25
+
26
+ function ClusterScopeDocsLink() {
27
+ return (
28
+ <a className="text-xs text-accent hover:underline" href={CLUSTER_SCOPE_DOCS_URL} target="_blank" rel="noopener noreferrer">
29
+ How to fix this
30
+ </a>
31
+ )
32
+ }
21
33
 
22
34
  // Consecutive 2s retries of an empty result that came with a transient warning.
23
35
  const MAX_EMPTY_RETRIES = 5
@@ -498,27 +510,16 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
498
510
  enabled: wizardState === 'ready' && !isConnecting && !connectionError,
499
511
  })
500
512
 
501
- // A 'partial' warning is the source telling us this is as complete as it gets —
502
- // an attribute it does not export, traffic it cannot orient. Retrying returns
503
- // the same answer, so retrying forever is all cost and no progress.
504
- const warningIsPermanent = flowsData?.warningKind === 'partial'
513
+ // A partial, incomplete or cluster warning is the source's answer rather than
514
+ // a hiccup, so retrying it is all cost and no progress.
515
+ const warningRetriable = warningRetries(flowsData?.warningKind)
505
516
  const coverage = coverageLabel(flowsData?.coveredSince, flowsData?.timestamp)
506
- // An 'incomplete' one is a fetch that worked but could not see everything
507
- // (events lost, nodes unreachable). Not a failure, so not retried at once.
508
- const warningIsIncomplete = flowsData?.warningKind === 'incomplete'
509
517
  const flowsWarning = flowsData?.warning ? (
510
518
  <AlertBanner
511
519
  variant="warning"
512
- // The title follows the kind. A partial warning is about values
513
- // on edges that are shown — a port reported as 0, UDP as TCP, a
514
- // 5xx rate that failed to load — so it says "unreliable", not
515
- // "incomplete", which would send the reader looking for missing
516
- // workloads. An incomplete or transient one beside flows is
517
- // exactly that: a stream cut short, events lost, a node the
518
- // relay could not reach, a TCP query that failed — edges may
519
- // be missing from what is drawn.
520
- title={warningIsPermanent ? 'Some values on this map are unreliable' : 'Some traffic may be missing from this map'}
520
+ title={warningBannerTitle(flowsData.warningKind)}
521
521
  message={flowsData.warning}
522
+ action={flowsData.warningClusterScope ? <ClusterScopeDocsLink /> : undefined}
522
523
  />
523
524
  ) : null
524
525
 
@@ -537,14 +538,14 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
537
538
  emptyRetriesRef.current = 0
538
539
  return
539
540
  }
540
- if (!warningIsPermanent && !warningIsIncomplete && !flowsFetching && emptyRetriesRef.current < MAX_EMPTY_RETRIES) {
541
+ if (warningRetriable && !flowsFetching && emptyRetriesRef.current < MAX_EMPTY_RETRIES) {
541
542
  const timer = setTimeout(() => {
542
543
  emptyRetriesRef.current += 1
543
544
  refetchFlowsRaw()
544
545
  }, 2000)
545
546
  return () => clearTimeout(timer)
546
547
  }
547
- }, [flowsData, warningIsPermanent, warningIsIncomplete, flowsFetching, refetchFlowsRaw])
548
+ }, [flowsData, warningRetriable, flowsFetching, refetchFlowsRaw])
548
549
 
549
550
  // Filter flows based on user preferences
550
551
  // Note: namespace filtering is done server-side via the global namespace selector
@@ -1612,6 +1613,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
1612
1613
  onShowSystem={() => setHideSystem(false)}
1613
1614
  onSwitchNamespace={onSetNamespaces && !namespaceLocked && focus.namespace ? () => onSetNamespaces([focus.namespace!]) : undefined}
1614
1615
  warning={flowsData.warning}
1616
+ warningClusterScope={flowsData.warningClusterScope}
1615
1617
  onLeave={() => setFocus(null)}
1616
1618
  />
1617
1619
  </div>
@@ -1660,14 +1662,9 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
1660
1662
  tone="neutral"
1661
1663
  variant="card"
1662
1664
  icon={AlertTriangle}
1663
- headline={
1664
- warningIsPermanent
1665
- ? 'No traffic Radar can place on the map'
1666
- : warningIsIncomplete
1667
- ? 'No traffic seen, but some may be missing'
1668
- : 'Unable to fetch traffic data'
1669
- }
1665
+ headline={emptyWarningHeadline(flowsData.warningKind)}
1670
1666
  body={flowsData.warning}
1667
+ action={flowsData.warningClusterScope ? <ClusterScopeDocsLink /> : undefined}
1671
1668
  className="max-w-md"
1672
1669
  />
1673
1670
  ) : (
@@ -1697,12 +1694,14 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
1697
1694
  * one of them means the workload is quiet: Radar may have hidden its traffic,
1698
1695
  * or never fetched it.
1699
1696
  */
1700
- function FocusNotFound({ focus, hiddenByFilters, systemHidden, hideSystem, outsideNamespaces, window, onShowAll, onShowSystem, onSwitchNamespace, warning, onLeave }: {
1697
+ function FocusNotFound({ focus, hiddenByFilters, systemHidden, hideSystem, outsideNamespaces, window, onShowAll, onShowSystem, onSwitchNamespace, warning, warningClusterScope, onLeave }: {
1701
1698
  focus: TrafficFocus
1702
1699
  /** Hide System is on: traffic with system namespaces was never fetched. */
1703
1700
  hideSystem: boolean
1704
1701
  /** The fetch's own warning: with it, absence is not proof of quiet. */
1705
1702
  warning?: string
1703
+ /** The warning is about which cluster the traffic belongs to. */
1704
+ warningClusterScope?: boolean
1706
1705
  hiddenByFilters: boolean
1707
1706
  systemHidden: boolean
1708
1707
  outsideNamespaces: boolean
@@ -1755,6 +1754,7 @@ function FocusNotFound({ focus, hiddenByFilters, systemHidden, hideSystem, outsi
1755
1754
  >
1756
1755
  Leave focus
1757
1756
  </button>
1757
+ {warningClusterScope && <ClusterScopeDocsLink />}
1758
1758
  </div>
1759
1759
  }
1760
1760
  className="max-w-md"
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from 'vitest'
2
2
  import type { AggregatedFlow, TrafficFlow } from '../../types'
3
- import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, isExternalKind, isPolicyDropReason, requestRateOf, errorRateOf, formatRate, displayVolume, mergeFlowVolume, dedupeHTTPPairs, coverageLabel, latencyWeightOf, endpointPair, selectionRawPairs, mergeRawPairs, graphEndpoint, graphSize, parseFocus, focusParam, focusId, touchesFocus, focusNeighborhood, endpointSummaries, searchEndpoints, namespaceSummaries, namespaceOverBudget, hasStatusData, connectionRows, selectionMatch, edgeCarriesPort, edgesOnPort, mergedEdgePort, selectedEdgeMatcher, verdictChoices, type GraphFlow } from './trafficFilters'
3
+ import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, isExternalKind, isPolicyDropReason, requestRateOf, errorRateOf, formatRate, displayVolume, mergeFlowVolume, dedupeHTTPPairs, coverageLabel, latencyWeightOf, endpointPair, selectionRawPairs, mergeRawPairs, graphEndpoint, graphSize, parseFocus, focusParam, focusId, touchesFocus, focusNeighborhood, endpointSummaries, searchEndpoints, namespaceSummaries, namespaceOverBudget, hasStatusData, connectionRows, selectionMatch, edgeCarriesPort, edgesOnPort, mergedEdgePort, selectedEdgeMatcher, verdictChoices, warningRetries, warningBannerTitle, emptyWarningHeadline, type GraphFlow } from './trafficFilters'
4
4
 
5
5
  describe('matchesStatusRanges', () => {
6
6
  it('does not filter when nothing is selected', () => {
@@ -697,3 +697,20 @@ describe('verdictChoices', () => {
697
697
  expect(verdictChoices(['forwarded', 'redirected'])).toEqual(['forwarded'])
698
698
  })
699
699
  })
700
+
701
+ describe('flows warning kinds', () => {
702
+ // A cluster warning is the answer about a shared metrics store, not a failed
703
+ // fetch: retrying it only repeats the store's queries.
704
+ it('retries only warnings that may clear on their own', () => {
705
+ expect(warningRetries(undefined)).toBe(true)
706
+ expect(warningRetries('transient')).toBe(true)
707
+ expect(warningRetries('partial')).toBe(false)
708
+ expect(warningRetries('incomplete')).toBe(false)
709
+ expect(warningRetries('cluster')).toBe(false)
710
+ })
711
+
712
+ it('does not call a cluster warning a fetch failure or missing traffic', () => {
713
+ expect(emptyWarningHeadline('cluster')).not.toBe(emptyWarningHeadline('transient'))
714
+ expect(warningBannerTitle('cluster')).not.toBe(warningBannerTitle('transient'))
715
+ })
716
+ })
@@ -1,4 +1,4 @@
1
- import type { AggregatedFlow, TrafficFlow } from '../../types'
1
+ import type { AggregatedFlow, TrafficFlow, TrafficWarningKind } from '../../types'
2
2
  import type { TrafficEndpointPair, TrafficEndpointRef, TrafficMatch } from '../../api/traffic'
3
3
  import type { TrafficGraphSelection } from './TrafficGraph'
4
4
 
@@ -708,3 +708,32 @@ export function verdictChoices(seen: Iterable<string>): string[] {
708
708
  if (present.size === 1 && present.has('forwarded')) return []
709
709
  return ['forwarded', 'dropped', 'error'].filter(v => present.has(v))
710
710
  }
711
+
712
+ /** Whether an empty map with this warning is worth fetching again at once. Only
713
+ * a transient one (or one from a Radar that sends no kind) may clear on its own;
714
+ * the rest are the answer, and polling them costs the source a burst of queries. */
715
+ export function warningRetries(kind: TrafficWarningKind | undefined): boolean {
716
+ return kind !== 'partial' && kind !== 'incomplete' && kind !== 'cluster'
717
+ }
718
+
719
+ /** Title of the banner shown beside flows that carry a warning. */
720
+ export function warningBannerTitle(kind: TrafficWarningKind | undefined): string {
721
+ switch (kind) {
722
+ // About values on edges that are shown - a port reported as 0, UDP as TCP -
723
+ // so "unreliable", not "incomplete", which would send the reader looking
724
+ // for missing workloads.
725
+ case 'partial': return 'Some values on this map are unreliable'
726
+ case 'cluster': return "This map may include other clusters' traffic"
727
+ default: return 'Some traffic may be missing from this map'
728
+ }
729
+ }
730
+
731
+ /** Headline of the empty map when the source explained why it is empty. */
732
+ export function emptyWarningHeadline(kind: TrafficWarningKind | undefined): string {
733
+ switch (kind) {
734
+ case 'partial': return 'No traffic Radar can place on the map'
735
+ case 'incomplete': return 'No traffic seen, but some may be missing'
736
+ case 'cluster': return 'No traffic labeled as this cluster'
737
+ default: return 'Unable to fetch traffic data'
738
+ }
739
+ }
@@ -124,6 +124,8 @@ export interface OmnibarProps {
124
124
  * note says part of the scope wasn't searched, so an empty result is then
125
125
  * qualified rather than reported as no match. */
126
126
  note?: OmnibarNote
127
+ /** The connected server supports searching Event reasons and messages. */
128
+ eventContentSearch?: boolean
127
129
  /** Bounded modifier value sets to autocomplete (e.g. { ns: [...], kind: [...] }). */
128
130
  modifierOptions?: Record<string, string[]>
129
131
  /** Namespaces to seed as removable `ns:` pills when the launcher opens empty
@@ -185,6 +187,7 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
185
187
  isError = false,
186
188
  isPlaceholderData = false,
187
189
  note,
190
+ eventContentSearch = false,
188
191
  modifierOptions,
189
192
  seedNamespaces,
190
193
  loadRecents,
@@ -653,7 +656,7 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
653
656
  leftSlot={<Search className={hero ? 'w-5 h-5 shrink-0 text-theme-text-tertiary' : 'w-3.5 h-3.5 shrink-0 text-theme-text-tertiary'} />}
654
657
  rightSlot={
655
658
  <div className="flex items-center gap-1.5 shrink-0">
656
- <SearchSyntaxHelp />
659
+ <SearchSyntaxHelp eventContentSearch={eventContentSearch} />
657
660
  {!hero && !text && pills.length === 0 && (
658
661
  <kbd className="text-[10px] text-theme-text-tertiary bg-theme-surface px-1 py-0.5 rounded border border-theme-border-light">
659
662
  {mac ? '⌘' : 'Ctrl+'}K
@@ -11,12 +11,13 @@ vi.mock('../diagnose/DiagnoseContext', () => ({ useDiagnose: () => ({ available:
11
11
  vi.mock('../../hooks/useRecentResources', () => ({ loadRecentResources: () => [], recordRecentResource: vi.fn() }))
12
12
  vi.mock('../../api/apiResources', async (importOriginal) => ({ ...(await importOriginal<object>()), useAPIResources: () => ({ data: [] }) }))
13
13
  vi.mock('./command-items', async (importOriginal) => ({ ...(await importOriginal<object>()), useCommandItems: () => [] }))
14
- const caps = vi.hoisted(() => ({ data: undefined as undefined | { authEnabled?: boolean } }))
14
+ const caps = vi.hoisted(() => ({ data: undefined as undefined | { authEnabled?: boolean; features?: { searchCoverage?: boolean; searchEventContent?: boolean } } }))
15
15
  vi.mock('../../api/client', async (importOriginal) => ({
16
16
  ...(await importOriginal<object>()),
17
17
  useNamespaceScope: () => ({ data: undefined }),
18
18
  useContexts: () => ({ data: [] }),
19
19
  useCapabilities: () => caps,
20
+ useRadarFeature: () => ({ support: caps.data ? (caps.data.features?.searchEventContent ? 'supported' : 'unsupported') : 'unknown' }),
20
21
  }))
21
22
 
22
23
  import { RadarOmnibar } from './RadarOmnibar'
@@ -33,10 +34,11 @@ const failed: SearchCoverageEntry[] = [{ kind: 'SpStall', group: 'stall.sp-live.
33
34
  beforeEach(() => {
34
35
  vi.useFakeTimers()
35
36
  Element.prototype.scrollIntoView = vi.fn()
36
- caps.data = undefined
37
+ caps.data = { features: { searchEventContent: true } }
37
38
  searches = 0
38
39
  vi.stubGlobal('fetch', vi.fn(async (input: string) => {
39
40
  const url = new URL(input, 'http://localhost')
41
+ if (url.pathname.endsWith('/version-check')) return new Response(JSON.stringify({ currentVersion: 'dev' }), { status: 200 })
40
42
  if (!url.pathname.endsWith('/search')) throw new Error(`Unexpected request: ${input}`)
41
43
  searches++
42
44
  return new Response(JSON.stringify({ hits: [], total: 0, searched: 0, total_matched: 0, coverage: coverageOf(unsearched) }), { status: 200 })
@@ -165,6 +167,57 @@ describe('RadarOmnibar namespace notes', () => {
165
167
  })
166
168
  })
167
169
 
170
+ describe('RadarOmnibar Event search', () => {
171
+ it.each(['CertificateExpirationWarning', 'kind:Event CertificateExpirationWarning', 'k:ev CertificateExpirationWarning'])('explains an older server without offering unsupported Event text search: %s', async (query) => {
172
+ caps.data = { features: { searchCoverage: true } }
173
+ unsearched = []
174
+ await typeQuery(query)
175
+ expect(page()).toContain('Update the connected Radar server to search Event reasons and messages.')
176
+ expect([...document.body.querySelectorAll('button')].some((b) => b.textContent === 'Search Events')).toBe(false)
177
+ })
178
+
179
+ it('waits for server support instead of guessing while capabilities load', async () => {
180
+ caps.data = undefined
181
+ unsearched = []
182
+ await typeQuery('CertificateExpirationWarning')
183
+ expect(page()).not.toContain('Search Events')
184
+ expect(page()).not.toContain('Update the connected Radar server')
185
+ })
186
+ it('opts an empty broad search into Events and preserves its namespace and reason', async () => {
187
+ unsearched = []
188
+ const requests: string[] = []
189
+ vi.mocked(fetch).mockImplementation(async (input) => {
190
+ const query = new URL(String(input), 'http://localhost').searchParams.get('q') ?? ''
191
+ requests.push(query)
192
+ const hits = query.includes('kind:Event')
193
+ ? [{ score: 1, kind: 'Event', namespace: 'prod', name: 'certificate-warning', matched: [{ token: 'CertificateExpirationWarning', site: 'content:reason', score: 12 }], snippets: [{ path: 'reason', text: 'CertificateExpirationWarning' }] }]
194
+ : []
195
+ return new Response(JSON.stringify({ hits, total: hits.length, total_matched: hits.length, coverage: coverageOf([]) }), { status: 200 })
196
+ })
197
+ await typeQuery('ns:prod')
198
+ act(() => host.querySelector('input')!.dispatchEvent(new KeyboardEvent('keydown', { key: ' ', bubbles: true })))
199
+ await typeQuery('CertificateExpirationWarning')
200
+ expect(page()).toContain("Kubernetes Events aren't included in a broad search.")
201
+ const button = [...document.body.querySelectorAll('button')].find((b) => b.textContent === 'Search Events')
202
+ expect(button).toBeDefined()
203
+ act(() => button?.click())
204
+ await advance(300)
205
+ await advance(100)
206
+ expect(requests.at(-1)).toBe('ns:prod kind:Event CertificateExpirationWarning')
207
+ expect(page()).toContain('certificate-warning')
208
+ expect(page()).toContain('in event')
209
+ expect(page()).not.toContain('in spec')
210
+ expect(host.querySelector('input')!.value).toBe('CertificateExpirationWarning')
211
+ expect([...document.body.querySelectorAll('button')].some((b) => b.textContent === 'Search Events')).toBe(false)
212
+ })
213
+
214
+ it.each(['kind:Pod CertificateExpirationWarning', 'k:events renewal', 'kind:"Event" renewal'])('does not redirect an explicitly scoped search: %s', async (query) => {
215
+ unsearched = []
216
+ await typeQuery(query)
217
+ expect(page()).not.toContain('Search Events')
218
+ })
219
+ })
220
+
168
221
  describe('RadarOmnibar read recovery', () => {
169
222
  it.each([
170
223
  ['alone', []],
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, useEffect, useMemo, useState, useRef, useImperativeHandle } from 'react'
2
2
  import { Omnibar, type OmnibarHandle } from './Omnibar'
3
- import { useSearch, useNamespaceScope, useContexts, type SearchHit, type SearchResult } from '../../api/client'
3
+ import { useSearch, useNamespaceScope, useContexts, useRadarFeature, type SearchHit, type SearchResult } from '../../api/client'
4
4
  import { useAPIResources } from '../../api/apiResources'
5
5
  import { loadRecentResources, recordRecentResource } from '../../hooks/useRecentResources'
6
6
  import { useCommandItems, type CommandItemCallbacks } from './command-items'
@@ -48,6 +48,7 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
48
48
  const { data: nsScope } = useNamespaceScope()
49
49
  const { data: apiResources } = useAPIResources()
50
50
  const { data: contexts } = useContexts()
51
+ const { support: eventContentSupport } = useRadarFeature('searchEventContent')
51
52
  const contextKey = useMemo(() => contexts?.find((c) => c.isCurrent)?.name ?? '', [contexts])
52
53
 
53
54
  const modifierOptions = useMemo(() => ({
@@ -70,6 +71,10 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
70
71
  hits: searchData?.hits,
71
72
  query,
72
73
  recheckKind: (kind) => omnibarRef.current?.addModifier({ key: 'kind', value: kind }),
74
+ searchEvents: eventContentSupport === 'supported' && !isFetching && !isPlaceholderData && !isError
75
+ ? () => omnibarRef.current?.addModifier({ key: 'kind', value: 'Event' })
76
+ : undefined,
77
+ eventSearchNeedsUpgrade: eventContentSupport === 'unsupported' && !isFetching && !isPlaceholderData && !isError,
73
78
  pendingExhausted: exhaustedQuery === query,
74
79
  openKindList: (kind, group) => {
75
80
  const resource = apiResources?.find((r) => r.kind === kind && r.group === group)
@@ -88,6 +93,7 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
88
93
  isError={isError}
89
94
  isPlaceholderData={isPlaceholderData}
90
95
  note={note}
96
+ eventContentSearch={eventContentSupport === 'supported'}
91
97
  modifierOptions={modifierOptions}
92
98
  seedNamespaces={nsScope?.actives}
93
99
  onInvestigateQuery={onInvestigateQuery}
@@ -11,16 +11,23 @@ afterEach(() => {
11
11
  host?.remove()
12
12
  })
13
13
 
14
- function render() {
14
+ function render(eventContentSearch = false) {
15
15
  host = document.createElement('div')
16
16
  document.body.appendChild(host)
17
17
  root = createRoot(host)
18
- act(() => root!.render(<SearchSyntaxHelp />))
18
+ act(() => root!.render(<SearchSyntaxHelp eventContentSearch={eventContentSearch} />))
19
19
  return host.querySelector('button')!
20
20
  }
21
21
 
22
22
  const cardShown = () => document.body.textContent?.includes('Search syntax') ?? false
23
23
 
24
+ it.each([false, true])('describes only Event search supported by the server: %s', (supported) => {
25
+ const button = render(supported)
26
+ act(() => button.click())
27
+ expect(document.body.textContent).toContain(supported ? 'search Event reasons and messages' : 'search Events by name')
28
+ expect(document.body.textContent).not.toContain(supported ? 'search Events by name' : 'search Event reasons and messages')
29
+ })
30
+
24
31
  it('toggles on a click with no pointer before it (assistive activation)', () => {
25
32
  const button = render()
26
33
  act(() => button.click())