@skyhook-io/radar-app 1.20.1 → 1.21.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.
Files changed (215) hide show
  1. package/package.json +10 -9
  2. package/src/App.tsx +65 -16
  3. package/src/api/client.audit-gating.test.tsx +105 -5
  4. package/src/api/client.auditBadgesSync.test.tsx +118 -0
  5. package/src/api/client.capabilitiesPoll.test.ts +61 -0
  6. package/src/api/client.namespaceSwitch.hook.test.tsx +170 -1
  7. package/src/api/client.pauseDeployment.test.tsx +77 -0
  8. package/src/api/client.restartError.test.ts +14 -0
  9. package/src/api/client.revisionRefresh.test.tsx +44 -0
  10. package/src/api/client.rollbackError.test.ts +14 -0
  11. package/src/api/client.ts +347 -16
  12. package/src/api/namespaceScopeRetry.test.ts +14 -0
  13. package/src/api/networkAttachments.test.tsx +120 -0
  14. package/src/api/networkAttachments.ts +30 -0
  15. package/src/api/radarFeatures.test.ts +5 -0
  16. package/src/api/radarFeatures.ts +10 -0
  17. package/src/api/secretsStore.test.ts +33 -0
  18. package/src/api/secretsStore.ts +37 -0
  19. package/src/api/substrateHealth.ts +134 -0
  20. package/src/api/velero.test.ts +60 -0
  21. package/src/api/velero.ts +201 -0
  22. package/src/api/vulnerabilities.ts +255 -0
  23. package/src/components/ConnectionErrorView.test.tsx +11 -0
  24. package/src/components/ConnectionErrorView.tsx +19 -0
  25. package/src/components/ContextSwitcher.tsx +9 -2
  26. package/src/components/NamespaceSwitcher.tsx +3 -1
  27. package/src/components/applications/ApplicationsView.openResource.test.tsx +118 -0
  28. package/src/components/applications/ApplicationsView.tsx +8 -11
  29. package/src/components/audit/AuditView.tsx +4 -0
  30. package/src/components/audit/ChecksViewTabs.test.tsx +33 -5
  31. package/src/components/audit/ChecksViewTabs.tsx +11 -1
  32. package/src/components/audit/UpgradeReadinessView.test.ts +35 -1
  33. package/src/components/audit/UpgradeReadinessView.tsx +60 -2
  34. package/src/components/audit/VulnerabilitiesView.tsx +907 -0
  35. package/src/components/cnpg/CNPGClusterTabs.tsx +3 -1
  36. package/src/components/cnpg/CNPGDrawerTrail.tsx +5 -26
  37. package/src/components/cnpg/CNPGInvestigationAction.test.tsx +27 -6
  38. package/src/components/cnpg/CNPGView.tsx +43 -117
  39. package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +30 -0
  40. package/src/components/cnpg/host.tsx +2 -2
  41. package/src/components/cnpg/routes.ts +3 -1
  42. package/src/components/cnpg/shared.tsx +5 -53
  43. package/src/components/cnpg/useCNPGNavigate.ts +1 -21
  44. package/src/components/cnpg/useCNPGSidebarWorkspace.ts +16 -13
  45. package/src/components/community.tsx +42 -0
  46. package/src/components/cost/CostView.tsx +27 -9
  47. package/src/components/diagnose/InvestigationView.tsx +12 -3
  48. package/src/components/diagnose/diagnoseEvidenceTypes.ts +2 -0
  49. package/src/components/diagnose/investigationEvidence/adapters/helm.test.tsx +52 -0
  50. package/src/components/diagnose/investigationEvidence/adapters/helm.ts +10 -0
  51. package/src/components/diagnose/investigationEvidence/bodies/platform.tsx +82 -51
  52. package/src/components/diagnose/investigationEvidence/types.ts +5 -0
  53. package/src/components/diagnose/investigationMetrics.test.ts +20 -0
  54. package/src/components/diagnose/investigationMetrics.ts +2 -1
  55. package/src/components/dock/BottomDock.tsx +1 -0
  56. package/src/components/dock/LogsTab.tsx +3 -0
  57. package/src/components/dock/TerminalPreferences.query.test.tsx +57 -0
  58. package/src/components/dock/TerminalPreferences.test.tsx +68 -0
  59. package/src/components/dock/TerminalPreferences.tsx +73 -0
  60. package/src/components/gitops/GitOpsView.tsx +2 -10
  61. package/src/components/helm/HelmDrawerFrame.tsx +1 -1
  62. package/src/components/helm/HelmReleaseDrawer.tsx +24 -12
  63. package/src/components/helm/HelmView.tsx +25 -19
  64. package/src/components/helm/NotCheckedBadge.test.tsx +62 -0
  65. package/src/components/helm/NotCheckedBadge.tsx +39 -0
  66. package/src/components/helm/OwnedResources.test.tsx +86 -0
  67. package/src/components/helm/OwnedResources.tsx +69 -11
  68. package/src/components/home/ClusterHealthCard.heading.test.tsx +72 -0
  69. package/src/components/home/ClusterHealthCard.test.ts +44 -1
  70. package/src/components/home/ClusterHealthCard.tsx +25 -11
  71. package/src/components/home/HelmSummary.tsx +15 -15
  72. package/src/components/home/HomeAgentBlock.tsx +3 -0
  73. package/src/components/home/HomeView.tsx +7 -0
  74. package/src/components/home/MCPSetupDialog.test.tsx +19 -12
  75. package/src/components/home/MCPSetupDialog.tsx +4 -2
  76. package/src/components/home/mcpToolCatalog.ts +17 -4
  77. package/src/components/home/useVulnerabilitiesRow.test.ts +26 -0
  78. package/src/components/home/useVulnerabilitiesRow.ts +50 -0
  79. package/src/components/logs/LogsViewer.tsx +3 -1
  80. package/src/components/logs/MultiPodLogsTab.test.tsx +24 -4
  81. package/src/components/logs/MultiPodLogsTab.tsx +9 -5
  82. package/src/components/nav/PrimaryNavRail.test.tsx +17 -0
  83. package/src/components/nav/PrimaryNavRail.tsx +174 -29
  84. package/src/components/resource/PrometheusChartsGrid.tsx +5 -1
  85. package/src/components/resource/RightsizingStrip.test.ts +57 -0
  86. package/src/components/resource/RightsizingStrip.tsx +53 -4
  87. package/src/components/resource/SubstrateHealthCharts.test.tsx +143 -0
  88. package/src/components/resource/SubstrateHealthCharts.tsx +254 -0
  89. package/src/components/resource/SubstrateVerdictLine.test.tsx +131 -0
  90. package/src/components/resource/SubstrateVerdictLine.tsx +180 -0
  91. package/src/components/resources/ImageFilesystemModal.test.tsx +74 -6
  92. package/src/components/resources/ImageFilesystemModal.tsx +98 -6
  93. package/src/components/resources/PodFileUploadPanel.tsx +150 -0
  94. package/src/components/resources/PodFilesystemModal.tsx +246 -3
  95. package/src/components/resources/ResourcesView.tsx +12 -6
  96. package/src/components/resources/pod-file-upload.test.tsx +223 -0
  97. package/src/components/resources/pod-file-upload.ts +266 -0
  98. package/src/components/resources/renderers/HTTPRouteRenderer.test.tsx +50 -0
  99. package/src/components/resources/renderers/HTTPRouteRenderer.tsx +27 -0
  100. package/src/components/resources/renderers/PodRenderer.tsx +26 -1
  101. package/src/components/resources/renderers/SecretProviderClassRenderer.tsx +25 -0
  102. package/src/components/resources/renderers/UpgradePlanRenderer.test.tsx +20 -0
  103. package/src/components/resources/renderers/UpgradePlanRenderer.tsx +22 -0
  104. package/src/components/resources/renderers/VeleroBackupRenderer.tsx +16 -36
  105. package/src/components/resources/renderers/VeleroRestoreRenderer.tsx +6 -19
  106. package/src/components/resources/renderers/WorkloadRenderer.tsx +8 -0
  107. package/src/components/rightsizing/RightsizingScanView.tsx +19 -3
  108. package/src/components/rightsizing/model.test.ts +11 -0
  109. package/src/components/rightsizing/model.ts +3 -1
  110. package/src/components/rightsizing/presentation.test.ts +46 -0
  111. package/src/components/rightsizing/presentation.ts +17 -2
  112. package/src/components/shared/LargeClusterNamespacePicker.test.tsx +27 -0
  113. package/src/components/shared/LargeClusterNamespacePicker.tsx +8 -2
  114. package/src/components/timeline/TimelineView.tsx +3 -1
  115. package/src/components/traffic/TrafficConnectionsTable.test.tsx +94 -0
  116. package/src/components/traffic/TrafficConnectionsTable.tsx +21 -5
  117. package/src/components/traffic/TrafficData.test.tsx +37 -0
  118. package/src/components/traffic/TrafficData.tsx +27 -0
  119. package/src/components/traffic/TrafficFlowList.tsx +9 -7
  120. package/src/components/traffic/TrafficGraph.layoutEngine.test.tsx +193 -0
  121. package/src/components/traffic/TrafficGraph.test.tsx +269 -0
  122. package/src/components/traffic/TrafficGraph.tsx +135 -64
  123. package/src/components/traffic/TrafficGraphUnavailable.tsx +57 -0
  124. package/src/components/traffic/TrafficView.layoutUnavailable.test.tsx +211 -0
  125. package/src/components/traffic/TrafficView.tsx +72 -155
  126. package/src/components/traffic/trafficFilters.test.ts +189 -1
  127. package/src/components/traffic/trafficFilters.ts +169 -1
  128. package/src/components/ui/DiagnosticsOverlay.tsx +14 -1
  129. package/src/components/ui/Omnibar.tsx +4 -1
  130. package/src/components/ui/RadarOmnibar.test.tsx +55 -2
  131. package/src/components/ui/RadarOmnibar.tsx +7 -1
  132. package/src/components/ui/SearchSyntaxHelp.test.tsx +9 -2
  133. package/src/components/ui/SearchSyntaxHelp.tsx +3 -2
  134. package/src/components/ui/UpdateNotification.manual.test.tsx +5 -2
  135. package/src/components/ui/UpdateNotification.test.tsx +54 -3
  136. package/src/components/ui/UpdateNotification.tsx +60 -19
  137. package/src/components/ui/command-items.ts +24 -1
  138. package/src/components/ui/omnibar-match.test.ts +7 -0
  139. package/src/components/ui/omnibar-match.ts +1 -0
  140. package/src/components/ui/searchCoverageNote.test.ts +17 -0
  141. package/src/components/ui/searchCoverageNote.ts +31 -7
  142. package/src/components/useContextSwitchFlow.tsx +9 -1
  143. package/src/components/velero/VeleroBackupNow.test.tsx +165 -0
  144. package/src/components/velero/VeleroBackupNow.tsx +143 -0
  145. package/src/components/velero/VeleroDeleteBackup.test.tsx +364 -0
  146. package/src/components/velero/VeleroDeleteBackup.tsx +306 -0
  147. package/src/components/velero/VeleroDetailPage.tsx +148 -0
  148. package/src/components/velero/VeleroKindLists.test.tsx +48 -0
  149. package/src/components/velero/VeleroKindLists.tsx +43 -0
  150. package/src/components/velero/VeleroLocations.expand.test.tsx +27 -0
  151. package/src/components/velero/VeleroLocations.test.tsx +86 -0
  152. package/src/components/velero/VeleroLocations.tsx +240 -0
  153. package/src/components/velero/VeleroOverview.test.tsx +311 -0
  154. package/src/components/velero/VeleroOverview.tsx +485 -0
  155. package/src/components/velero/VeleroPages.test.tsx +516 -0
  156. package/src/components/velero/VeleroPages.tsx +1056 -0
  157. package/src/components/velero/VeleroRunLists.tsx +309 -0
  158. package/src/components/velero/VeleroRunMessagesHost.test.tsx +25 -0
  159. package/src/components/velero/VeleroRunMessagesHost.tsx +54 -0
  160. package/src/components/velero/VeleroScheduleStatusBadge.test.tsx +28 -0
  161. package/src/components/velero/VeleroScheduleStatusBadge.tsx +21 -0
  162. package/src/components/velero/VeleroSchedules.tsx +255 -0
  163. package/src/components/velero/VeleroView.tsx +59 -0
  164. package/src/components/velero/VeleroWorkspace.gate.test.tsx +97 -0
  165. package/src/components/velero/attention.test.ts +178 -0
  166. package/src/components/velero/attention.ts +281 -0
  167. package/src/components/velero/backupDelete.test.tsx +91 -0
  168. package/src/components/velero/backupDelete.tsx +182 -0
  169. package/src/components/velero/coverage.test.ts +87 -0
  170. package/src/components/velero/coverage.ts +150 -0
  171. package/src/components/velero/host.tsx +86 -0
  172. package/src/components/velero/routes.ts +78 -0
  173. package/src/components/velero/runs.tsx +121 -0
  174. package/src/components/velero/shared.test.ts +84 -0
  175. package/src/components/velero/shared.tsx +423 -0
  176. package/src/components/velero/useVeleroSidebarWorkspace.test.tsx +28 -0
  177. package/src/components/velero/useVeleroSidebarWorkspace.ts +71 -0
  178. package/src/components/velero/velero.fixtures.ts +61 -0
  179. package/src/components/velero/workspaceRoute.ts +21 -0
  180. package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.tsx +167 -0
  181. package/src/components/vulnerabilities/parts.test.ts +72 -0
  182. package/src/components/vulnerabilities/parts.tsx +291 -0
  183. package/src/components/workload/NodeCertificateEvidence.test.tsx +51 -0
  184. package/src/components/workload/NodeCertificateEvidence.tsx +44 -0
  185. package/src/components/workload/WorkloadView.tsx +114 -37
  186. package/src/components/workspace/DrawerTrailBack.tsx +32 -0
  187. package/src/components/workspace/WorkspaceFrame.tsx +71 -0
  188. package/src/components/workspace/coverage.ts +61 -0
  189. package/src/components/workspace/layout.test.tsx +29 -1
  190. package/src/components/workspace/layout.tsx +15 -5
  191. package/src/components/workspace/sidebar.ts +9 -0
  192. package/src/components/workspace/useWorkspaceDrawer.ts +63 -0
  193. package/src/components/workspace/useWorkspaceNavigate.ts +21 -0
  194. package/src/context/ConnectionContext.test.ts +1 -0
  195. package/src/context/ConnectionContext.tsx +2 -2
  196. package/src/desktop/AboutDialog.test.ts +12 -0
  197. package/src/desktop/AboutDialog.tsx +151 -0
  198. package/src/desktop/WindowsTitleBar.tsx +359 -0
  199. package/src/desktop/titleBar.test.ts +61 -0
  200. package/src/desktop/titleBar.ts +45 -0
  201. package/src/index.css +19 -0
  202. package/src/integrations/resourceHost.ts +5 -1
  203. package/src/integrations/resourceHosts.test.tsx +15 -3
  204. package/src/integrations/resourceHosts.tsx +26 -6
  205. package/src/integrations/workspaceRoute.ts +1 -1
  206. package/src/integrations/workspaceRoutes.test.ts +11 -0
  207. package/src/integrations/workspaceRoutes.ts +3 -1
  208. package/src/integrations/workspaceScreens.tsx +2 -0
  209. package/src/main.tsx +8 -0
  210. package/src/utils/desktop-zoom.test.ts +53 -0
  211. package/src/utils/desktop-zoom.ts +30 -0
  212. package/src/utils/namespacePick.test.ts +87 -0
  213. package/src/utils/namespacePick.ts +88 -0
  214. package/src/utils/staleAssetPrompt.test.tsx +76 -0
  215. package/src/utils/staleAssetPrompt.tsx +32 -0
