@skyhook-io/radar-app 1.18.0 → 1.18.2
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/README.md +6 -0
- package/package.json +2 -3
- package/src/App.tsx +43 -12
- package/src/api/client.deleteResource.test.tsx +111 -0
- package/src/api/client.gitops-destination.test.tsx +55 -0
- package/src/api/client.resource-list.test.ts +76 -0
- package/src/api/client.resourceAudit.test.tsx +57 -0
- package/src/api/client.resourcePath.test.ts +107 -0
- package/src/api/client.ts +197 -57
- package/src/api/quotas.ts +9 -20
- package/src/api/radarFeatures.ts +2 -0
- package/src/api/resourceLists.test.ts +84 -0
- package/src/api/resourceLists.ts +71 -0
- package/src/components/capacity/CapacityDemand.tsx +6 -3
- package/src/components/capacity/CapacityOverview.tsx +14 -7
- package/src/components/capacity/CapacityPoolDetail.tsx +7 -5
- package/src/components/capacity/ClusterSchedulingCard.tsx +3 -3
- package/src/components/capacity/shared.tsx +9 -5
- package/src/components/cnpg/CNPGOverview.tsx +4 -1
- package/src/components/cnpg/CNPGView.tsx +1 -0
- package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +1 -0
- package/src/components/compare/CompareResourcePicker.test.tsx +58 -0
- package/src/components/compare/CompareViewRoute.tsx +5 -1
- package/src/components/compare/useCompareCandidates.ts +1 -1
- package/src/components/compare/useCompareLauncher.tsx +4 -2
- package/src/components/diagnose/ApplyDialog.test.tsx +10 -0
- package/src/components/diagnose/ApplyDialog.tsx +8 -1
- package/src/components/diagnose/AssessmentCard.tsx +60 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +5 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +62 -2
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +6 -5
- package/src/components/diagnose/InvestigationView.tsx +47 -13
- package/src/components/diagnose/StoryExcerpt.tsx +24 -5
- package/src/components/diagnose/assessmentCopy.ts +11 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +36 -1
- package/src/components/diagnose/investigationEvidence/adapters/crossplane.test.tsx +85 -0
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +1 -0
- package/src/components/diagnose/investigationEvidence/adapters/listCoverage.test.ts +415 -0
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/resource.ts +107 -8
- package/src/components/diagnose/investigationEvidence/adapters/testdata/crossplane-paused-get-resource.json +28 -0
- package/src/components/diagnose/investigationEvidence/bodies/index.tsx +2 -0
- package/src/components/diagnose/investigationEvidence/bodies/inventory.tsx +66 -16
- package/src/components/diagnose/investigationEvidence/bodies/workload.tsx +5 -1
- package/src/components/diagnose/investigationEvidence/builder.ts +16 -2
- package/src/components/diagnose/investigationEvidence/cardParts.tsx +7 -2
- package/src/components/diagnose/investigationEvidence/excerpt.ts +2 -0
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/observations.ts +8 -3
- package/src/components/diagnose/investigationEvidence/projection.test.ts +81 -4
- package/src/components/diagnose/investigationEvidence/types.ts +15 -0
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +36 -2
- package/src/components/diagnose/investigationEvidencePresentation.ts +33 -8
- package/src/components/diagnose/storyParts.test.tsx +53 -0
- package/src/components/diagnose/toolCallLabel.test.ts +9 -0
- package/src/components/diagnose/toolCallLabel.ts +2 -0
- package/src/components/execution/BatchExecutionView.image-browse.test.tsx +46 -0
- package/src/components/execution/BatchExecutionView.tsx +6 -4
- package/src/components/gitops/GitOpsView.identity.test.tsx +113 -0
- package/src/components/gitops/GitOpsView.tsx +62 -40
- package/src/components/gitops/useDestinationCluster.ts +2 -1
- package/src/components/helm/ArtifactHubSourceSearch.test.tsx +124 -0
- package/src/components/helm/ArtifactHubSourceSearch.tsx +240 -0
- package/src/components/helm/ChartBrowser.tsx +9 -8
- package/src/components/helm/HelmReleaseDrawer.tsx +6 -2
- package/src/components/helm/HelmView.tsx +34 -23
- package/src/components/helm/InstallWizard.tsx +6 -2
- package/src/components/helm/TrackChartSourceDialog.render.test.tsx +269 -96
- package/src/components/helm/TrackChartSourceDialog.tsx +607 -104
- package/src/components/helm/ValuesViewer.test.tsx +1 -0
- package/src/components/helm/ValuesViewer.tsx +4 -2
- package/src/components/home/ClusterHealthCard.tsx +28 -21
- package/src/components/home/MCPSetupDialog.test.tsx +27 -2
- package/src/components/home/MCPSetupDialog.tsx +14 -2
- package/src/components/home/mcpToolCatalog.ts +39 -2
- package/src/components/issues/IssuesPane.render.test.tsx +5 -5
- package/src/components/nav/PrimaryNavRail.tsx +34 -2
- package/src/components/product-hunt/ProductHuntNotice.render.test.tsx +120 -0
- package/src/components/product-hunt/ProductHuntNotice.test.ts +121 -0
- package/src/components/product-hunt/ProductHuntNotice.tsx +202 -0
- package/src/components/product-hunt/launchWindow.ts +78 -0
- package/src/components/product-hunt/useProductHuntRailEntry.test.tsx +76 -0
- package/src/components/product-hunt/useProductHuntRailEntry.ts +27 -0
- package/src/components/resource/PrometheusCharts.overlays.test.ts +45 -0
- package/src/components/resource/PrometheusCharts.tsx +2 -2
- package/src/components/resources/CompositeRenderer.tsx +4 -0
- package/src/components/resources/ResourcesView.tsx +30 -68
- package/src/components/resources/renderers/PodRenderer.tsx +4 -1
- package/src/components/settings/LocalConnectionSettings.tsx +1 -0
- package/src/components/settings/MyPermissionsDialog.tsx +12 -9
- package/src/components/traffic/TrafficSourcePill.test.tsx +110 -0
- package/src/components/traffic/TrafficSourcePill.tsx +111 -0
- package/src/components/traffic/TrafficView.tsx +9 -55
- package/src/components/ui/DiagnosticsOverlay.test.ts +25 -0
- package/src/components/ui/DiagnosticsOverlay.tsx +2 -1
- package/src/components/ui/Omnibar.note.test.tsx +141 -0
- package/src/components/ui/Omnibar.tsx +82 -18
- package/src/components/ui/RadarOmnibar.test.tsx +201 -0
- package/src/components/ui/RadarOmnibar.tsx +39 -4
- package/src/components/ui/SearchSyntaxHelp.test.tsx +39 -0
- package/src/components/ui/SearchSyntaxHelp.tsx +23 -2
- package/src/components/ui/UpdateNotification.manual.test.tsx +177 -0
- package/src/components/ui/UpdateNotification.test.tsx +4 -1
- package/src/components/ui/UpdateNotification.tsx +61 -10
- package/src/components/ui/omnibar-match.test.ts +15 -8
- package/src/components/ui/omnibar-match.ts +11 -6
- package/src/components/ui/searchCoverage.fixtures.ts +16 -0
- package/src/components/ui/searchCoverageNote.test.ts +245 -0
- package/src/components/ui/searchCoverageNote.ts +222 -0
- package/src/components/usage-data/UsageDataPrompt.tsx +19 -1
- package/src/components/whats-new/WhatsNew.test.ts +10 -0
- package/src/components/whats-new/WhatsNew.tsx +5 -4
- package/src/components/whats-new/WhatsNewDialog.test.tsx +20 -0
- package/src/components/whats-new/releaseNotes.ts +57 -5
- package/src/components/workload/WorkloadView.tsx +18 -6
- package/src/components/workspace/layout.tsx +2 -1
- package/src/contexts/CapabilitiesContext.tsx +1 -0
- package/src/hooks/useGitOpsWriteGuard.test.tsx +126 -2
- package/src/hooks/useGitOpsWriteGuard.ts +25 -3
- package/src/hooks/useResolvedGitOpsOwner.ts +14 -9
- package/src/hooks/useResourceCounts.ts +2 -0
- package/src/index.css +87 -4
- package/src/index.ts +7 -0
- package/src/utils/artifacthub.test.ts +18 -0
- package/src/utils/artifacthub.ts +9 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LucideIcon } from 'lucide-react'
|
|
2
|
-
import { Bot, Database, GitCompareArrows, HardDrive, Hourglass, Layers, Network, RefreshCcw, Scale, ScrollText, SlidersHorizontal, Undo2 } from 'lucide-react'
|
|
2
|
+
import { Bot, Database, GitCompareArrows, HardDrive, Hourglass, Layers, Network, RefreshCcw, Scale, ScrollText, Search, SlidersHorizontal, Undo2 } from 'lucide-react'
|
|
3
3
|
import { compareVersions } from '../../utils/version'
|
|
4
4
|
|
|
5
5
|
export interface ReleaseHighlight {
|
|
@@ -41,12 +41,65 @@ export interface ReleaseNotes {
|
|
|
41
41
|
|
|
42
42
|
export const CHANGELOG_URL = 'https://radarhq.io/changelog'
|
|
43
43
|
|
|
44
|
+
// Read .agents/skills/whats-new/SKILL.md before authoring or regrouping notes.
|
|
44
45
|
// One entry per release that has something to announce. A user sees the
|
|
45
46
|
// entries for the releases they haven't seen yet, composed into one dialog, so
|
|
46
47
|
// a patch upgrade, or one that skips releases, still gets them. Every minor and
|
|
47
48
|
// major release must have its own entry: scripts/check-whats-new.sh refuses to
|
|
48
49
|
// release one without it.
|
|
49
50
|
export const RELEASE_NOTES: ReleaseNotes[] = [
|
|
51
|
+
{
|
|
52
|
+
version: 'v1.18.0',
|
|
53
|
+
highlights: [
|
|
54
|
+
{
|
|
55
|
+
id: 'trivy-cve-search',
|
|
56
|
+
icon: Search,
|
|
57
|
+
title: 'Investigate CVEs across your cluster',
|
|
58
|
+
description: 'Search Trivy findings by CVE, package or image, including in resource tables. MCP agents can inventory declared runtime versions.',
|
|
59
|
+
leadDescription: 'With Trivy Operator installed, search globally or within report tables by CVE, package, failed check ID or image to find matching scan reports, then open a report for installed and fixed package versions. Partial searches say what could not be checked. MCP agents can also inventory runtime versions declared by running images and compare supported versions with a fixed release. Missing or unreadable declarations stay unknown; image metadata does not verify a fix.',
|
|
60
|
+
importance: 8,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'mcp-guidance-waits-controls',
|
|
64
|
+
icon: Bot,
|
|
65
|
+
title: 'More capable agents through MCP',
|
|
66
|
+
description: 'MCP agents get built-in tool guidance and can wait for rollouts, readiness or deletion. An optional read-only mode exposes only read tools.',
|
|
67
|
+
importance: 5,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'investigation-change-evidence',
|
|
71
|
+
icon: GitCompareArrows,
|
|
72
|
+
title: 'See more of what changed',
|
|
73
|
+
description: 'Investigations show more spec edits, NetworkPolicy changes, Secret rotations and stale env readers, and flag incomplete history.',
|
|
74
|
+
importance: 5,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'workload-blockers',
|
|
78
|
+
icon: Network,
|
|
79
|
+
title: 'Better issue detection and warnings',
|
|
80
|
+
description: 'Issues catch more network, storage and scheduling problems, add diagnostic context, and flag checks that could not complete.',
|
|
81
|
+
importance: 5,
|
|
82
|
+
path: '/issues',
|
|
83
|
+
cta: 'Open Issues',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'log-viewer-improvements',
|
|
87
|
+
icon: ScrollText,
|
|
88
|
+
title: 'Log viewer improvements',
|
|
89
|
+
description: 'Keep your place in fast-moving logs, select text without auto-scroll, and wait for containers to start with clearer status messages.',
|
|
90
|
+
importance: 4,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
improvements: [
|
|
94
|
+
'Resource tables remember your column order for each kind',
|
|
95
|
+
'Open terminals and browse files in native sidecars',
|
|
96
|
+
'Node drains keep results visible and name remaining Pods',
|
|
97
|
+
'Audits recognize shared Pod CPU and memory budgets',
|
|
98
|
+
'Helm upgrades need a confirmed source; find public sources on ArtifactHub',
|
|
99
|
+
'Prometheus reconnects automatically when it appears',
|
|
100
|
+
'Argo CD views confirm when a local resource is missing',
|
|
101
|
+
],
|
|
102
|
+
},
|
|
50
103
|
{
|
|
51
104
|
version: 'v1.17.0',
|
|
52
105
|
highlights: [
|
|
@@ -217,7 +270,7 @@ export function releaseNotesFor(
|
|
|
217
270
|
): ReleaseNotes | undefined {
|
|
218
271
|
if (!version) return undefined
|
|
219
272
|
const normalized = version.startsWith('v') ? version : `v${version}`
|
|
220
|
-
return catalog.find(notes => notes.version === normalized)
|
|
273
|
+
return catalog.find(notes => notes.version === normalized || releaseLine(notes.version) === normalized)
|
|
221
274
|
}
|
|
222
275
|
|
|
223
276
|
/** The release line a catalog entry covers, e.g. v1.15 for v1.15.0: its patches show the same notes. */
|
|
@@ -264,9 +317,8 @@ export function unreadReleases(
|
|
|
264
317
|
export const RELEASE_WEIGHTS = [1, 0.75, 0.5]
|
|
265
318
|
export const MAX_CARDS = 5
|
|
266
319
|
export const MAX_LINES = 8
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
|
-
// features, or a skipped release with them, opens it.
|
|
320
|
+
// A fuller set of useful improvements can merit an announcement even without
|
|
321
|
+
// a single release-defining feature.
|
|
270
322
|
export const AUTO_OPEN_SCORE = 25
|
|
271
323
|
|
|
272
324
|
export interface ComposedHighlight extends ReleaseHighlight {
|
|
@@ -295,6 +295,7 @@ function useActionsBarProps(
|
|
|
295
295
|
cascadeEnabled: boolean,
|
|
296
296
|
nodeUID: string,
|
|
297
297
|
) {
|
|
298
|
+
const [deletePreviewOpen, setDeletePreviewOpen] = useState(false)
|
|
298
299
|
const { showCopied } = useToast()
|
|
299
300
|
const { features } = useCapabilitiesContext()
|
|
300
301
|
const openTerminal = useOpenTerminal()
|
|
@@ -359,14 +360,14 @@ function useActionsBarProps(
|
|
|
359
360
|
|
|
360
361
|
const {
|
|
361
362
|
data: cascadePreview,
|
|
362
|
-
|
|
363
|
+
isFetching: cascadeLoading,
|
|
363
364
|
isError: cascadeError,
|
|
364
365
|
} = useCascadeDeletePreview(
|
|
365
366
|
kind,
|
|
366
367
|
namespace,
|
|
367
368
|
name,
|
|
368
369
|
group,
|
|
369
|
-
cascadeEnabled,
|
|
370
|
+
cascadeEnabled && deletePreviewOpen,
|
|
370
371
|
)
|
|
371
372
|
|
|
372
373
|
const canNodeWrite = useCanNodeWrite()
|
|
@@ -403,8 +404,10 @@ function useActionsBarProps(
|
|
|
403
404
|
onDelete: (
|
|
404
405
|
params: Parameters<typeof deleteMutation.mutate>[0],
|
|
405
406
|
callbacks?: { onSuccess?: () => void },
|
|
406
|
-
) => deleteMutation.mutate(params, { onSuccess: callbacks?.onSuccess }),
|
|
407
|
+
) => deleteMutation.mutate(params, { onSuccess: result => { if (!result.outcomeUnknown) callbacks?.onSuccess?.() } }),
|
|
407
408
|
isDeleting: deleteMutation.isPending,
|
|
409
|
+
onDeletePreviewOpenChange: setDeletePreviewOpen,
|
|
410
|
+
cascadeDetail: cascadePreview,
|
|
408
411
|
cascadeDependents: cascadePreview?.dependents,
|
|
409
412
|
cascadeLoading,
|
|
410
413
|
cascadeRootResolved: cascadePreview?.rootResolved,
|
|
@@ -816,6 +819,11 @@ export function WorkloadView({
|
|
|
816
819
|
const liveIssues = useCronJobCoverage ? cronJobIssues.data?.issues : ordinaryIssues.data
|
|
817
820
|
const issuesPending = useCronJobCoverage ? cronJobIssues.isPending : ordinaryIssues.isPending
|
|
818
821
|
const schedulingEvidence = cronJobIssues.data?.scheduling_report?.uid === resource?.metadata?.uid ? cronJobIssues.data?.scheduling_report : undefined
|
|
822
|
+
const [schedulingTimelineFocus, setSchedulingTimelineFocus] = useState<{ uid: string; id: string }>()
|
|
823
|
+
const viewSchedulingReport = useCallback(() => {
|
|
824
|
+
setSchedulingTimelineFocus(schedulingEvidence?.event_id ? { uid: schedulingEvidence.uid, id: schedulingEvidence.event_id } : undefined)
|
|
825
|
+
handleTabChange('timeline')
|
|
826
|
+
}, [schedulingEvidence, handleTabChange])
|
|
819
827
|
const { data: auditFindings } = useResourceAudit(apiKind, namespace, name, effectiveGroup)
|
|
820
828
|
const hasOperationalIssues = Boolean(liveIssues?.length)
|
|
821
829
|
const {
|
|
@@ -1022,6 +1030,7 @@ export function WorkloadView({
|
|
|
1022
1030
|
guard: imageGuard,
|
|
1023
1031
|
onSelectionChange: setImageSelection,
|
|
1024
1032
|
selectionKey: setImageSelectionKey(imageSelection),
|
|
1033
|
+
onOpenManager: handleOpenGitOpsResource,
|
|
1025
1034
|
onOpenOwner: owner
|
|
1026
1035
|
? imageOwnerVerified
|
|
1027
1036
|
? () => handleOpenGitOpsResource(owner)
|
|
@@ -1162,6 +1171,7 @@ export function WorkloadView({
|
|
|
1162
1171
|
refetch={refetchResourceAndRuns}
|
|
1163
1172
|
// Timeline
|
|
1164
1173
|
allEvents={allEvents}
|
|
1174
|
+
timelineFocusEvent={schedulingTimelineFocus?.uid === resource?.metadata?.uid ? schedulingTimelineFocus : undefined}
|
|
1165
1175
|
historyTruncated={!historyFallback && historyTruncated}
|
|
1166
1176
|
onLoadOlderHistory={historyFallback ? undefined : loadOlderHistory}
|
|
1167
1177
|
loadingOlderHistory={!historyFallback && loadingOlderHistory}
|
|
@@ -1298,10 +1308,10 @@ export function WorkloadView({
|
|
|
1298
1308
|
}}
|
|
1299
1309
|
renderOverviewLead={() => (
|
|
1300
1310
|
<div className="flex flex-col gap-4">
|
|
1301
|
-
<CronJobSchedulingContext evidence={schedulingEvidence} onViewTimeline={
|
|
1311
|
+
<CronJobSchedulingContext evidence={schedulingEvidence} onViewTimeline={viewSchedulingReport} />
|
|
1302
1312
|
<ResourceIssuesSection
|
|
1303
1313
|
issues={liveIssues}
|
|
1304
|
-
renderDetailSection={schedulingEvidence?.state === 'reported' ? ({ issue }) => issue.kind === 'CronJob' && issue.reason === schedulingEvidence.reason ? <CronJobSchedulingDetails evidence={schedulingEvidence} onViewTimeline={
|
|
1314
|
+
renderDetailSection={schedulingEvidence?.state === 'reported' ? ({ issue }) => issue.kind === 'CronJob' && issue.reason === schedulingEvidence.reason ? <CronJobSchedulingDetails evidence={schedulingEvidence} onViewTimeline={viewSchedulingReport} /> : null : undefined}
|
|
1305
1315
|
compact={!expanded}
|
|
1306
1316
|
subjectResource={{ kind: apiKind, namespace, name, group: rest.group }}
|
|
1307
1317
|
onResourceClick={
|
|
@@ -1321,7 +1331,9 @@ export function WorkloadView({
|
|
|
1321
1331
|
hasOverviewLead={hasOperationalIssues || Boolean(schedulingEvidence && schedulingEvidence.state !== 'reported')}
|
|
1322
1332
|
hasOperationalIssues={hasOperationalIssues}
|
|
1323
1333
|
operationalIssuesPending={issuesPending}
|
|
1324
|
-
|
|
1334
|
+
// A manager answer's chip links only managers the server found; a
|
|
1335
|
+
// disagreement has no lead, so no owner object, but its managers link.
|
|
1336
|
+
onOpenGitOpsResource={gitopsOwnerObject || relationships?.ownership?.manager ? handleOpenGitOpsResource : undefined}
|
|
1325
1337
|
resolvedGitOpsOwner={gitopsOwner}
|
|
1326
1338
|
gitOpsOwnerVerified={gitOpsOwnerVerified}
|
|
1327
1339
|
gitOpsOwnerPending={gitOpsOwnerPending}
|
|
@@ -30,7 +30,8 @@ export function ScreenEmptyState({
|
|
|
30
30
|
}) {
|
|
31
31
|
return (
|
|
32
32
|
<div className="flex min-h-0 flex-1 items-center justify-center bg-theme-base p-6">
|
|
33
|
-
|
|
33
|
+
{/* Phones: shrink to the screen so wide content (YAML) scrolls inside itself. */}
|
|
34
|
+
<div className="max-w-md text-center phone:w-full phone:min-w-0">
|
|
34
35
|
<Icon className="mx-auto h-9 w-9 text-theme-text-tertiary/50" />
|
|
35
36
|
<h2 className="mt-3 text-lg font-medium text-theme-text-primary">
|
|
36
37
|
{title}
|
|
@@ -5,18 +5,25 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
|
5
5
|
import { SetImageDialog, canConfirmGitOpsWrite, setImageSelectionKey, type WorkloadImageInventory } from '@skyhook-io/k8s-ui'
|
|
6
6
|
import { afterEach, expect, it, vi } from 'vitest'
|
|
7
7
|
import { useGitOpsWriteGuard, type GitOpsWriteGuardState } from './useGitOpsWriteGuard'
|
|
8
|
+
import { findInheritedGitOpsLookupRef } from './useResolvedGitOpsOwner'
|
|
8
9
|
|
|
9
10
|
const mocks = vi.hoisted(() => ({
|
|
10
11
|
applications: { data: undefined as unknown[] | undefined, isPending: true, isError: false },
|
|
11
12
|
inherited: { data: undefined as unknown, isPending: false, isError: false },
|
|
12
13
|
target: { data: undefined as unknown, relationships: undefined as unknown, isLoading: false, isError: false },
|
|
14
|
+
ownerObject: undefined as unknown,
|
|
15
|
+
resourceRead: vi.fn(),
|
|
16
|
+
resourceList: vi.fn(),
|
|
13
17
|
evidence: vi.fn(),
|
|
14
18
|
evidenceUnsupported: false,
|
|
15
19
|
}))
|
|
16
20
|
vi.mock('../api/client', () => ({
|
|
17
|
-
useResource: (
|
|
21
|
+
useResource: (...args: unknown[]) => {
|
|
22
|
+
mocks.resourceRead(...args)
|
|
23
|
+
return args[0] === 'deployments' ? mocks.target : { data: args[0] ? mocks.ownerObject : undefined, isLoading: false, isError: false }
|
|
24
|
+
},
|
|
18
25
|
useResourceWithRelationships: () => mocks.inherited,
|
|
19
|
-
useResources: () => mocks.applications,
|
|
26
|
+
useResources: (...args: unknown[]) => { mocks.resourceList(...args); return mocks.applications },
|
|
20
27
|
useRadarFeature: () => ({
|
|
21
28
|
guard: async (fn: () => unknown) => {
|
|
22
29
|
if (!mocks.evidenceUnsupported) return fn()
|
|
@@ -36,6 +43,9 @@ afterEach(() => {
|
|
|
36
43
|
mocks.inherited = { data: undefined, isPending: false, isError: false }
|
|
37
44
|
mocks.target = { data: undefined, relationships: undefined, isLoading: false, isError: false }
|
|
38
45
|
mocks.evidence.mockReset()
|
|
46
|
+
mocks.ownerObject = undefined
|
|
47
|
+
mocks.resourceRead.mockReset()
|
|
48
|
+
mocks.resourceList.mockReset()
|
|
39
49
|
})
|
|
40
50
|
|
|
41
51
|
it.each(['resolved', 'failed', 'empty', 'ambiguous'])('waits for Argo Application namespace lookup before handling %s ownership', async (outcome) => {
|
|
@@ -455,3 +465,117 @@ it("doesn't hold Update for a host that reports the selection without judging it
|
|
|
455
465
|
host.remove()
|
|
456
466
|
}
|
|
457
467
|
})
|
|
468
|
+
|
|
469
|
+
const managerApp = { kind: 'Application', group: 'argoproj.io', namespace: 'argocd', name: 'server-app' }
|
|
470
|
+
const managerAnswer: import('@skyhook-io/k8s-ui').ManagerAnswer = { state: 'listed', lead: managerApp, direct: { object: deployment, recorders: [managerApp] } }
|
|
471
|
+
|
|
472
|
+
it.each(['disagree', 'shared', 'claimed'] as const)('fetches evidence for %s without a lead', async state => {
|
|
473
|
+
const manager = { ...managerAnswer, state, lead: undefined, direct: { object: deployment, recorders: state === 'claimed' ? [] : state === 'shared' ? [managerApp, { ...managerApp, name: 'second-recorder' }] : [managerApp], claims: [{ manager: { ...managerApp, name: 'claim' }, source: 'argo-instance-label' as const, check: 'omitted' as const }, ...(state === 'claimed' ? [{ manager: managerApp, source: 'argo-instance-label' as const, check: 'omitted' as const }] : [])] } }
|
|
474
|
+
mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: null, manager, policy: null, paths: [] })
|
|
475
|
+
const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager } }, writes: replicas })
|
|
476
|
+
try {
|
|
477
|
+
await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
|
|
478
|
+
expect(mocks.evidence).toHaveBeenCalledTimes(1)
|
|
479
|
+
expect(mocks.evidence.mock.calls[0][0].owner).toBeUndefined()
|
|
480
|
+
expect(h.ref.state!.guard?.requiresAck).toBe(true)
|
|
481
|
+
} finally { await h.cleanup() }
|
|
482
|
+
})
|
|
483
|
+
|
|
484
|
+
it('fetches via evidence and names the parent without acknowledgment', async () => {
|
|
485
|
+
const manager = { ...managerAnswer, direct: { object: pod }, via: managerAnswer.direct }
|
|
486
|
+
mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: managerApp, manager, policy: null, paths: [] })
|
|
487
|
+
const h = await renderGuard({ target: pod, resource: {}, relationships: { ownership: { children: { complete: true }, manager } }, writes: replicas })
|
|
488
|
+
try {
|
|
489
|
+
await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
|
|
490
|
+
expect(mocks.evidence).toHaveBeenCalledTimes(1)
|
|
491
|
+
expect(h.ref.state!.ownership.inheritedLookupRef).toBeNull()
|
|
492
|
+
expect(h.ref.state!.guard?.level).toBe('info')
|
|
493
|
+
expect(h.ref.state!.guard?.requiresAck).toBe(false)
|
|
494
|
+
expect(h.ref.state!.guard?.summary).toContain('Deployment prod/web')
|
|
495
|
+
} finally { await h.cleanup() }
|
|
496
|
+
})
|
|
497
|
+
|
|
498
|
+
it.each(['none', 'unknown', 'disagree', 'shared', 'claimed', 'listed'] as const)('adopts the server %s answer over a conflicting client lead', async state => {
|
|
499
|
+
const serverManager = { ...managerAnswer, state, lead: state === 'listed' ? managerApp : undefined, direct: { object: deployment } }
|
|
500
|
+
mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: managerApp, manager: serverManager, policy: null, paths: [] })
|
|
501
|
+
const clientManager = { ...managerAnswer, lead: { ...managerApp, name: 'stale-client' } }
|
|
502
|
+
const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager: clientManager } }, writes: replicas })
|
|
503
|
+
try {
|
|
504
|
+
await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
|
|
505
|
+
expect(h.ref.state!.ownership.manager).toEqual(serverManager)
|
|
506
|
+
expect(h.ref.state!.guard?.owner?.name ?? null).toBe(state === 'listed' ? 'server-app' : null)
|
|
507
|
+
expect(h.ref.state!.guard?.summary).not.toContain('stale-client')
|
|
508
|
+
if (state === 'none' || state === 'unknown') expect(h.ref.state!.guard?.level).toBe('none')
|
|
509
|
+
} finally { await h.cleanup() }
|
|
510
|
+
})
|
|
511
|
+
|
|
512
|
+
// A live answer naming another manager doesn't inherit the cached one's
|
|
513
|
+
// verification or status: a link to it would rest on a check of the old one.
|
|
514
|
+
it("doesn't carry the cached manager's verification to a different live manager", async () => {
|
|
515
|
+
mocks.ownerObject = { status: { sync: { status: 'Synced' }, health: { status: 'Healthy' } } }
|
|
516
|
+
const other = { ...managerApp, name: 'live-app' }
|
|
517
|
+
const live = { state: 'claimed' as const, lead: other, direct: { object: deployment, claims: [{ manager: other, source: 'argo-tracking-id' as const, check: 'missing' as const }] } }
|
|
518
|
+
mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: other, manager: live, policy: null, paths: [] })
|
|
519
|
+
const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager: managerAnswer } }, writes: replicas })
|
|
520
|
+
try {
|
|
521
|
+
await act(async () => vi.waitFor(() => expect(h.ref.state!.ownership.owner?.name).toBe('live-app')))
|
|
522
|
+
expect(h.ref.state!.ownership.ownerVerified).toBe(false)
|
|
523
|
+
expect(h.ref.state!.ownership.ownerStatus).toBeNull()
|
|
524
|
+
} finally { await h.cleanup() }
|
|
525
|
+
})
|
|
526
|
+
|
|
527
|
+
// An object adopted since the cache saw it has a manager the cache doesn't.
|
|
528
|
+
it('checks a cached none against the live object', async () => {
|
|
529
|
+
const cachedNone = { state: 'none' as const, direct: { object: deployment } }
|
|
530
|
+
mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: managerApp, manager: managerAnswer, policy: null, paths: [] })
|
|
531
|
+
const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager: cachedNone } }, writes: replicas })
|
|
532
|
+
try {
|
|
533
|
+
await act(async () => vi.waitFor(() => expect(mocks.evidence).toHaveBeenCalled()))
|
|
534
|
+
await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.owner?.name).toBe('server-app')))
|
|
535
|
+
} finally { await h.cleanup() }
|
|
536
|
+
})
|
|
537
|
+
|
|
538
|
+
it('does not guess an Argo namespace or inherit through the browser with an answer', async () => {
|
|
539
|
+
const unresolved = { ...managerAnswer, state: 'claimed' as const, lead: { ...managerApp, namespace: '' } }
|
|
540
|
+
mocks.applications.data = [{ metadata: { name: managerApp.name, namespace: 'guessed' } }]
|
|
541
|
+
mocks.inherited = { data: { resource: {}, relationships: { managedBy: [managerApp] } }, isPending: false, isError: false }
|
|
542
|
+
mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: unresolved.lead, policy: null, paths: [] })
|
|
543
|
+
const h = await renderGuard({ target: pod, resource: {}, relationships: { ...podRelationships, ownership: { children: { complete: true }, manager: unresolved } }, writes: replicas })
|
|
544
|
+
try {
|
|
545
|
+
await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
|
|
546
|
+
expect(h.ref.state!.ownership.owner?.namespace).toBe('')
|
|
547
|
+
expect(h.ref.state!.ownership.ownerMatchedByName).toBe(false)
|
|
548
|
+
expect(h.ref.state!.ownership.inheritedLookupRef).toBeNull()
|
|
549
|
+
expect(mocks.evidence.mock.calls[0][0].owner.namespace).toBe('')
|
|
550
|
+
} finally { await h.cleanup() }
|
|
551
|
+
})
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
it('still fetches the lead for sync and health without listing namesakes', async () => {
|
|
555
|
+
mocks.ownerObject = { status: { sync: { status: 'Synced' }, health: { status: 'Healthy' } } }
|
|
556
|
+
mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: managerApp, manager: managerAnswer, policy: null, paths: [] })
|
|
557
|
+
const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager: managerAnswer } }, writes: replicas })
|
|
558
|
+
try {
|
|
559
|
+
await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
|
|
560
|
+
expect(mocks.resourceRead).toHaveBeenCalledWith('applications', 'argocd', 'server-app', 'argoproj.io', expect.objectContaining({ enabled: true }))
|
|
561
|
+
expect(mocks.resourceList).toHaveBeenCalledWith('applications', undefined, 'argoproj.io', expect.objectContaining({ enabled: false }))
|
|
562
|
+
expect(h.ref.state!.ownership.ownerStatus).toMatchObject({ sync: 'Synced', health: 'Healthy' })
|
|
563
|
+
} finally { await h.cleanup() }
|
|
564
|
+
})
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
it.each(['agree', 'listed', 'claimed', 'disagree', 'shared', 'unknown', 'none'] as const)('image prefetch skips browser inheritance for %s answers', state => {
|
|
568
|
+
expect(findInheritedGitOpsLookupRef({ ...podRelationships, ownership: { children: { complete: true }, manager: { state, direct: { object: pod } } } }, null, pod)).toBeNull()
|
|
569
|
+
})
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
it.each(['cycle', 'truncated'] as const)('fetches evidence for a %s chain without a stop object', async chainEnd => {
|
|
573
|
+
const manager = { state: 'unknown' as const, direct: { object: deployment }, chainEnd }
|
|
574
|
+
mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: null, manager, policy: null, paths: [] })
|
|
575
|
+
const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager } }, writes: replicas })
|
|
576
|
+
try {
|
|
577
|
+
await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
|
|
578
|
+
expect(mocks.evidence).toHaveBeenCalledTimes(1)
|
|
579
|
+
expect(h.ref.state!.guard?.level).toBe('may-revert')
|
|
580
|
+
} finally { await h.cleanup() }
|
|
581
|
+
})
|
|
@@ -3,6 +3,8 @@ import { useQuery } from '@tanstack/react-query'
|
|
|
3
3
|
import {
|
|
4
4
|
evaluateGitOpsWriteGuard,
|
|
5
5
|
gitOpsWriteEvidencePaths,
|
|
6
|
+
gitOpsOwnerFromRef,
|
|
7
|
+
managerChoices,
|
|
6
8
|
type GitOpsWrite,
|
|
7
9
|
type GitOpsWriteEvidence,
|
|
8
10
|
type GitOpsWriteGuard,
|
|
@@ -81,6 +83,10 @@ export function useGitOpsWriteGuard({
|
|
|
81
83
|
const targetLookupFailed = needsTarget && targetQuery.isError
|
|
82
84
|
const lookupPending = targetLookupPending || ownership.lookupPending
|
|
83
85
|
const managed = Boolean(ownership.owner || ownership.helmOwner)
|
|
86
|
+
const manager = ownership.manager
|
|
87
|
+
// The server answers from the live object, so any cached answer is checked:
|
|
88
|
+
// an object adopted since the cache last saw it has a manager it doesn't.
|
|
89
|
+
const needsManagerEvidence = Boolean(manager)
|
|
84
90
|
|
|
85
91
|
const writesKey = JSON.stringify(writes)
|
|
86
92
|
const requestedPathsKey = requestedPaths ? JSON.stringify(requestedPaths) : ''
|
|
@@ -99,12 +105,12 @@ export function useGitOpsWriteGuard({
|
|
|
99
105
|
}, [ownership.owner, ownership.helmOwner])
|
|
100
106
|
// An Argo owner without a namespace is still asked about: the server finds
|
|
101
107
|
// the Application whose status lists the object.
|
|
102
|
-
const canFetchEvidence = managed && !lookupPending && !targetLookupFailed && !ownership.lookupError
|
|
108
|
+
const canFetchEvidence = (managed || needsManagerEvidence) && !lookupPending && !targetLookupFailed && !ownership.lookupError
|
|
103
109
|
|
|
104
110
|
const evidenceFeature = useRadarFeature('gitopsWriteEvidence')
|
|
105
111
|
const evidenceQuery = useQuery({
|
|
106
112
|
// The API base identifies the cluster when a host switches it (Radar Hub).
|
|
107
|
-
queryKey: ['gitops-write-evidence', getApiBase(), target.kind, target.group, target.namespace, target.name, paths, ownerRef, ...evidenceFeature.gatedKey],
|
|
113
|
+
queryKey: ['gitops-write-evidence', getApiBase(), target.kind, target.group, target.namespace, target.name, paths, ownerRef, manager, ...evidenceFeature.gatedKey],
|
|
108
114
|
queryFn: () =>
|
|
109
115
|
evidenceFeature.guard(() =>
|
|
110
116
|
fetchGitOpsWriteEvidence({
|
|
@@ -122,7 +128,7 @@ export function useGitOpsWriteGuard({
|
|
|
122
128
|
})
|
|
123
129
|
|
|
124
130
|
const targetRelationshipsMissing = needsTarget && targetQuery.data != null && targetQuery.relationships == null
|
|
125
|
-
const unresolvedDeclaredManager = Boolean(declaredManager) && !managed && !lookupPending
|
|
131
|
+
const unresolvedDeclaredManager = !manager && Boolean(declaredManager) && !managed && !lookupPending
|
|
126
132
|
const unknownOwner = "so it can't tell whether a GitOps tool or Helm manages it."
|
|
127
133
|
const ownershipError = targetLookupFailed
|
|
128
134
|
? `Radar couldn't read this resource, ${unknownOwner}`
|
|
@@ -143,6 +149,20 @@ export function useGitOpsWriteGuard({
|
|
|
143
149
|
// namespace, and the browser's namespace view may hide them; take the
|
|
144
150
|
// Application the server confirmed.
|
|
145
151
|
const confirmedOwnership = useMemo<ResolvedGitOpsOwner>(() => {
|
|
152
|
+
if (evidence?.manager) {
|
|
153
|
+
const answer = evidence.manager
|
|
154
|
+
const owner = answer.lead ? gitOpsOwnerFromRef(answer.lead) : null
|
|
155
|
+
const helmOwner = answer.lead?.kind === 'HelmRelease' && !answer.lead.group ? { namespace: answer.lead.namespace, name: answer.lead.name } : null
|
|
156
|
+
const same = (a: typeof owner, b: typeof owner) => Boolean(a && b && a.kind === b.kind && a.namespace === b.namespace && a.name === b.name)
|
|
157
|
+
if (same(owner, ownership.owner)) {
|
|
158
|
+
return { ...ownership, manager: answer, owner, rawOwner: owner, helmOwner, ownerMatchedByName: false }
|
|
159
|
+
}
|
|
160
|
+
// The live answer names another manager: what was read and verified
|
|
161
|
+
// for the cached one doesn't carry over. The server found it when its
|
|
162
|
+
// list names the object or a claim read it.
|
|
163
|
+
const found = Boolean(answer.lead && owner?.namespace && managerChoices(answer).find(c => c.ref.kind === answer.lead!.kind && c.ref.group === answer.lead!.group && c.ref.namespace === answer.lead!.namespace && c.ref.name === answer.lead!.name)?.found)
|
|
164
|
+
return { ...ownership, manager: answer, owner, rawOwner: owner, helmOwner, ownerMatchedByName: false, ownerObject: undefined, ownerStatus: null, ownerVerified: found }
|
|
165
|
+
}
|
|
146
166
|
const owner = ownership.owner
|
|
147
167
|
const namespace = evidence?.ownerTracksTarget ? evidence.owner?.namespace : undefined
|
|
148
168
|
if (!owner || owner.namespace || !namespace) return ownership
|
|
@@ -154,6 +174,7 @@ export function useGitOpsWriteGuard({
|
|
|
154
174
|
enabled
|
|
155
175
|
? evaluateGitOpsWriteGuard({
|
|
156
176
|
target,
|
|
177
|
+
manager,
|
|
157
178
|
owner: confirmedOwnership.owner,
|
|
158
179
|
helmRelease: ownership.helmOwner,
|
|
159
180
|
// A refetch counts as pending: an earlier verdict may no longer hold.
|
|
@@ -177,6 +198,7 @@ export function useGitOpsWriteGuard({
|
|
|
177
198
|
target.name,
|
|
178
199
|
confirmedOwnership.owner,
|
|
179
200
|
ownership.helmOwner,
|
|
201
|
+
manager,
|
|
180
202
|
lookupPending,
|
|
181
203
|
canFetchEvidence,
|
|
182
204
|
evidenceQuery.isPending,
|
|
@@ -2,6 +2,7 @@ import { useMemo } from 'react'
|
|
|
2
2
|
import {
|
|
3
3
|
getGitOpsResourceStatus,
|
|
4
4
|
gitOpsOwnerFromRelationships,
|
|
5
|
+
type ManagerAnswer,
|
|
5
6
|
type GitOpsOwnerRef,
|
|
6
7
|
type GitOpsStatus,
|
|
7
8
|
type HelmOwnerRef,
|
|
@@ -11,6 +12,7 @@ import { kindToPluralWithGroup } from '../utils/navigation'
|
|
|
11
12
|
import { useResource, useResourceWithRelationships, useResources } from '../api/client'
|
|
12
13
|
|
|
13
14
|
export interface ResolvedGitOpsOwner {
|
|
15
|
+
manager?: ManagerAnswer
|
|
14
16
|
/** GitOps owner, with an Argo Application's namespace filled in when the
|
|
15
17
|
* tracking label omitted it and exactly one Application matches. */
|
|
16
18
|
owner: GitOpsOwnerRef | null
|
|
@@ -60,6 +62,7 @@ export function useResolvedGitOpsOwner({
|
|
|
60
62
|
/** Keeps these reads apart from the shared resource cache (see useResource). */
|
|
61
63
|
cacheScope?: string
|
|
62
64
|
}): ResolvedGitOpsOwner {
|
|
65
|
+
const manager = enabled ? relationships?.ownership?.manager : undefined
|
|
63
66
|
const active = enabled && Boolean(relationships)
|
|
64
67
|
const relationshipGitopsOwner = useMemo(
|
|
65
68
|
() => (active ? gitOpsOwnerFromRelationships(relationships) : null),
|
|
@@ -67,10 +70,10 @@ export function useResolvedGitOpsOwner({
|
|
|
67
70
|
)
|
|
68
71
|
const inheritedLookupRef = useMemo(
|
|
69
72
|
() =>
|
|
70
|
-
active
|
|
73
|
+
active && !manager
|
|
71
74
|
? findInheritedGitOpsLookupRef(relationships, relationshipGitopsOwner, { kind, namespace, name, group })
|
|
72
75
|
: null,
|
|
73
|
-
[active, relationships, relationshipGitopsOwner, kind, namespace, name, group],
|
|
76
|
+
[active, manager, relationships, relationshipGitopsOwner, kind, namespace, name, group],
|
|
74
77
|
)
|
|
75
78
|
const inherited = useResourceWithRelationships<any>(
|
|
76
79
|
inheritedLookupRef ? kindToPluralWithGroup(inheritedLookupRef.kind, inheritedLookupRef.group ?? '') : '',
|
|
@@ -103,13 +106,13 @@ export function useResolvedGitOpsOwner({
|
|
|
103
106
|
const helmOwner = relationshipHelmOwner ?? inheritedHelmOwner
|
|
104
107
|
const helmSourceResource = relationshipHelmOwner ? resource : inherited.data?.resource
|
|
105
108
|
|
|
106
|
-
const shouldResolveArgoNamespace = rawOwner?.tool === 'argocd' && !rawOwner.namespace
|
|
109
|
+
const shouldResolveArgoNamespace = !manager && rawOwner?.tool === 'argocd' && !rawOwner.namespace
|
|
107
110
|
const argoQuery = useResources<any>('applications', undefined, 'argoproj.io', {
|
|
108
111
|
enabled: shouldResolveArgoNamespace,
|
|
109
112
|
cacheScope,
|
|
110
113
|
})
|
|
111
114
|
const argoApplications = argoQuery.data
|
|
112
|
-
const owner = useMemo(() => resolveGitOpsOwner(rawOwner, argoApplications), [rawOwner, argoApplications])
|
|
115
|
+
const owner = useMemo(() => manager ? rawOwner : resolveGitOpsOwner(rawOwner, argoApplications), [manager, rawOwner, argoApplications])
|
|
113
116
|
|
|
114
117
|
const ownerGroup = owner ? gitOpsOwnerGroup(owner) : ''
|
|
115
118
|
const shouldFetchOwner = Boolean(owner?.namespace)
|
|
@@ -124,12 +127,13 @@ export function useResolvedGitOpsOwner({
|
|
|
124
127
|
|
|
125
128
|
const ownerStatus = useMemo(() => deriveGitOpsOwnerStatus(owner, ownerObject), [owner, ownerObject])
|
|
126
129
|
const ownerSource = useMemo(
|
|
127
|
-
() => describeGitOpsOwnerSource(rawOwner, gitOpsSourceResource),
|
|
128
|
-
[rawOwner, gitOpsSourceResource],
|
|
130
|
+
() => manager ? null : describeGitOpsOwnerSource(rawOwner, gitOpsSourceResource),
|
|
131
|
+
[manager, rawOwner, gitOpsSourceResource],
|
|
129
132
|
)
|
|
130
|
-
const helmSource = useMemo(() => describeHelmOwnerSource(helmOwner, helmSourceResource), [helmOwner, helmSourceResource])
|
|
133
|
+
const helmSource = useMemo(() => manager ? null : describeHelmOwnerSource(helmOwner, helmSourceResource), [manager, helmOwner, helmSourceResource])
|
|
131
134
|
|
|
132
135
|
return {
|
|
136
|
+
manager,
|
|
133
137
|
owner,
|
|
134
138
|
rawOwner,
|
|
135
139
|
ownerObject,
|
|
@@ -173,7 +177,7 @@ export function findInheritedGitOpsLookupRef(
|
|
|
173
177
|
directOwner: GitOpsOwnerRef | null,
|
|
174
178
|
current: ResourceRef,
|
|
175
179
|
): ResourceRef | null {
|
|
176
|
-
if (directOwner) return null
|
|
180
|
+
if (relationships?.ownership?.manager || directOwner) return null
|
|
177
181
|
const inheritedManagerRefs = (relationships?.managedBy ?? []).filter(
|
|
178
182
|
(ref) => !gitOpsOwnerFromRelationships({ managedBy: [ref] }) && !isNativeHelmManager(ref),
|
|
179
183
|
)
|
|
@@ -188,7 +192,8 @@ export function nativeHelmOwnerFromRelationships(
|
|
|
188
192
|
relationships: Relationships | undefined,
|
|
189
193
|
fallbackNamespace: string,
|
|
190
194
|
): HelmOwnerRef | null {
|
|
191
|
-
const
|
|
195
|
+
const answer = relationships?.ownership?.manager
|
|
196
|
+
const ref = answer ? answer.lead : relationships?.managedBy?.[0]
|
|
192
197
|
if (!ref || !isNativeHelmManager(ref)) return null
|
|
193
198
|
return {
|
|
194
199
|
namespace: ref.namespace || fallbackNamespace,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { ResourceCoverage } from '@skyhook-io/k8s-ui'
|
|
1
2
|
import { useQuery } from '@tanstack/react-query'
|
|
2
3
|
import { debugNamespaceLog, fetchJSON, isStillLoadingError } from '../api/client'
|
|
3
4
|
import { useConnection } from '../context/ConnectionContext'
|
|
4
5
|
|
|
5
6
|
export interface ResourceCountsResponse {
|
|
6
7
|
counts: Record<string, number>
|
|
8
|
+
coverage?: Record<string, ResourceCoverage>
|
|
7
9
|
forbidden?: string[]
|
|
8
10
|
reasons?: Record<string, string>
|
|
9
11
|
unavailable?: string[]
|
package/src/index.css
CHANGED
|
@@ -53,10 +53,8 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/*
|
|
56
|
-
* Tailwind v4 theme tokens
|
|
57
|
-
*
|
|
58
|
-
* to pick up radar's Node config or its `@tailwindcss/typography` plugin
|
|
59
|
-
* when they consume this package from npm.
|
|
56
|
+
* Tailwind v4 theme tokens live in CSS so library consumers (e.g.
|
|
57
|
+
* radar-hub-web) get the same theme when they import this package's styles.
|
|
60
58
|
*/
|
|
61
59
|
@theme {
|
|
62
60
|
--color-investigation-assessment: light-dark(#edf3fc, #182237);
|
|
@@ -421,6 +419,91 @@ body {
|
|
|
421
419
|
}
|
|
422
420
|
}
|
|
423
421
|
|
|
422
|
+
/* Product Hunt launch card: a green light travels around the border and spills
|
|
423
|
+
a soft glow outward, brightening and fading on a cycle longer than the lap so
|
|
424
|
+
the brightest point lands somewhere new each time; the rocket drifts gently
|
|
425
|
+
while the card is open. --launch-angle is registered so the conic gradient
|
|
426
|
+
itself rotates; browsers without @property show the light standing still. */
|
|
427
|
+
@property --launch-angle {
|
|
428
|
+
syntax: "<angle>";
|
|
429
|
+
initial-value: 0deg;
|
|
430
|
+
inherits: false;
|
|
431
|
+
}
|
|
432
|
+
@keyframes launch-border-spin {
|
|
433
|
+
to {
|
|
434
|
+
--launch-angle: 360deg;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
@keyframes launch-border-fade {
|
|
438
|
+
0%,
|
|
439
|
+
100% {
|
|
440
|
+
opacity: 0.15;
|
|
441
|
+
}
|
|
442
|
+
50% {
|
|
443
|
+
opacity: 1;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
.launch-border {
|
|
447
|
+
/* A deeper green on light surfaces, where the paler one washes out. */
|
|
448
|
+
--launch-glow: 5, 150, 105;
|
|
449
|
+
}
|
|
450
|
+
.dark .launch-border {
|
|
451
|
+
--launch-glow: 52, 211, 153;
|
|
452
|
+
}
|
|
453
|
+
.launch-border::before,
|
|
454
|
+
.launch-border::after {
|
|
455
|
+
content: "";
|
|
456
|
+
position: absolute;
|
|
457
|
+
pointer-events: none;
|
|
458
|
+
border-radius: inherit;
|
|
459
|
+
background: conic-gradient(
|
|
460
|
+
from var(--launch-angle),
|
|
461
|
+
transparent 0deg,
|
|
462
|
+
rgba(var(--launch-glow), 0) 30deg,
|
|
463
|
+
rgba(var(--launch-glow), 0.95) 80deg,
|
|
464
|
+
rgba(var(--launch-glow), 0) 130deg,
|
|
465
|
+
transparent 360deg
|
|
466
|
+
);
|
|
467
|
+
animation:
|
|
468
|
+
launch-border-spin 5s linear infinite,
|
|
469
|
+
launch-border-fade 6.85s ease-in-out infinite;
|
|
470
|
+
}
|
|
471
|
+
/* The ring: the gradient masked down to a 1.5px border on top of the card. */
|
|
472
|
+
.launch-border::before {
|
|
473
|
+
inset: -1px;
|
|
474
|
+
padding: 1.5px;
|
|
475
|
+
z-index: 1;
|
|
476
|
+
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
477
|
+
-webkit-mask-composite: xor;
|
|
478
|
+
mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
479
|
+
mask-composite: exclude;
|
|
480
|
+
}
|
|
481
|
+
/* The glow: the same gradient blurred behind the card, so light spills outward. */
|
|
482
|
+
.launch-border::after {
|
|
483
|
+
inset: -4px;
|
|
484
|
+
z-index: -1;
|
|
485
|
+
filter: blur(12px);
|
|
486
|
+
}
|
|
487
|
+
@keyframes launch-rocket {
|
|
488
|
+
0%,
|
|
489
|
+
100% {
|
|
490
|
+
transform: translate(0, 0) rotate(0deg);
|
|
491
|
+
}
|
|
492
|
+
50% {
|
|
493
|
+
transform: translate(1.5px, -2.5px) rotate(-6deg);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
.animate-launch-rocket {
|
|
497
|
+
animation: launch-rocket 3s ease-in-out infinite;
|
|
498
|
+
}
|
|
499
|
+
@media (prefers-reduced-motion: reduce) {
|
|
500
|
+
.launch-border::before,
|
|
501
|
+
.launch-border::after,
|
|
502
|
+
.animate-launch-rocket {
|
|
503
|
+
animation: none;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
424
507
|
/* Gentle colorize when syntax-highlighted code swaps in over plain text — opacity
|
|
425
508
|
only (no transform → no layout shift) and floored at 0.5 so it never blanks. */
|
|
426
509
|
@keyframes code-colorize {
|
package/src/index.ts
CHANGED
|
@@ -96,7 +96,14 @@ export type {
|
|
|
96
96
|
OmnibarHandle,
|
|
97
97
|
OmnibarRecent,
|
|
98
98
|
OmnibarSearchResult,
|
|
99
|
+
OmnibarNote,
|
|
100
|
+
OmnibarNotePart,
|
|
99
101
|
} from './components/ui/Omnibar';
|
|
100
102
|
export { bestScore } from './components/ui/command-items';
|
|
101
103
|
export type { CommandItem } from './components/ui/command-items';
|
|
102
104
|
export type { SearchHit, SearchMatchedField } from './api/client';
|
|
105
|
+
|
|
106
|
+
export { fetchResourceList, type ResourceListOptions } from './api/client';
|
|
107
|
+
export { normalizeResourceList, type ResourceListBody, type ResourceListResult } from './api/resourceLists';
|
|
108
|
+
export type { ResourceCoverage, ResourceReadCoverage, ResourceListResponse } from '@skyhook-io/k8s-ui';
|
|
109
|
+
export type { SearchCoverageEntry } from './components/ui/searchCoverageNote';
|