@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.
- package/package.json +10 -9
- package/src/App.tsx +65 -16
- package/src/api/client.audit-gating.test.tsx +105 -5
- package/src/api/client.auditBadgesSync.test.tsx +118 -0
- package/src/api/client.capabilitiesPoll.test.ts +61 -0
- package/src/api/client.namespaceSwitch.hook.test.tsx +170 -1
- package/src/api/client.pauseDeployment.test.tsx +77 -0
- package/src/api/client.restartError.test.ts +14 -0
- package/src/api/client.revisionRefresh.test.tsx +44 -0
- package/src/api/client.rollbackError.test.ts +14 -0
- package/src/api/client.ts +347 -16
- package/src/api/namespaceScopeRetry.test.ts +14 -0
- package/src/api/networkAttachments.test.tsx +120 -0
- package/src/api/networkAttachments.ts +30 -0
- package/src/api/radarFeatures.test.ts +5 -0
- package/src/api/radarFeatures.ts +10 -0
- package/src/api/secretsStore.test.ts +33 -0
- package/src/api/secretsStore.ts +37 -0
- package/src/api/substrateHealth.ts +134 -0
- package/src/api/velero.test.ts +60 -0
- package/src/api/velero.ts +201 -0
- package/src/api/vulnerabilities.ts +255 -0
- package/src/components/ConnectionErrorView.test.tsx +11 -0
- package/src/components/ConnectionErrorView.tsx +19 -0
- package/src/components/ContextSwitcher.tsx +9 -2
- package/src/components/NamespaceSwitcher.tsx +3 -1
- package/src/components/applications/ApplicationsView.openResource.test.tsx +118 -0
- package/src/components/applications/ApplicationsView.tsx +8 -11
- package/src/components/audit/AuditView.tsx +4 -0
- package/src/components/audit/ChecksViewTabs.test.tsx +33 -5
- package/src/components/audit/ChecksViewTabs.tsx +11 -1
- package/src/components/audit/UpgradeReadinessView.test.ts +35 -1
- package/src/components/audit/UpgradeReadinessView.tsx +60 -2
- package/src/components/audit/VulnerabilitiesView.tsx +907 -0
- package/src/components/cnpg/CNPGClusterTabs.tsx +3 -1
- package/src/components/cnpg/CNPGDrawerTrail.tsx +5 -26
- package/src/components/cnpg/CNPGInvestigationAction.test.tsx +27 -6
- package/src/components/cnpg/CNPGView.tsx +43 -117
- package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +30 -0
- package/src/components/cnpg/host.tsx +2 -2
- package/src/components/cnpg/routes.ts +3 -1
- package/src/components/cnpg/shared.tsx +5 -53
- package/src/components/cnpg/useCNPGNavigate.ts +1 -21
- package/src/components/cnpg/useCNPGSidebarWorkspace.ts +16 -13
- package/src/components/community.tsx +42 -0
- package/src/components/cost/CostView.tsx +27 -9
- package/src/components/diagnose/InvestigationView.tsx +12 -3
- package/src/components/diagnose/diagnoseEvidenceTypes.ts +2 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.test.tsx +52 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.ts +10 -0
- package/src/components/diagnose/investigationEvidence/bodies/platform.tsx +82 -51
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/diagnose/investigationMetrics.test.ts +20 -0
- package/src/components/diagnose/investigationMetrics.ts +2 -1
- package/src/components/dock/BottomDock.tsx +1 -0
- package/src/components/dock/LogsTab.tsx +3 -0
- package/src/components/dock/TerminalPreferences.query.test.tsx +57 -0
- package/src/components/dock/TerminalPreferences.test.tsx +68 -0
- package/src/components/dock/TerminalPreferences.tsx +73 -0
- package/src/components/gitops/GitOpsView.tsx +2 -10
- package/src/components/helm/HelmDrawerFrame.tsx +1 -1
- package/src/components/helm/HelmReleaseDrawer.tsx +24 -12
- package/src/components/helm/HelmView.tsx +25 -19
- package/src/components/helm/NotCheckedBadge.test.tsx +62 -0
- package/src/components/helm/NotCheckedBadge.tsx +39 -0
- package/src/components/helm/OwnedResources.test.tsx +86 -0
- package/src/components/helm/OwnedResources.tsx +69 -11
- package/src/components/home/ClusterHealthCard.heading.test.tsx +72 -0
- package/src/components/home/ClusterHealthCard.test.ts +44 -1
- package/src/components/home/ClusterHealthCard.tsx +25 -11
- package/src/components/home/HelmSummary.tsx +15 -15
- package/src/components/home/HomeAgentBlock.tsx +3 -0
- package/src/components/home/HomeView.tsx +7 -0
- package/src/components/home/MCPSetupDialog.test.tsx +19 -12
- package/src/components/home/MCPSetupDialog.tsx +4 -2
- package/src/components/home/mcpToolCatalog.ts +17 -4
- package/src/components/home/useVulnerabilitiesRow.test.ts +26 -0
- package/src/components/home/useVulnerabilitiesRow.ts +50 -0
- package/src/components/logs/LogsViewer.tsx +3 -1
- package/src/components/logs/MultiPodLogsTab.test.tsx +24 -4
- package/src/components/logs/MultiPodLogsTab.tsx +9 -5
- package/src/components/nav/PrimaryNavRail.test.tsx +17 -0
- package/src/components/nav/PrimaryNavRail.tsx +174 -29
- package/src/components/resource/PrometheusChartsGrid.tsx +5 -1
- package/src/components/resource/RightsizingStrip.test.ts +57 -0
- package/src/components/resource/RightsizingStrip.tsx +53 -4
- package/src/components/resource/SubstrateHealthCharts.test.tsx +143 -0
- package/src/components/resource/SubstrateHealthCharts.tsx +254 -0
- package/src/components/resource/SubstrateVerdictLine.test.tsx +131 -0
- package/src/components/resource/SubstrateVerdictLine.tsx +180 -0
- package/src/components/resources/ImageFilesystemModal.test.tsx +74 -6
- package/src/components/resources/ImageFilesystemModal.tsx +98 -6
- package/src/components/resources/PodFileUploadPanel.tsx +150 -0
- package/src/components/resources/PodFilesystemModal.tsx +246 -3
- package/src/components/resources/ResourcesView.tsx +12 -6
- package/src/components/resources/pod-file-upload.test.tsx +223 -0
- package/src/components/resources/pod-file-upload.ts +266 -0
- package/src/components/resources/renderers/HTTPRouteRenderer.test.tsx +50 -0
- package/src/components/resources/renderers/HTTPRouteRenderer.tsx +27 -0
- package/src/components/resources/renderers/PodRenderer.tsx +26 -1
- package/src/components/resources/renderers/SecretProviderClassRenderer.tsx +25 -0
- package/src/components/resources/renderers/UpgradePlanRenderer.test.tsx +20 -0
- package/src/components/resources/renderers/UpgradePlanRenderer.tsx +22 -0
- package/src/components/resources/renderers/VeleroBackupRenderer.tsx +16 -36
- package/src/components/resources/renderers/VeleroRestoreRenderer.tsx +6 -19
- package/src/components/resources/renderers/WorkloadRenderer.tsx +8 -0
- package/src/components/rightsizing/RightsizingScanView.tsx +19 -3
- package/src/components/rightsizing/model.test.ts +11 -0
- package/src/components/rightsizing/model.ts +3 -1
- package/src/components/rightsizing/presentation.test.ts +46 -0
- package/src/components/rightsizing/presentation.ts +17 -2
- package/src/components/shared/LargeClusterNamespacePicker.test.tsx +27 -0
- package/src/components/shared/LargeClusterNamespacePicker.tsx +8 -2
- package/src/components/timeline/TimelineView.tsx +3 -1
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +94 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +21 -5
- package/src/components/traffic/TrafficData.test.tsx +37 -0
- package/src/components/traffic/TrafficData.tsx +27 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -7
- package/src/components/traffic/TrafficGraph.layoutEngine.test.tsx +193 -0
- package/src/components/traffic/TrafficGraph.test.tsx +269 -0
- package/src/components/traffic/TrafficGraph.tsx +135 -64
- package/src/components/traffic/TrafficGraphUnavailable.tsx +57 -0
- package/src/components/traffic/TrafficView.layoutUnavailable.test.tsx +211 -0
- package/src/components/traffic/TrafficView.tsx +72 -155
- package/src/components/traffic/trafficFilters.test.ts +189 -1
- package/src/components/traffic/trafficFilters.ts +169 -1
- package/src/components/ui/DiagnosticsOverlay.tsx +14 -1
- package/src/components/ui/Omnibar.tsx +4 -1
- package/src/components/ui/RadarOmnibar.test.tsx +55 -2
- package/src/components/ui/RadarOmnibar.tsx +7 -1
- package/src/components/ui/SearchSyntaxHelp.test.tsx +9 -2
- package/src/components/ui/SearchSyntaxHelp.tsx +3 -2
- package/src/components/ui/UpdateNotification.manual.test.tsx +5 -2
- package/src/components/ui/UpdateNotification.test.tsx +54 -3
- package/src/components/ui/UpdateNotification.tsx +60 -19
- package/src/components/ui/command-items.ts +24 -1
- package/src/components/ui/omnibar-match.test.ts +7 -0
- package/src/components/ui/omnibar-match.ts +1 -0
- package/src/components/ui/searchCoverageNote.test.ts +17 -0
- package/src/components/ui/searchCoverageNote.ts +31 -7
- package/src/components/useContextSwitchFlow.tsx +9 -1
- package/src/components/velero/VeleroBackupNow.test.tsx +165 -0
- package/src/components/velero/VeleroBackupNow.tsx +143 -0
- package/src/components/velero/VeleroDeleteBackup.test.tsx +364 -0
- package/src/components/velero/VeleroDeleteBackup.tsx +306 -0
- package/src/components/velero/VeleroDetailPage.tsx +148 -0
- package/src/components/velero/VeleroKindLists.test.tsx +48 -0
- package/src/components/velero/VeleroKindLists.tsx +43 -0
- package/src/components/velero/VeleroLocations.expand.test.tsx +27 -0
- package/src/components/velero/VeleroLocations.test.tsx +86 -0
- package/src/components/velero/VeleroLocations.tsx +240 -0
- package/src/components/velero/VeleroOverview.test.tsx +311 -0
- package/src/components/velero/VeleroOverview.tsx +485 -0
- package/src/components/velero/VeleroPages.test.tsx +516 -0
- package/src/components/velero/VeleroPages.tsx +1056 -0
- package/src/components/velero/VeleroRunLists.tsx +309 -0
- package/src/components/velero/VeleroRunMessagesHost.test.tsx +25 -0
- package/src/components/velero/VeleroRunMessagesHost.tsx +54 -0
- package/src/components/velero/VeleroScheduleStatusBadge.test.tsx +28 -0
- package/src/components/velero/VeleroScheduleStatusBadge.tsx +21 -0
- package/src/components/velero/VeleroSchedules.tsx +255 -0
- package/src/components/velero/VeleroView.tsx +59 -0
- package/src/components/velero/VeleroWorkspace.gate.test.tsx +97 -0
- package/src/components/velero/attention.test.ts +178 -0
- package/src/components/velero/attention.ts +281 -0
- package/src/components/velero/backupDelete.test.tsx +91 -0
- package/src/components/velero/backupDelete.tsx +182 -0
- package/src/components/velero/coverage.test.ts +87 -0
- package/src/components/velero/coverage.ts +150 -0
- package/src/components/velero/host.tsx +86 -0
- package/src/components/velero/routes.ts +78 -0
- package/src/components/velero/runs.tsx +121 -0
- package/src/components/velero/shared.test.ts +84 -0
- package/src/components/velero/shared.tsx +423 -0
- package/src/components/velero/useVeleroSidebarWorkspace.test.tsx +28 -0
- package/src/components/velero/useVeleroSidebarWorkspace.ts +71 -0
- package/src/components/velero/velero.fixtures.ts +61 -0
- package/src/components/velero/workspaceRoute.ts +21 -0
- package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.tsx +167 -0
- package/src/components/vulnerabilities/parts.test.ts +72 -0
- package/src/components/vulnerabilities/parts.tsx +291 -0
- package/src/components/workload/NodeCertificateEvidence.test.tsx +51 -0
- package/src/components/workload/NodeCertificateEvidence.tsx +44 -0
- package/src/components/workload/WorkloadView.tsx +114 -37
- package/src/components/workspace/DrawerTrailBack.tsx +32 -0
- package/src/components/workspace/WorkspaceFrame.tsx +71 -0
- package/src/components/workspace/coverage.ts +61 -0
- package/src/components/workspace/layout.test.tsx +29 -1
- package/src/components/workspace/layout.tsx +15 -5
- package/src/components/workspace/sidebar.ts +9 -0
- package/src/components/workspace/useWorkspaceDrawer.ts +63 -0
- package/src/components/workspace/useWorkspaceNavigate.ts +21 -0
- package/src/context/ConnectionContext.test.ts +1 -0
- package/src/context/ConnectionContext.tsx +2 -2
- package/src/desktop/AboutDialog.test.ts +12 -0
- package/src/desktop/AboutDialog.tsx +151 -0
- package/src/desktop/WindowsTitleBar.tsx +359 -0
- package/src/desktop/titleBar.test.ts +61 -0
- package/src/desktop/titleBar.ts +45 -0
- package/src/index.css +19 -0
- package/src/integrations/resourceHost.ts +5 -1
- package/src/integrations/resourceHosts.test.tsx +15 -3
- package/src/integrations/resourceHosts.tsx +26 -6
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.test.ts +11 -0
- package/src/integrations/workspaceRoutes.ts +3 -1
- package/src/integrations/workspaceScreens.tsx +2 -0
- package/src/main.tsx +8 -0
- package/src/utils/desktop-zoom.test.ts +53 -0
- package/src/utils/desktop-zoom.ts +30 -0
- package/src/utils/namespacePick.test.ts +87 -0
- package/src/utils/namespacePick.ts +88 -0
- package/src/utils/staleAssetPrompt.test.tsx +76 -0
- package/src/utils/staleAssetPrompt.tsx +32 -0
|
@@ -57,6 +57,8 @@ interface CostViewProps {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
const SYSTEM_COST_NAMESPACES = new Set(['kube-system', 'kube-public', 'kube-node-lease'])
|
|
60
|
+
const STORAGE_UNKNOWN_HINT =
|
|
61
|
+
"Storage cost couldn't be calculated, so totals here leave it out. It needs volume sizes in Prometheus: kube_persistentvolume_capacity_bytes from kube-state-metrics."
|
|
60
62
|
|
|
61
63
|
export function CostView(props: CostViewProps) {
|
|
62
64
|
const { pathname } = useLocation()
|
|
@@ -170,7 +172,8 @@ function CostOverview({ onBack, onOpenResource }: CostViewProps) {
|
|
|
170
172
|
const totalCpu = namespaces.reduce((sum, ns) => sum + ns.cpuCost, 0)
|
|
171
173
|
const totalMem = namespaces.reduce((sum, ns) => sum + ns.memoryCost, 0)
|
|
172
174
|
const totalStorage = data.totalStorageCost ?? 0
|
|
173
|
-
const
|
|
175
|
+
const storageUnknown = data.totalStorageCost === null
|
|
176
|
+
const hasStorage = namespaces.some((ns) => (ns.storageCost ?? 0) > 0)
|
|
174
177
|
const hasSystemNamespaces = namespaces.some((ns) => isSystemCostNamespace(ns.name))
|
|
175
178
|
|
|
176
179
|
// Compute split percentages (CPU + Memory + optional Storage)
|
|
@@ -277,11 +280,20 @@ function CostOverview({ onBack, onOpenResource }: CostViewProps) {
|
|
|
277
280
|
<span className="w-2.5 h-2.5 rounded-sm bg-amber-500" />
|
|
278
281
|
Memory {formatProjectedMonthlyRate(totalMem, currency)}
|
|
279
282
|
</span>
|
|
280
|
-
{
|
|
281
|
-
<
|
|
282
|
-
<span className="
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
{storageUnknown ? (
|
|
284
|
+
<Tooltip content={STORAGE_UNKNOWN_HINT}>
|
|
285
|
+
<span className="flex items-center gap-1.5 cursor-help">
|
|
286
|
+
<span className="w-2.5 h-2.5 rounded-sm bg-teal-500" />
|
|
287
|
+
Storage unknown
|
|
288
|
+
</span>
|
|
289
|
+
</Tooltip>
|
|
290
|
+
) : (
|
|
291
|
+
hasStorage && (
|
|
292
|
+
<span className="flex items-center gap-1.5">
|
|
293
|
+
<span className="w-2.5 h-2.5 rounded-sm bg-teal-500" />
|
|
294
|
+
Storage {formatProjectedMonthlyRate(totalStorage, currency)}
|
|
295
|
+
</span>
|
|
296
|
+
)
|
|
285
297
|
)}
|
|
286
298
|
</div>
|
|
287
299
|
</div>
|
|
@@ -294,7 +306,7 @@ function CostOverview({ onBack, onOpenResource }: CostViewProps) {
|
|
|
294
306
|
className="h-full bg-amber-500 transition-all duration-300"
|
|
295
307
|
style={{ width: `${memPct}%` }}
|
|
296
308
|
/>
|
|
297
|
-
{hasStorage && (
|
|
309
|
+
{hasStorage && !storageUnknown && (
|
|
298
310
|
<div
|
|
299
311
|
className="h-full bg-teal-500 transition-all duration-300"
|
|
300
312
|
style={{ width: `${storagePct}%` }}
|
|
@@ -492,9 +504,15 @@ function NamespaceCostRow({
|
|
|
492
504
|
<span className="text-[11px] text-theme-text-tertiary tabular-nums text-right">
|
|
493
505
|
{formatProjectedMonthlyCost(ns.cpuCost, currency)} /{' '}
|
|
494
506
|
{formatProjectedMonthlyCost(ns.memoryCost, currency)}
|
|
495
|
-
{
|
|
507
|
+
{ns.storageCost === null ? (
|
|
508
|
+
<Tooltip content={STORAGE_UNKNOWN_HINT}>
|
|
509
|
+
<span className="cursor-help"> / storage unknown</span>
|
|
510
|
+
</Tooltip>
|
|
511
|
+
) : (
|
|
512
|
+
hasStorage &&
|
|
496
513
|
(ns.storageCost ?? 0) > 0 &&
|
|
497
|
-
` / ${formatProjectedMonthlyCost(ns.storageCost ?? 0, currency)}`
|
|
514
|
+
` / ${formatProjectedMonthlyCost(ns.storageCost ?? 0, currency)}`
|
|
515
|
+
)}
|
|
498
516
|
</span>
|
|
499
517
|
</button>
|
|
500
518
|
|
|
@@ -128,6 +128,7 @@ import {
|
|
|
128
128
|
rerunOpening,
|
|
129
129
|
} from "./target";
|
|
130
130
|
import { parseContextName } from "../../utils/context-name";
|
|
131
|
+
import { Tooltip } from "../ui/Tooltip";
|
|
131
132
|
import type { InvestigationSourceExcerpt } from "./investigationSourceFocus";
|
|
132
133
|
import { diagnosisHasStoryShape } from "./investigationStory";
|
|
133
134
|
import { assessmentStateLabel, verdictSentence } from "./verdictText";
|
|
@@ -2012,9 +2013,17 @@ export function InvestigationView({
|
|
|
2012
2013
|
<AlertTriangle className="h-4 w-4 shrink-0 text-amber-500" />
|
|
2013
2014
|
<span className="min-w-0 flex-1">
|
|
2014
2015
|
This investigation ran on{" "}
|
|
2015
|
-
<
|
|
2016
|
-
{
|
|
2017
|
-
|
|
2016
|
+
<Tooltip
|
|
2017
|
+
content={
|
|
2018
|
+
parseContextName(run.context).clusterName !== run.context
|
|
2019
|
+
? run.context
|
|
2020
|
+
: ""
|
|
2021
|
+
}
|
|
2022
|
+
>
|
|
2023
|
+
<span className="font-medium text-theme-text-primary">
|
|
2024
|
+
{parseContextName(run.context).clusterName}
|
|
2025
|
+
</span>
|
|
2026
|
+
</Tooltip>
|
|
2018
2027
|
. It is read-only because its agent session was closed after a
|
|
2019
2028
|
cluster switch.
|
|
2020
2029
|
</span>
|
|
@@ -53,6 +53,8 @@ export interface DiagnosisResourceRef {
|
|
|
53
53
|
group?: string;
|
|
54
54
|
namespace?: string;
|
|
55
55
|
name: string;
|
|
56
|
+
/** Set on a declared reference the caller may not read; never followed. */
|
|
57
|
+
state?: "denied" | "access_unverified";
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
/** The HPA diagnosis Radar computes for the scaler itself, attached to the workload it scales. */
|
|
@@ -3,6 +3,7 @@ import { investigationEvidenceSubjectRef } from "../index";
|
|
|
3
3
|
import { groupsOf, project, tool } from "../evidenceFixtures";
|
|
4
4
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
5
5
|
import { HelmBody } from "../bodies/platform";
|
|
6
|
+
import { EvidenceNavigationContext } from "../navigation";
|
|
6
7
|
|
|
7
8
|
const helmRelease = {
|
|
8
9
|
name: "shop",
|
|
@@ -302,4 +303,55 @@ describe("helm release card detail", () => {
|
|
|
302
303
|
expect(html).toContain("{ color, message }");
|
|
303
304
|
expect(html).toContain("[2 items]");
|
|
304
305
|
});
|
|
306
|
+
|
|
307
|
+
it("says how many objects were not checked and does not link them", () => {
|
|
308
|
+
const projection = project([
|
|
309
|
+
tool(
|
|
310
|
+
"helm",
|
|
311
|
+
"get_helm_release",
|
|
312
|
+
{
|
|
313
|
+
...helmRelease,
|
|
314
|
+
resourceHealth: "unknown",
|
|
315
|
+
statusUnreadCount: 1,
|
|
316
|
+
resources: [
|
|
317
|
+
helmRelease.resources[1],
|
|
318
|
+
{
|
|
319
|
+
kind: "Deployment",
|
|
320
|
+
apiVersion: "apps/v1",
|
|
321
|
+
name: "worker",
|
|
322
|
+
namespace: "shared",
|
|
323
|
+
statusUnread: "user_namespace_not_visible",
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
},
|
|
327
|
+
{ summary: JSON.stringify({ namespace: "shop", name: "shop" }) },
|
|
328
|
+
),
|
|
329
|
+
]);
|
|
330
|
+
const [group] = groupsOf(projection.groups, "helm");
|
|
331
|
+
const data = group.latest.data;
|
|
332
|
+
if (data.type !== "helm") throw new Error("expected a helm card");
|
|
333
|
+
expect(data.release.statusUnreadCount).toBe(1);
|
|
334
|
+
const html = renderToStaticMarkup(
|
|
335
|
+
<EvidenceNavigationContext.Provider value={{ onOpenResource: () => {} }}>
|
|
336
|
+
<HelmBody data={data} />
|
|
337
|
+
</EvidenceNavigationContext.Provider>,
|
|
338
|
+
);
|
|
339
|
+
expect(html).toContain("1 not checked");
|
|
340
|
+
expect(html).toContain("No access");
|
|
341
|
+
expect(html.match(/<button[^>]*>[^<]*shop\/api/)).not.toBeNull();
|
|
342
|
+
expect(html.match(/<button[^>]*>[^<]*shared\/worker/)).toBeNull();
|
|
343
|
+
});
|
|
344
|
+
it("shows Flux ownership without exposing or linking a hidden controller", () => {
|
|
345
|
+
const projection = project([tool("helm", "get_helm_release", {...helmRelease, managedByFlux: true})]);
|
|
346
|
+
const [group] = groupsOf(projection.groups, "helm");
|
|
347
|
+
const data = group.latest.data;
|
|
348
|
+
if (data.type !== "helm") throw new Error("expected a helm card");
|
|
349
|
+
expect(data.release.managedByFlux).toBe(true);
|
|
350
|
+
expect(data.release.managedByFluxHelmRelease).toBeUndefined();
|
|
351
|
+
const html = renderToStaticMarkup(<HelmBody data={data} />);
|
|
352
|
+
expect(html).toContain("Managed by Flux");
|
|
353
|
+
expect(html).not.toContain("undefined");
|
|
354
|
+
expect(html).not.toContain("private-manager");
|
|
355
|
+
});
|
|
356
|
+
|
|
305
357
|
});
|
|
@@ -36,6 +36,7 @@ function helmOwnedResource(
|
|
|
36
36
|
"message",
|
|
37
37
|
"summary",
|
|
38
38
|
"issue",
|
|
39
|
+
"statusUnread",
|
|
39
40
|
] as const) {
|
|
40
41
|
if (candidate[field] !== undefined && typeof candidate[field] !== "string")
|
|
41
42
|
return undefined;
|
|
@@ -207,6 +208,10 @@ export function adaptHelmRelease(
|
|
|
207
208
|
return;
|
|
208
209
|
}
|
|
209
210
|
}
|
|
211
|
+
if (value.managedByFlux !== undefined && typeof value.managedByFlux !== "boolean") {
|
|
212
|
+
invalidPayload(builder, source);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
210
215
|
const resourcesRaw =
|
|
211
216
|
value.resources === undefined || value.resources === null
|
|
212
217
|
? []
|
|
@@ -249,6 +254,11 @@ export function adaptHelmRelease(
|
|
|
249
254
|
resourceHealth: value.resourceHealth as string | undefined,
|
|
250
255
|
healthIssue: value.healthIssue as string | undefined,
|
|
251
256
|
healthSummary: value.healthSummary as string | undefined,
|
|
257
|
+
...(typeof value.statusUnreadCount === "number" &&
|
|
258
|
+
value.statusUnreadCount > 0
|
|
259
|
+
? { statusUnreadCount: value.statusUnreadCount }
|
|
260
|
+
: {}),
|
|
261
|
+
...(value.managedByFlux === true ? { managedByFlux: true } : {}),
|
|
252
262
|
managedByFluxHelmRelease: value.managedByFluxHelmRelease as
|
|
253
263
|
string | undefined,
|
|
254
264
|
lastOperation,
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
ResourceLink,
|
|
9
9
|
} from "@skyhook-io/k8s-ui";
|
|
10
10
|
import { apiVersionToGroup } from "../../../../utils/navigation";
|
|
11
|
+
import { readActionFor } from "@skyhook-io/k8s-ui/utils/read-actions";
|
|
12
|
+
import { notCheckedTooltip } from "../../../helm/NotCheckedBadge";
|
|
11
13
|
import { Tooltip } from "../../../ui/Tooltip";
|
|
12
14
|
import { EvidenceNavigationContext } from "../navigation";
|
|
13
15
|
import { type EvidenceDataOf, ResourceFact, severityBadge } from "../cardParts";
|
|
@@ -67,6 +69,20 @@ export function HelmBody({ data }: { data: EvidenceDataOf<"helm"> }) {
|
|
|
67
69
|
resources {release.resourceHealth}
|
|
68
70
|
</Badge>
|
|
69
71
|
) : null}
|
|
72
|
+
{release.statusUnreadCount ? (
|
|
73
|
+
<Tooltip
|
|
74
|
+
content={
|
|
75
|
+
<div className="max-w-xs">
|
|
76
|
+
{notCheckedTooltip(release.statusUnreadCount, "either", "health")}
|
|
77
|
+
</div>
|
|
78
|
+
}
|
|
79
|
+
delay={150}
|
|
80
|
+
>
|
|
81
|
+
<Badge severity="neutral" size="sm">
|
|
82
|
+
{release.statusUnreadCount} not checked
|
|
83
|
+
</Badge>
|
|
84
|
+
</Tooltip>
|
|
85
|
+
) : null}
|
|
70
86
|
<Tooltip
|
|
71
87
|
content={new Date(release.updated).toLocaleString()}
|
|
72
88
|
delay={150}
|
|
@@ -132,9 +148,9 @@ export function HelmBody({ data }: { data: EvidenceDataOf<"helm"> }) {
|
|
|
132
148
|
Release metadata stored in namespace {release.storageNamespace}
|
|
133
149
|
</p>
|
|
134
150
|
) : null}
|
|
135
|
-
{release.managedByFluxHelmRelease ? (
|
|
151
|
+
{release.managedByFlux || release.managedByFluxHelmRelease ? (
|
|
136
152
|
<p className="text-xs text-theme-text-tertiary">
|
|
137
|
-
Managed by Flux HelmRelease {release.managedByFluxHelmRelease}
|
|
153
|
+
Managed by Flux{release.managedByFluxHelmRelease ? ` HelmRelease ${release.managedByFluxHelmRelease}` : ''}
|
|
138
154
|
</p>
|
|
139
155
|
) : null}
|
|
140
156
|
{release.hooks && release.hooks.length > 0 ? (
|
|
@@ -244,59 +260,74 @@ export function HelmBody({ data }: { data: EvidenceDataOf<"helm"> }) {
|
|
|
244
260
|
) : null}
|
|
245
261
|
{release.resources.length > 0 ? (
|
|
246
262
|
<div className="max-h-52 overflow-y-auto rounded-md border border-theme-border">
|
|
247
|
-
{release.resources.map((owned, index) =>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
"
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
263
|
+
{release.resources.map((owned, index) => {
|
|
264
|
+
const unread = owned.statusUnread
|
|
265
|
+
? readActionFor(owned.statusUnread) === "retry"
|
|
266
|
+
? "Not checked"
|
|
267
|
+
: "No access"
|
|
268
|
+
: undefined;
|
|
269
|
+
return (
|
|
270
|
+
<div
|
|
271
|
+
key={`${owned.kind}-${owned.namespace}-${owned.name}`}
|
|
272
|
+
className={clsx(
|
|
273
|
+
"flex min-w-0 items-center gap-2 px-2.5 py-1.5",
|
|
274
|
+
index > 0 && "border-t border-theme-border/60",
|
|
258
275
|
)}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
276
|
+
>
|
|
277
|
+
<StatusDot
|
|
278
|
+
tone={mapHealthToTone(
|
|
279
|
+
owned.issue ? "unhealthy" : (owned.status ?? ""),
|
|
280
|
+
)}
|
|
281
|
+
className="shrink-0"
|
|
282
|
+
/>
|
|
283
|
+
<Badge tone="structural" size="sm">
|
|
284
|
+
{owned.kind}
|
|
285
|
+
</Badge>
|
|
286
|
+
<span className="min-w-0 flex-1">
|
|
287
|
+
<span className="block truncate font-mono text-xs">
|
|
288
|
+
<ResourceLink
|
|
289
|
+
name={owned.name}
|
|
290
|
+
kind={owned.kind}
|
|
291
|
+
namespace={owned.namespace}
|
|
292
|
+
group={
|
|
293
|
+
owned.apiVersion
|
|
294
|
+
? apiVersionToGroup(owned.apiVersion)
|
|
295
|
+
: undefined
|
|
296
|
+
}
|
|
297
|
+
label={`${owned.namespace ? `${owned.namespace}/` : ""}${owned.name}`}
|
|
298
|
+
onNavigate={
|
|
299
|
+
owned.apiVersion && onOpenResource && !unread
|
|
300
|
+
? (ref) => onOpenResource(ref)
|
|
301
|
+
: undefined
|
|
302
|
+
}
|
|
303
|
+
/>
|
|
286
304
|
</span>
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
305
|
+
{owned.issue ? (
|
|
306
|
+
<span className="block truncate text-xs text-warning-text">
|
|
307
|
+
{owned.issue}
|
|
308
|
+
</span>
|
|
309
|
+
) : owned.summary || owned.message ? (
|
|
310
|
+
<span className="block truncate text-xs text-theme-text-tertiary">
|
|
311
|
+
{owned.summary || owned.message}
|
|
312
|
+
</span>
|
|
313
|
+
) : null}
|
|
314
|
+
</span>
|
|
315
|
+
{unread ? (
|
|
316
|
+
<Badge
|
|
317
|
+
severity="neutral"
|
|
318
|
+
size="sm"
|
|
319
|
+
className="ml-auto shrink-0"
|
|
320
|
+
>
|
|
321
|
+
{unread}
|
|
322
|
+
</Badge>
|
|
323
|
+
) : owned.ready || owned.status ? (
|
|
324
|
+
<span className="ml-auto shrink-0 font-mono text-xs text-theme-text-tertiary">
|
|
325
|
+
{owned.ready || owned.status}
|
|
290
326
|
</span>
|
|
291
327
|
) : null}
|
|
292
|
-
</
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
{owned.ready || owned.status}
|
|
296
|
-
</span>
|
|
297
|
-
) : null}
|
|
298
|
-
</div>
|
|
299
|
-
))}
|
|
328
|
+
</div>
|
|
329
|
+
);
|
|
330
|
+
})}
|
|
300
331
|
</div>
|
|
301
332
|
) : null}
|
|
302
333
|
</div>
|
|
@@ -264,6 +264,8 @@ export interface InvestigationHelmOwnedResource {
|
|
|
264
264
|
message?: string;
|
|
265
265
|
summary?: string;
|
|
266
266
|
issue?: string;
|
|
267
|
+
/** Why the caller isn't shown this object's live status (a read code). */
|
|
268
|
+
statusUnread?: string;
|
|
267
269
|
}
|
|
268
270
|
export interface InvestigationHelmRelease {
|
|
269
271
|
name: string;
|
|
@@ -280,6 +282,9 @@ export interface InvestigationHelmRelease {
|
|
|
280
282
|
resourceHealth?: string;
|
|
281
283
|
healthIssue?: string;
|
|
282
284
|
healthSummary?: string;
|
|
285
|
+
/** Workloads and Pods whose live status wasn't read. */
|
|
286
|
+
statusUnreadCount?: number;
|
|
287
|
+
managedByFlux?: boolean;
|
|
283
288
|
managedByFluxHelmRelease?: string;
|
|
284
289
|
lastOperation?: InvestigationHelmOperation;
|
|
285
290
|
resources: InvestigationHelmOwnedResource[];
|
|
@@ -309,6 +309,26 @@ describe("metricsChangeMarkers", () => {
|
|
|
309
309
|
]);
|
|
310
310
|
});
|
|
311
311
|
|
|
312
|
+
it("never follows a referenced Secret the caller may not read", () => {
|
|
313
|
+
const secretChange = change("Secret", "api-secret", "2026-09-06T07:40:00Z");
|
|
314
|
+
const bundle = (state?: "denied" | "access_unverified") => ({
|
|
315
|
+
...diagnoseBundle,
|
|
316
|
+
resourceContext: {
|
|
317
|
+
...diagnoseBundle.resourceContext,
|
|
318
|
+
uses: {
|
|
319
|
+
...diagnoseBundle.resourceContext.uses,
|
|
320
|
+
secrets: [{ kind: "Secret", namespace: "shop", name: "api-secret", ...(state ? { state } : {}) }],
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
recentChanges: [...diagnoseBundle.recentChanges, secretChange],
|
|
324
|
+
});
|
|
325
|
+
const labels = (state?: "denied" | "access_unverified") =>
|
|
326
|
+
markersFor([[tool("diag", "diagnose", bundle(state)), tool("prom", "query_prometheus", rangeResult(targetSelectors))]], "prom").map((m) => m.label);
|
|
327
|
+
expect(labels()).toContain("Secret api-secret");
|
|
328
|
+
expect(labels("denied")).not.toContain("Secret api-secret");
|
|
329
|
+
expect(labels("access_unverified")).not.toContain("Secret api-secret");
|
|
330
|
+
});
|
|
331
|
+
|
|
312
332
|
it("excludes a sibling workload's change even from a target-scoped change query", () => {
|
|
313
333
|
const markers = markersFor(
|
|
314
334
|
[
|
|
@@ -258,7 +258,8 @@ function producerRelatives(
|
|
|
258
258
|
};
|
|
259
259
|
if (!sameResource(ref, subject)) break;
|
|
260
260
|
const uses = data.resourceContext?.uses;
|
|
261
|
-
|
|
261
|
+
// A reference the caller may not read is named only; its history isn't theirs to follow.
|
|
262
|
+
relatives.push(...[...(uses?.configMaps ?? []), ...(uses?.secrets ?? [])].filter((r) => !r.state));
|
|
262
263
|
if (data.resourceContext?.owner) {
|
|
263
264
|
relatives.push(data.resourceContext.owner);
|
|
264
265
|
}
|
|
@@ -5,6 +5,7 @@ interface LogsTabProps {
|
|
|
5
5
|
podName: string
|
|
6
6
|
containers: string[]
|
|
7
7
|
initialContainer?: string
|
|
8
|
+
initContainers?: string[]
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export function LogsTab({
|
|
@@ -12,6 +13,7 @@ export function LogsTab({
|
|
|
12
13
|
podName,
|
|
13
14
|
containers,
|
|
14
15
|
initialContainer,
|
|
16
|
+
initContainers,
|
|
15
17
|
}: LogsTabProps) {
|
|
16
18
|
return (
|
|
17
19
|
<div className="h-full">
|
|
@@ -20,6 +22,7 @@ export function LogsTab({
|
|
|
20
22
|
podName={podName}
|
|
21
23
|
containers={containers}
|
|
22
24
|
initialContainer={initialContainer}
|
|
25
|
+
initContainers={initContainers}
|
|
23
26
|
/>
|
|
24
27
|
</div>
|
|
25
28
|
)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { QueryClient, QueryClientProvider, useQuery } from '@tanstack/react-query'
|
|
5
|
+
import { expect, it, vi } from 'vitest'
|
|
6
|
+
import { useTerminalCopyOnSelect } from '../../../../packages/k8s-ui/src/components/dock/terminalPreferences'
|
|
7
|
+
import { TerminalPreferences } from './TerminalPreferences'
|
|
8
|
+
|
|
9
|
+
const { request } = vi.hoisted(() => ({ request: vi.fn<(signal: AbortSignal) => Promise<{ authEnabled: boolean; username: string }>>() }))
|
|
10
|
+
vi.mock('../../api/client', () => ({
|
|
11
|
+
useAuthMe: () => useQuery({
|
|
12
|
+
queryKey: ['auth-me'], queryFn: ({ signal }) => request(signal), staleTime: 300000,
|
|
13
|
+
}),
|
|
14
|
+
}))
|
|
15
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
16
|
+
|
|
17
|
+
it('does not verify cached success when removeQueries cancels an account recheck', async () => {
|
|
18
|
+
const responses: Array<(value: { authEnabled: boolean; username: string }) => void> = []
|
|
19
|
+
request.mockImplementation((signal: AbortSignal) => new Promise((resolve, reject) => {
|
|
20
|
+
responses.push(resolve)
|
|
21
|
+
signal.addEventListener('abort', () => reject(new DOMException('Aborted', 'AbortError')), { once: true })
|
|
22
|
+
}))
|
|
23
|
+
let clock = 1000
|
|
24
|
+
const now = vi.spyOn(Date, 'now').mockImplementation(() => clock)
|
|
25
|
+
const client = new QueryClient({ defaultOptions: { queries: { retry: false, refetchOnWindowFocus: false } } })
|
|
26
|
+
client.setQueryData(['auth-me'], { authEnabled: true, username: 'owned-query-a' })
|
|
27
|
+
localStorage.setItem('radar:terminal:copy-on-select:account:owned-query-a', 'true')
|
|
28
|
+
const root = createRoot(document.createElement('div'))
|
|
29
|
+
let preference: ReturnType<typeof useTerminalCopyOnSelect> | undefined
|
|
30
|
+
function Terminal() { preference = useTerminalCopyOnSelect(); return null }
|
|
31
|
+
try {
|
|
32
|
+
await act(async () => root.render(<QueryClientProvider client={client}><TerminalPreferences><Terminal /></TerminalPreferences></QueryClientProvider>))
|
|
33
|
+
clock = 2000
|
|
34
|
+
await act(async () => responses.shift()?.({ authEnabled: true, username: 'owned-query-a' }))
|
|
35
|
+
expect(preference?.getState()).toBe('on')
|
|
36
|
+
clock = 3000
|
|
37
|
+
await act(async () => window.dispatchEvent(new Event('focus')))
|
|
38
|
+
expect(preference?.getState()).toBe('pending')
|
|
39
|
+
expect(request).toHaveBeenCalledTimes(2)
|
|
40
|
+
clock = 3100
|
|
41
|
+
await act(async () => client.removeQueries({ queryKey: ['auth-me'] }))
|
|
42
|
+
expect(preference?.getState()).toBe('pending')
|
|
43
|
+
expect(preference?.available).toBe(false)
|
|
44
|
+
expect(request.mock.calls.length).toBeGreaterThanOrEqual(3)
|
|
45
|
+
responses.shift()
|
|
46
|
+
clock = 4000
|
|
47
|
+
await act(async () => responses.shift()?.({ authEnabled: true, username: 'owned-query-b' }))
|
|
48
|
+
expect(preference?.available).toBe(true)
|
|
49
|
+
expect(preference?.getState()).toBe('off')
|
|
50
|
+
} finally {
|
|
51
|
+
await act(async () => root.unmount())
|
|
52
|
+
client.clear()
|
|
53
|
+
now.mockRestore()
|
|
54
|
+
request.mockReset()
|
|
55
|
+
localStorage.clear()
|
|
56
|
+
}
|
|
57
|
+
})
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { expect, it, vi } from 'vitest'
|
|
5
|
+
import { useTerminalCopyOnSelect } from '../../../../packages/k8s-ui/src/components/dock/terminalPreferences'
|
|
6
|
+
import { TerminalPreferences } from './TerminalPreferences'
|
|
7
|
+
|
|
8
|
+
const { refetch } = vi.hoisted(() => ({ refetch: vi.fn() }))
|
|
9
|
+
vi.mock('../../api/client', () => ({ useAuthMe: () => ({ refetch }) }))
|
|
10
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
11
|
+
|
|
12
|
+
interface Result {
|
|
13
|
+
data?: { authEnabled: boolean; username?: string }
|
|
14
|
+
isSuccess: boolean
|
|
15
|
+
isError: boolean
|
|
16
|
+
fetchStatus: 'idle'
|
|
17
|
+
dataUpdatedAt: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
it('blocks an existing terminal immediately on focus or visibility changes until the fresh account scope is applied', async () => {
|
|
21
|
+
const responses: Array<(value: Result) => void> = []
|
|
22
|
+
refetch.mockImplementation(() => new Promise<Result>(resolve => responses.push(resolve)))
|
|
23
|
+
const root = createRoot(document.createElement('div'))
|
|
24
|
+
let preference: ReturnType<typeof useTerminalCopyOnSelect> | undefined
|
|
25
|
+
function Terminal() { preference = useTerminalCopyOnSelect(); return null }
|
|
26
|
+
localStorage.setItem('radar:terminal:copy-on-select:account:owned-a', 'true')
|
|
27
|
+
try {
|
|
28
|
+
await act(async () => root.render(<TerminalPreferences><Terminal /></TerminalPreferences>))
|
|
29
|
+
await act(async () => responses.shift()?.({ data: { authEnabled: true, username: 'owned-a' }, isSuccess: true, isError: false, fetchStatus: 'idle', dataUpdatedAt: Date.now() }))
|
|
30
|
+
const connectedGetter = preference?.getState
|
|
31
|
+
expect(connectedGetter?.()).toBe('on')
|
|
32
|
+
await act(async () => {
|
|
33
|
+
window.dispatchEvent(new Event('focus'))
|
|
34
|
+
expect(connectedGetter?.()).toBe('pending')
|
|
35
|
+
preference?.setEnabled(false)
|
|
36
|
+
expect(localStorage.getItem('radar:terminal:copy-on-select:account:owned-a')).toBe('true')
|
|
37
|
+
})
|
|
38
|
+
expect(preference?.available).toBe(false)
|
|
39
|
+
await act(async () => window.dispatchEvent(new Event('blur')))
|
|
40
|
+
await act(async () => responses.shift()?.({ data: { authEnabled: true, username: 'owned-a' }, isSuccess: true, isError: false, fetchStatus: 'idle', dataUpdatedAt: Date.now() }))
|
|
41
|
+
expect(connectedGetter?.()).toBe('pending')
|
|
42
|
+
expect(preference?.available).toBe(false)
|
|
43
|
+
await act(async () => window.dispatchEvent(new Event('focus')))
|
|
44
|
+
await act(async () => responses.shift()?.({ data: { authEnabled: true, username: 'owned-b' }, isSuccess: true, isError: false, fetchStatus: 'idle', dataUpdatedAt: Date.now() }))
|
|
45
|
+
expect(preference?.available).toBe(true)
|
|
46
|
+
expect(connectedGetter?.()).toBe('off')
|
|
47
|
+
await act(async () => preference?.setEnabled(true))
|
|
48
|
+
expect(connectedGetter?.()).toBe('on')
|
|
49
|
+
Object.defineProperty(document, 'visibilityState', { configurable: true, value: 'hidden' })
|
|
50
|
+
await act(async () => {
|
|
51
|
+
document.dispatchEvent(new Event('visibilitychange'))
|
|
52
|
+
expect(connectedGetter?.()).toBe('pending')
|
|
53
|
+
})
|
|
54
|
+
Object.defineProperty(document, 'visibilityState', { configurable: true, value: 'visible' })
|
|
55
|
+
await act(async () => document.dispatchEvent(new Event('visibilitychange')))
|
|
56
|
+
expect(connectedGetter?.()).toBe('pending')
|
|
57
|
+
await act(async () => responses.shift()?.({ isSuccess: false, isError: true, fetchStatus: 'idle', dataUpdatedAt: 0 }))
|
|
58
|
+
expect(preference?.available).toBe(false)
|
|
59
|
+
expect(connectedGetter?.()).toBe('pending')
|
|
60
|
+
expect(preference?.unavailableReason).toContain('Could not load account information')
|
|
61
|
+
expect(preference?.unavailableReason).toContain('Switch to another tab or window and back to retry')
|
|
62
|
+
} finally {
|
|
63
|
+
await act(async () => root.unmount())
|
|
64
|
+
refetch.mockReset()
|
|
65
|
+
localStorage.clear()
|
|
66
|
+
Reflect.deleteProperty(document, 'visibilityState')
|
|
67
|
+
}
|
|
68
|
+
})
|