@@ -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 20, max 100)' },
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 20, max 100)' },
302
+ { arg: 'limit', desc: 'max rows (default 10, max 100)' },
290
303
  ],
291
304
  },
292
305
  {
@@ -376,9 +389,9 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
376
389
  {
377
390
  name: 'manage_workload',
378
391
  write: true,
379
- desc: 'Operate on a workload: restart triggers a rolling restart, scale changes the replica count, rollback reverts to a previous revision. Roll back a native Helm release\'s workload as the Helm release, not the workload alone. Rollout rollback re-runs every canary step — pair it with manage_rollout promote-full, or abort instead.',
392
+ desc: 'Operate on a workload: restart triggers a rolling restart, scale changes the replica count, rollback reverts to a previous revision, pause holds a Deployment\'s rollouts until resume releases them. Roll back a native Helm release\'s workload as the Helm release, not the workload alone. Rollout rollback re-runs every canary step — pair it with manage_rollout promote-full, or abort instead.',
380
393
  params: [
381
- { arg: 'action', required: true, desc: 'restart, scale, or rollback' },
394
+ { arg: 'action', required: true, desc: 'restart, scale, rollback, pause, or resume (pause and resume are Deployment only)' },
382
395
  { arg: 'kind', required: true, desc: 'deployment, statefulset, daemonset, or rollout' },
383
396
  { arg: 'namespace', required: true, desc: 'workload namespace' },
384
397
  { arg: 'name', required: true, desc: 'workload name' },
@@ -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: () => ({ data: { status: { phase: 'Running' } } }),
10
+ useResource: () => state.resource ?? { data: { status: { phase: 'Running' } } },
11
11
  }))
12
- vi.mock('./LogsViewer', () => ({ LogsViewer: ({ podName }: { podName: string }) => { state.viewer.push(podName); return <div>viewer:{podName}</div> } }))
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 containers = logsData?.containers || []
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 || undefined}
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
  });
@@ -1,5 +1,5 @@
1
- import type { ComponentType } from "react";
2
- import type { ReactNode } from "react";
1
+ import type { ComponentType, ReactNode, RefObject } from "react";
2
+ import { useLayoutEffect, useRef, useState } from "react";
3
3
  import {
4
4
  Home,
5
5
  Network,
@@ -23,6 +23,11 @@ import { clsx } from "clsx";
23
23
  import type { MainView } from "../../types";
24
24
  import { Tooltip } from "../ui/Tooltip";
25
25
  import { assetUrl } from "@skyhook-io/k8s-ui";
26
+ import {
27
+ COMMUNITY_HINT,
28
+ SLACK_COLORS_ON_ROW_HOVER,
29
+ SlackIcon,
30
+ } from "../community";
26
31
 
27
32
  const radarLogoUrl = assetUrl("/images/radar/radar-icon.svg");
28
33
 
@@ -103,6 +108,7 @@ interface PrimaryNavRailProps {
103
108
  whatsNew?: { unread: boolean; onOpen: () => void };
104
109
  // Present during the Product Hunt launch: the launch card opens from it.
105
110
  productHunt?: { onOpen: () => void; id: string; badge: string };
111
+ communityUrl?: string;
106
112
  }
107
113
 
108
114
  export function PrimaryNavRail({
@@ -115,9 +121,21 @@ export function PrimaryNavRail({
115
121
  accountSlot,
116
122
  whatsNew,
117
123
  productHunt,
124
+ communityUrl,
118
125
  }: PrimaryNavRailProps) {
126
+ const asideRef = useRef<HTMLElement>(null);
127
+ const communityRef = useRef<HTMLDivElement>(null);
128
+ const navRef = useRef<HTMLElement>(null);
129
+ const communityFits = useSlimRailRoomFor(
130
+ asideRef,
131
+ communityRef,
132
+ navRef,
133
+ !pinned && !!communityUrl,
134
+ [showPinToggle],
135
+ );
119
136
  return (
120
137
  <aside
138
+ ref={asideRef}
121
139
  aria-label="Primary navigation"
122
140
  className={clsx(
123
141
  // Dedicated sidebar token = the DEEPEST layer of the elevation scale, so
@@ -142,6 +160,7 @@ export function PrimaryNavRail({
142
160
  in slim mode. The slim short-window case is doubly-rare (slim is
143
161
  width-triggered) and yields to keeping fly-outs intact. */}
144
162
  <nav
163
+ ref={navRef}
145
164
  className={clsx(
146
165
  "flex flex-col gap-0.5 pt-3 px-2",
147
166
  pinned && "flex-1 min-h-0 overflow-y-auto",
@@ -158,7 +177,7 @@ export function PrimaryNavRail({
158
177
  ))}
159
178
  </nav>
160
179
 
161
- {!pinned && <div className="flex-1" />}
180
+ {!pinned && <div data-rail-spacer className="flex-1" />}
162
181
 
163
182
  {/* "Me & my tools" — account + settings, the conventional rail-bottom
164
183
  cluster (VS Code / Discord / ArgoCD / Radar Cloud's own UserOrgMenu).
@@ -185,6 +204,21 @@ export function PrimaryNavRail({
185
204
  unread={whatsNew.unread}
186
205
  />
187
206
  )}
207
+ {/* Yields first on a short slim rail (useSlimRailRoomFor); ⌘K and
208
+ Diagnostics still link the community. */}
209
+ {communityUrl && (
210
+ <div ref={communityRef} hidden={!pinned && !communityFits}>
211
+ <RailActionRow
212
+ icon={SlackIcon}
213
+ label="Community"
214
+ ariaLabel="Radar community on Slack"
215
+ hint={COMMUNITY_HINT}
216
+ iconHoverClassName={SLACK_COLORS_ON_ROW_HOVER}
217
+ pinned={pinned}
218
+ href={communityUrl}
219
+ />
220
+ </div>
221
+ )}
188
222
  {onOpenSettings && (
189
223
  <RailActionRow
190
224
  icon={Settings}
@@ -235,6 +269,54 @@ export function PrimaryNavRail({
235
269
  );
236
270
  }
237
271
 
272
+ // The slim rail can't scroll (see the nav comment), so an optional row renders
273
+ // only while everything else still fits with it; otherwise it would push
274
+ // Settings and the pin toggle off-screen. It measures the rail as rendered,
275
+ // because the rows vary (the account row only with auth, launch-window rows)
276
+ // and so does the room (the Windows desktop title bar sits inside the page).
277
+ // The row's own height is left out of the measurement so hiding it can't flip
278
+ // the answer back. Every length is read from rendered boxes, so the comparison
279
+ // holds under the desktop app's body zoom and any root font size; the row's
280
+ // size comes from two consecutive main-nav rows, which share its h-9 and
281
+ // gap-0.5.
282
+ function useSlimRailRoomFor(
283
+ asideRef: RefObject<HTMLElement | null>,
284
+ rowRef: RefObject<HTMLElement | null>,
285
+ sampleRowsRef: RefObject<HTMLElement | null>,
286
+ active: boolean,
287
+ deps: unknown[],
288
+ ): boolean {
289
+ const [fits, setFits] = useState(true);
290
+ useLayoutEffect(() => {
291
+ const aside = asideRef.current;
292
+ if (!active || !aside || typeof ResizeObserver === "undefined") {
293
+ setFits(true);
294
+ return;
295
+ }
296
+ const measure = () => {
297
+ const [first, second] = Array.from(sampleRowsRef.current?.children ?? []);
298
+ if (!first || !second) return;
299
+ const rowPx =
300
+ second.getBoundingClientRect().top - first.getBoundingClientRect().top;
301
+ let used = 0;
302
+ for (const child of Array.from(aside.children)) {
303
+ if (child instanceof HTMLElement && "railSpacer" in child.dataset)
304
+ continue;
305
+ used += child.getBoundingClientRect().height;
306
+ }
307
+ if (rowRef.current && !rowRef.current.hidden) used -= rowPx;
308
+ setFits(used + rowPx <= aside.getBoundingClientRect().height);
309
+ };
310
+ measure();
311
+ const observer = new ResizeObserver(measure);
312
+ observer.observe(aside);
313
+ for (const child of Array.from(aside.children)) observer.observe(child);
314
+ return () => observer.disconnect();
315
+ // eslint-disable-next-line react-hooks/exhaustive-deps
316
+ }, [active, ...deps]);
317
+ return fits;
318
+ }
319
+
238
320
  function BrandRow({
239
321
  pinned,
240
322
  onNavigate,
@@ -358,54 +440,112 @@ function NavRailItem({
358
440
  }
359
441
 
360
442
  // A rail-bottom action row — same icon-column + fly-out treatment as NavRailItem
361
- // but it's an action (onClick), not navigation, so no active-state/accent bar.
443
+ // but it's an action (onClick) or an external link (href), not navigation, so
444
+ // no active-state/accent bar.
362
445
  // Exported so the account control (UserMenu rail variant) can match the look.
363
446
  export function RailActionRow({
364
447
  icon: Icon,
365
448
  label,
449
+ ariaLabel,
366
450
  pinned,
367
451
  onClick,
452
+ href,
368
453
  unread = false,
369
454
  iconClassName,
455
+ iconHoverClassName,
456
+ hint,
370
457
  id,
371
458
  badge,
372
459
  }: {
373
460
  icon: ComponentType<{ className?: string }>;
374
461
  label: string;
462
+ ariaLabel?: string;
375
463
  pinned: boolean;
376
- onClick: () => void;
377
464
  unread?: boolean;
378
465
  iconClassName?: string;
466
+ // Added to the default icon classes rather than replacing them.
467
+ iconHoverClassName?: string;
468
+ // A line under the label: in the fly-out when slim, a tooltip when pinned.
469
+ hint?: string;
379
470
  id?: string;
380
471
  // A small tilted tag on the corner, for an item that's only here for now.
381
472
  badge?: string;
382
- }) {
383
- return (
384
- <div className={clsx("group/item relative", !pinned && "w-10")}>
385
- <button
386
- type="button"
387
- id={id}
388
- onClick={onClick}
473
+ } & (
474
+ { onClick: () => void; href?: never } | { href: string; onClick?: never }
475
+ )) {
476
+ const rowClassName = clsx(
477
+ "relative flex h-9 w-full items-center rounded-md text-sm font-medium text-theme-text-secondary hover:bg-theme-hover hover:text-theme-text-primary transition-colors",
478
+ !pinned && "max-w-10 overflow-hidden",
479
+ );
480
+ const content = (
481
+ <>
482
+ <span className="relative flex w-10 shrink-0 items-center justify-center">
483
+ <Icon
484
+ className={clsx(
485
+ "w-[18px] h-[18px]",
486
+ iconClassName ??
487
+ clsx(
488
+ "group-hover/item:text-theme-text-secondary",
489
+ unread ? "text-accent" : "text-theme-text-tertiary",
490
+ ),
491
+ iconHoverClassName,
492
+ )}
493
+ />
494
+ {unread && (
495
+ <span
496
+ aria-hidden
497
+ className="absolute top-1.5 right-2 h-2 w-2 rounded-full bg-accent ring-2 ring-theme-sidebar"
498
+ />
499
+ )}
500
+ </span>
501
+ <span
389
502
  className={clsx(
390
- "relative flex h-9 w-full items-center rounded-md text-sm font-medium text-theme-text-secondary hover:bg-theme-hover hover:text-theme-text-primary transition-colors",
391
- !pinned && "max-w-10 overflow-hidden",
503
+ "pr-3 truncate",
504
+ !pinned && "opacity-0",
505
+ unread && "text-theme-text-primary",
392
506
  )}
393
507
  >
394
- <span className="relative flex w-10 shrink-0 items-center justify-center">
395
- <Icon className={clsx(
396
- "w-[18px] h-[18px]",
397
- iconClassName ?? clsx("group-hover/item:text-theme-text-secondary", unread ? "text-accent" : "text-theme-text-tertiary"),
398
- )} />
399
- {unread && (
400
- <span aria-hidden className="absolute top-1.5 right-2 h-2 w-2 rounded-full bg-accent ring-2 ring-theme-sidebar" />
401
- )}
402
- </span>
403
- <span className={clsx("pr-3 truncate", !pinned && "opacity-0", unread && "text-theme-text-primary")}>
404
- {label}
405
- {badge && <span className="sr-only"> ({badge})</span>}
406
- {unread && <span className="sr-only"> (unread)</span>}
407
- </span>
408
- </button>
508
+ {label}
509
+ {badge && <span className="sr-only"> ({badge})</span>}
510
+ {unread && <span className="sr-only"> (unread)</span>}
511
+ </span>
512
+ </>
513
+ );
514
+ const row = href ? (
515
+ <a
516
+ id={id}
517
+ href={href}
518
+ target="_blank"
519
+ rel="noopener noreferrer"
520
+ aria-label={ariaLabel}
521
+ className={rowClassName}
522
+ >
523
+ {content}
524
+ </a>
525
+ ) : (
526
+ <button
527
+ type="button"
528
+ id={id}
529
+ onClick={onClick}
530
+ aria-label={ariaLabel}
531
+ className={rowClassName}
532
+ >
533
+ {content}
534
+ </button>
535
+ );
536
+ return (
537
+ <div className={clsx("group/item relative", !pinned && "w-10")}>
538
+ {pinned && hint ? (
539
+ <Tooltip
540
+ content={hint}
541
+ position="right"
542
+ wrapperClassName="!block w-full"
543
+ >
544
+ {row}
545
+ </Tooltip>
546
+ ) : (
547
+ row
548
+ )}
409
549
  {badge && (
410
550
  <span
411
551
  aria-hidden
@@ -420,6 +560,11 @@ export function RailActionRow({
420
560
  className="pointer-events-none absolute left-full top-1/2 z-50 ml-1 hidden -translate-y-1/2 whitespace-nowrap rounded-md border border-theme-border bg-theme-hover px-2.5 py-1 text-[13px] font-medium text-theme-text-primary opacity-0 shadow-lg shadow-black/30 transition-opacity duration-75 group-hover/item:block group-hover/item:opacity-100"
421
561
  >
422
562
  {label}
563
+ {hint && (
564
+ <span className="block w-56 whitespace-normal text-xs font-normal text-theme-text-secondary">
565
+ {hint}
566
+ </span>
567
+ )}
423
568
  </span>
424
569
  )}
425
570
  </div>
@@ -1,3 +1,4 @@
1
+ import { clsx } from "clsx";
1
2
  import { useMemo } from "react";
2
3
  import { useSearchParams } from "react-router-dom";
3
4
  import { Loader2, Wifi, WifiOff } from "lucide-react";
@@ -46,6 +47,8 @@ export interface PrometheusChartsGridProps {
46
47
  name: string;
47
48
  /** Optional full K8s resource for request/limit overlay derivation. */
48
49
  resource?: any;
50
+ /** Fill and scroll its container (default). False lets the parent scroll it with content below. */
51
+ fill?: boolean;
49
52
  }
50
53
 
51
54
  const SUPPORTED_KINDS = new Set([
@@ -64,6 +67,7 @@ export function PrometheusChartsGrid({
64
67
  namespace,
65
68
  name,
66
69
  resource,
70
+ fill = true,
67
71
  }: PrometheusChartsGridProps) {
68
72
  useAutoPromConnect();
69
73
  const { data: status, isLoading: statusLoading } = usePrometheusStatus();
@@ -192,7 +196,7 @@ export function PrometheusChartsGrid({
192
196
  </select>;
193
197
 
194
198
  return (
195
- <div className="flex flex-col min-w-0 w-full h-full overflow-auto">
199
+ <div className={clsx("flex flex-col min-w-0 w-full", fill && "h-full overflow-auto")}>
196
200
  {!isWorkload && <div className="flex shrink-0 items-center justify-between gap-3 px-4 pt-3">{rangeControl}</div>}
197
201
 
198
202
  {isWorkload && (
@@ -3,6 +3,7 @@ import type { RightsizingRow } from '../../api/client'
3
3
  import {
4
4
  getRightsizingExplanation,
5
5
  getRightsizingPresentation,
6
+ podLevelOverUseNote,
6
7
  RIGHTSIZING_METHODOLOGY,
7
8
  RIGHTSIZING_DOCS_URL,
8
9
  RIGHTSIZING_SUMMARY,
@@ -145,3 +146,59 @@ describe('live pod inventory', () => {
145
146
  )
146
147
  })
147
148
  })
149
+
150
+ describe('pod-level request rows', () => {
151
+ it('explains the pod-level value instead of promising a per-container verdict', () => {
152
+ const message = getRightsizingExplanation(
153
+ row({
154
+ fit: 'pod_level_request',
155
+ recommendationReason: 'pod_level_request',
156
+ podLevelRequest: '128Mi',
157
+ resource: 'memory',
158
+ }),
159
+ )
160
+ expect(message).toContain('128Mi')
161
+ })
162
+
163
+ it('labels a fit this frontend does not know instead of rendering nothing', () => {
164
+ const unknownFit = 'future_fit' as unknown as Parameters<typeof getRightsizingPresentation>[0]
165
+ expect(getRightsizingPresentation(unknownFit).label).toBe('future_fit')
166
+ })
167
+ })
168
+
169
+ describe('pod-level request below one container\'s usage', () => {
170
+ const podLevel = (observed: number, formatted: string) =>
171
+ row({
172
+ fit: 'pod_level_request',
173
+ recommendationReason: 'pod_level_request',
174
+ podLevelRequest: '200m',
175
+ podLevelRequestValue: 0.2,
176
+ observed: { name: 'P95', value: observed, formatted },
177
+ })
178
+
179
+ it('names the overuse when one container alone used more than the pod request', () => {
180
+ const message = getRightsizingExplanation(podLevel(0.44, '440m'))
181
+ expect(message).toContain('440m')
182
+ expect(podLevelOverUseNote(podLevel(0.44, '440m'))).toBe(message)
183
+ })
184
+
185
+ it('says nothing about overuse when the container stayed under the pod request', () => {
186
+ expect(podLevelOverUseNote(podLevel(0.15, '150m'))).toBeUndefined()
187
+ })
188
+
189
+ it('does not ask to raise the request when an HPA scales on it', () => {
190
+ const note = podLevelOverUseNote({ ...podLevel(0.44, '440m'), hpaManaged: true })
191
+ expect(note).toContain('440m')
192
+ expect(note).toContain('HPA')
193
+ })
194
+
195
+ it('asks for an autoscaling check when Radar could not read HPAs', () => {
196
+ const note = podLevelOverUseNote({ ...podLevel(0.44, '440m'), hpaEvidenceAvailable: false })
197
+ expect(note).toContain('440m')
198
+ expect(note).toContain('HPA')
199
+ })
200
+
201
+ it('stays quiet before six hours of samples', () => {
202
+ expect(podLevelOverUseNote({ ...podLevel(0.44, '440m'), sampleCount: 1, coverage: 0 })).toBeUndefined()
203
+ })
204
+ })