@skyhook-io/radar-app 1.19.0 → 1.20.1
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 +1 -1
- package/package.json +5 -5
- package/src/App.tsx +37 -9
- package/src/api/application-evidence.ts +63 -0
- package/src/api/argoSync.test.ts +22 -0
- package/src/api/client.audit-gating.test.tsx +48 -0
- package/src/api/client.kueuePosition.test.ts +32 -0
- package/src/api/client.kueueQueueWorkloads.test.tsx +71 -0
- package/src/api/client.resource-identity.test.ts +3 -0
- package/src/api/client.resourceIssues.test.tsx +239 -0
- package/src/api/client.resourcePath.test.ts +3 -0
- package/src/api/client.ts +353 -64
- package/src/api/config.ts +21 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/helmInventory.test.tsx +108 -0
- package/src/api/radarFeatures.render.test.tsx +33 -1
- package/src/api/radarFeatures.test.ts +47 -0
- package/src/api/radarFeatures.ts +42 -1
- package/src/api/rbac.settled.test.tsx +42 -0
- package/src/api/rbac.test.ts +18 -0
- package/src/api/rbac.ts +37 -7
- package/src/api/traffic.ts +9 -4
- package/src/api/usage-data.fixtures.ts +3 -1
- package/src/api/usage-data.test.tsx +134 -0
- package/src/api/usage-data.ts +35 -7
- package/src/api/workloadPodsPolling.test.ts +26 -0
- package/src/components/CloudConnectFlow.test.tsx +86 -0
- package/src/components/CloudConnectFlow.tsx +65 -27
- package/src/components/CloudFunnelButton.test.tsx +140 -5
- package/src/components/CloudFunnelButton.tsx +50 -9
- package/src/components/ConnectionErrorView.test.tsx +34 -0
- package/src/components/ConnectionErrorView.tsx +35 -11
- package/src/components/ContextSwitcher.tsx +5 -2
- package/src/components/SwitchAwareConnectionError.test.tsx +43 -0
- package/src/components/SwitchAwareConnectionError.tsx +85 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.flow.test.tsx +234 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.test.tsx +144 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.tsx +218 -0
- package/src/components/capacity/CapacityDemand.tsx +3 -2
- package/src/components/capacity/demandSummary.test.ts +38 -0
- package/src/components/capacity/shared.tsx +12 -1
- package/src/components/cost/ApplicationCostTab.tsx +4 -0
- package/src/components/cost/CostTrendChart.tsx +2 -0
- package/src/components/cost/WorkloadCostTab.tsx +4 -0
- package/src/components/cost/source.test.ts +5 -0
- package/src/components/cost/source.ts +11 -0
- package/src/components/curl/ServiceCurlAvailability.test.tsx +32 -0
- package/src/components/curl/ServiceCurlButton.tsx +2 -2
- package/src/components/diagnose/AIMarkdown.tsx +3 -0
- package/src/components/diagnose/AgentSetupNotice.test.tsx +17 -0
- package/src/components/diagnose/AgentSetupNotice.tsx +21 -3
- package/src/components/diagnose/ContinueInAgentButton.mounted.test.tsx +182 -0
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +128 -0
- package/src/components/diagnose/ContinueInAgentButton.tsx +303 -0
- package/src/components/diagnose/DiagnoseContext.question.test.tsx +1 -1
- package/src/components/diagnose/DiagnoseContext.tsx +68 -2
- package/src/components/diagnose/DiagnoseSurface.tsx +58 -113
- package/src/components/diagnose/ExampleInvestigationLink.tsx +20 -0
- package/src/components/diagnose/Home.test.tsx +26 -0
- package/src/components/diagnose/Home.tsx +20 -1
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +45 -22
- package/src/components/diagnose/InvestigationView.tsx +94 -26
- package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +450 -0
- package/src/components/diagnose/LocalDiagnoseAction.tsx +354 -35
- package/src/components/diagnose/NextStepJump.test.tsx +92 -0
- package/src/components/diagnose/NextStepJump.tsx +75 -0
- package/src/components/diagnose/QuestionComposer.tsx +8 -0
- package/src/components/diagnose/exampleInvestigation.events.json +191 -0
- package/src/components/diagnose/exampleInvestigation.loadFailure.test.tsx +94 -0
- package/src/components/diagnose/exampleInvestigation.test.tsx +248 -0
- package/src/components/diagnose/exampleInvestigation.ts +121 -0
- package/src/components/diagnose/investigationCase.test.tsx +50 -1
- package/src/components/diagnose/investigationEvidence/adapters/applicationFindings.test.ts +739 -0
- package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +72 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +50 -2
- package/src/components/diagnose/investigationEvidence/adapters/helm.ts +51 -16
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +9 -0
- package/src/components/diagnose/investigationEvidence/adapters/listings.ts +34 -4
- package/src/components/diagnose/investigationEvidence/adapters/resource.ts +3 -2
- package/src/components/diagnose/investigationEvidence/builder.ts +30 -0
- package/src/components/diagnose/investigationEvidence/observations.ts +121 -2
- package/src/components/diagnose/investigationEvidence/projection.test.ts +85 -3
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/diagnose/investigationState.ts +28 -0
- package/src/components/diagnose/lastInvestigation.test.ts +95 -0
- package/src/components/diagnose/lastInvestigation.ts +58 -0
- package/src/components/diagnose/launch.test.ts +125 -1
- package/src/components/diagnose/launch.ts +57 -10
- package/src/components/diagnose/toolCallLabel.test.ts +10 -4
- package/src/components/execution/BatchExecutionView.tsx +24 -11
- package/src/components/execution/JobSetAdmission.test.tsx +42 -0
- package/src/components/execution/JobSetAdmission.tsx +18 -3
- package/src/components/execution/JobSetMemberComparison.tsx +2 -1
- package/src/components/execution/runState.test.ts +14 -0
- package/src/components/execution/runState.ts +8 -0
- package/src/components/gitops/GitOpsView.rollbackGate.test.tsx +202 -0
- package/src/components/gitops/GitOpsView.syncRequest.test.tsx +369 -0
- package/src/components/gitops/GitOpsView.tsx +86 -17
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +2 -3
- package/src/components/gitops/destination-toast.test.ts +1 -1
- package/src/components/gitops/destination-toast.ts +2 -2
- package/src/components/helm/HelmDrawerFrame.tsx +101 -0
- package/src/components/helm/HelmDrawerRouting.test.tsx +86 -0
- package/src/components/helm/HelmReleaseDrawer.tsx +23 -86
- package/src/components/helm/HelmView.tsx +213 -71
- package/src/components/helm/ObservedHelmNotice.tsx +146 -0
- package/src/components/helm/ObservedHelmRelease.test.tsx +261 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +80 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.tsx +228 -0
- package/src/components/helm/OwnedResources.tsx +4 -2
- package/src/components/home/ClusterHealthCard.restricted.test.tsx +76 -0
- package/src/components/home/ClusterHealthCard.tsx +28 -5
- package/src/components/home/HelmSummary.tsx +23 -4
- package/src/components/home/HelmSummary.unread.test.ts +16 -0
- package/src/components/home/HomeAgentBlock.test.tsx +31 -3
- package/src/components/home/HomeAgentBlock.tsx +20 -4
- package/src/components/home/HomeDiagramCard.tsx +47 -0
- package/src/components/home/HomeView.tsx +81 -41
- package/src/components/home/MCPSetupDialog.test.tsx +126 -10
- package/src/components/home/MCPSetupDialog.tsx +33 -5
- package/src/components/home/ProblemsPanel.investigate.test.tsx +171 -0
- package/src/components/home/ProblemsPanel.test.tsx +3 -1
- package/src/components/home/TopologyPreview.test.tsx +73 -0
- package/src/components/home/TopologyPreview.tsx +120 -233
- package/src/components/home/TrafficSummary.test.tsx +63 -0
- package/src/components/home/TrafficSummary.tsx +135 -138
- package/src/components/home/mcpToolCatalog.ts +67 -14
- package/src/components/issues/IssuesPane.test.ts +11 -0
- package/src/components/issues/IssuesPane.tsx +15 -5
- package/src/components/issues/uncheckedSources.test.ts +22 -1
- package/src/components/issues/uncheckedSources.ts +21 -0
- package/src/components/kueue/KueuePendingPosition.tsx +35 -0
- package/src/components/kueue/useRelatedObjects.test.tsx +219 -0
- package/src/components/kueue/useRelatedReads.test.ts +56 -0
- package/src/components/kueue/useRelatedReads.ts +205 -0
- package/src/components/logs/MultiPodLogsTab.test.tsx +93 -0
- package/src/components/logs/MultiPodLogsTab.tsx +120 -0
- package/src/components/logs/PodLogsUnavailable.test.tsx +18 -0
- package/src/components/logs/PodLogsUnavailable.tsx +21 -0
- package/src/components/logs/RayClusterLogsTab.reselect.test.tsx +67 -0
- package/src/components/logs/RayClusterLogsTab.test.tsx +167 -0
- package/src/components/logs/RayClusterLogsTab.tsx +109 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +3 -2
- package/src/components/logs/rayClusterPods.ts +32 -0
- package/src/components/outageSince.test.ts +21 -0
- package/src/components/outageSince.ts +10 -0
- package/src/components/resource/PrometheusCharts.overlays.test.ts +12 -0
- package/src/components/resource/PrometheusCharts.tsx +3 -40
- package/src/components/resources/crd/CRDSchemaTab.test.tsx +28 -0
- package/src/components/resources/crd/CRDSchemaTab.tsx +13 -0
- package/src/components/resources/crd/host.tsx +14 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.test.tsx +27 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.tsx +12 -0
- package/src/components/resources/renderers/JobAdmissionRenderers.test.tsx +4 -1
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +4 -3
- package/src/components/resources/renderers/KueueHostRenderers.test.tsx +117 -0
- package/src/components/resources/renderers/KueueQueueRenderers.test.tsx +97 -0
- package/src/components/resources/renderers/KueueQueueRenderers.tsx +139 -0
- package/src/components/resources/renderers/KueueWorkloadRenderer.test.tsx +7 -1
- package/src/components/resources/renderers/KueueWorkloadRenderer.tsx +47 -7
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.test.tsx +67 -0
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.tsx +31 -0
- package/src/components/resources/renderers/RayClusterRenderer.test.tsx +81 -3
- package/src/components/resources/renderers/RayClusterRenderer.tsx +19 -4
- package/src/components/resources/renderers/ServiceRenderer.test.tsx +15 -2
- package/src/components/resources/renderers/ServiceRenderer.tsx +1 -1
- package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.test.tsx +160 -0
- package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.tsx +128 -0
- package/src/components/traffic/TrafficView.tsx +3 -3
- package/src/components/ui/command-items-crd.test.tsx +23 -0
- package/src/components/ui/command-items.ts +2 -1
- package/src/components/useContextSwitchFlow.test.tsx +61 -0
- package/src/components/useContextSwitchFlow.tsx +21 -4
- package/src/components/whats-new/WhatsNew.test.ts +10 -3
- package/src/components/whats-new/WhatsNew.tsx +5 -1
- package/src/components/whats-new/WhatsNewDialog.test.tsx +17 -3
- package/src/components/whats-new/releaseNotes.ts +77 -4
- package/src/components/workload/RelatedFindingsSection.test.tsx +126 -0
- package/src/components/workload/RelatedFindingsSection.tsx +80 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +85 -98
- package/src/components/workload/issueResourceOpener.test.ts +20 -0
- package/src/components/workload/issueResourceOpener.ts +17 -0
- package/src/context/ConnectionContext.tsx +133 -60
- package/src/context/ConnectionProvider.retry.test.tsx +176 -0
- package/src/context/ContextSwitchContext.tsx +14 -1
- package/src/context/DiagnoseCustomization.tsx +3 -0
- package/src/context/clusterConnected.ts +10 -0
- package/src/contexts/CapabilitiesContext.tsx +8 -4
- package/src/hooks/useElementSize.ts +30 -0
- package/src/hooks/useResolvedGitOpsOwner.test.ts +22 -0
- package/src/hooks/useResolvedGitOpsOwner.ts +6 -3
- package/src/integrations/resourceHost.test.tsx +1 -0
- package/src/integrations/resourceHost.ts +5 -1
- package/src/integrations/resourceHosts.test.tsx +21 -4
- package/src/integrations/resourceHosts.tsx +17 -0
- package/src/main.tsx +5 -0
- package/src/utils/related-findings.ts +46 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Info } from "lucide-react";
|
|
2
|
+
import {
|
|
3
|
+
ResourceIssuesSection,
|
|
4
|
+
type IssueResourceRef,
|
|
5
|
+
type RelatedFindingsGroup,
|
|
6
|
+
} from "@skyhook-io/k8s-ui";
|
|
7
|
+
import { relatedFindingLimitations } from "../../utils/related-findings";
|
|
8
|
+
|
|
9
|
+
export function RelatedFindingsSection({
|
|
10
|
+
data,
|
|
11
|
+
onResourceClick,
|
|
12
|
+
}: {
|
|
13
|
+
data: RelatedFindingsGroup[] | undefined;
|
|
14
|
+
onResourceClick?: (ref: IssueResourceRef) => void;
|
|
15
|
+
}) {
|
|
16
|
+
const groups = data?.filter(
|
|
17
|
+
(group) =>
|
|
18
|
+
group.findings?.length ||
|
|
19
|
+
group.truncated ||
|
|
20
|
+
group.unknown > 0 ||
|
|
21
|
+
group.gaps.length > 0,
|
|
22
|
+
);
|
|
23
|
+
if (!groups?.length) return null;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className="space-y-4">
|
|
27
|
+
{groups.map((group, index) => {
|
|
28
|
+
const anchor = group.associatedVia;
|
|
29
|
+
const limits = relatedFindingLimitations(group);
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
key={`${anchor.group}/${anchor.kind}/${anchor.namespace}/${anchor.name}/${index}`}
|
|
33
|
+
className="space-y-2 border-b border-theme-border pb-4 last:border-0 last:pb-0"
|
|
34
|
+
>
|
|
35
|
+
{group.findings?.length ? (
|
|
36
|
+
<ResourceIssuesSection
|
|
37
|
+
heading="Related findings"
|
|
38
|
+
issues={group.findings}
|
|
39
|
+
onResourceClick={onResourceClick}
|
|
40
|
+
/>
|
|
41
|
+
) : (
|
|
42
|
+
<h3 className="flex items-center gap-2 px-1 text-xs font-semibold uppercase tracking-wide text-theme-text-secondary">
|
|
43
|
+
<Info
|
|
44
|
+
className="h-4 w-4 text-theme-text-tertiary"
|
|
45
|
+
aria-hidden
|
|
46
|
+
/>
|
|
47
|
+
Related findings
|
|
48
|
+
</h3>
|
|
49
|
+
)}
|
|
50
|
+
<p className="text-xs text-theme-text-secondary">
|
|
51
|
+
Via{" "}
|
|
52
|
+
{onResourceClick ? (
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
className="text-accent hover:underline"
|
|
56
|
+
onClick={() => onResourceClick(anchor)}
|
|
57
|
+
>
|
|
58
|
+
{`${anchor.kind} ${anchor.namespace ? `${anchor.namespace}/` : ""}${anchor.name}${anchor.group ? ` (${anchor.group})` : ""}`}
|
|
59
|
+
</button>
|
|
60
|
+
) : (
|
|
61
|
+
`${anchor.kind} ${anchor.namespace ? `${anchor.namespace}/` : ""}${anchor.name}${anchor.group ? ` (${anchor.group})` : ""}`
|
|
62
|
+
)}
|
|
63
|
+
. These findings concern the linked resources; this resource's
|
|
64
|
+
status is reported separately.
|
|
65
|
+
</p>
|
|
66
|
+
{limits.length > 0 && (
|
|
67
|
+
<ul className="text-xs text-theme-text-secondary">
|
|
68
|
+
{limits.map((limit) => (
|
|
69
|
+
<li key={`${limit.kind}/${limit.message}`}>
|
|
70
|
+
{limit.message}
|
|
71
|
+
</li>
|
|
72
|
+
))}
|
|
73
|
+
</ul>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
})}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
|
|
|
2
2
|
|
|
3
3
|
import { gitOpsOwnerFromRelationships } from '@skyhook-io/k8s-ui'
|
|
4
4
|
import type { Relationships } from '../../types'
|
|
5
|
-
import { collectServingRefs, supportsBatchExecution } from './WorkloadView'
|
|
5
|
+
import { collectServingRefs, memberOverviewParams, supportsBatchExecution } from './WorkloadView'
|
|
6
6
|
import { findInheritedGitOpsLookupRef } from '../../hooks/useResolvedGitOpsOwner'
|
|
7
7
|
|
|
8
8
|
describe('findInheritedGitOpsLookupRef', () => {
|
|
@@ -84,3 +84,12 @@ describe('collectServingRefs', () => {
|
|
|
84
84
|
expect(collectServingRefs({ routedFrom: [broker, broker, other] })).toEqual([broker, other])
|
|
85
85
|
})
|
|
86
86
|
})
|
|
87
|
+
|
|
88
|
+
describe('memberOverviewParams', () => {
|
|
89
|
+
it('selects the member and returns to the Overview in one change, keeping other params', () => {
|
|
90
|
+
const next = memberOverviewParams(new URLSearchParams('apiGroup=jobset.x-k8s.io&tab=topology&run=jobs/ml/old'), 'jobs/ml/train-workers-1')
|
|
91
|
+
expect(next.get('run')).toBe('jobs/ml/train-workers-1')
|
|
92
|
+
expect(next.has('tab')).toBe(false)
|
|
93
|
+
expect(next.get('apiGroup')).toBe('jobset.x-k8s.io')
|
|
94
|
+
})
|
|
95
|
+
})
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { RelatedFindingsSection } from './RelatedFindingsSection'
|
|
1
2
|
import { decorateResourceDiagnose, resourceDetailRedirect, resourceDetailSlots, resourceLogs, resourceRendererOverrides } from '../../integrations/resourceHosts'
|
|
3
|
+
import { ApplicationEvidenceAction } from '../application-evidence/ApplicationEvidenceAction'
|
|
2
4
|
import { useMemo, useEffect, useCallback, useRef, useState, type ReactNode } from 'react'
|
|
3
5
|
import { useQueries, useQueryClient } from '@tanstack/react-query'
|
|
4
6
|
import { Navigate, useNavigate, useLocation, useSearchParams } from 'react-router-dom'
|
|
5
7
|
import { workloadPodAwaitsScheduling } from '../capacity/podDemandGate'
|
|
6
|
-
import {
|
|
7
|
-
import { Terminal, Stethoscope } from 'lucide-react'
|
|
8
|
+
import { Stethoscope } from 'lucide-react'
|
|
8
9
|
import {
|
|
9
10
|
WorkloadView as BaseWorkloadView,
|
|
10
11
|
EditableYamlView,
|
|
@@ -55,7 +56,6 @@ import {
|
|
|
55
56
|
fetchWorkloadHistoryPage,
|
|
56
57
|
useChanges,
|
|
57
58
|
useResourceWithRelationships,
|
|
58
|
-
usePodLogs,
|
|
59
59
|
useTopology,
|
|
60
60
|
useUpdateResource,
|
|
61
61
|
usePreviewResources,
|
|
@@ -101,11 +101,14 @@ import { WorkloadCostTab } from '../cost/WorkloadCostTab'
|
|
|
101
101
|
import { isOpenCostWorkloadKind } from '../cost/kinds'
|
|
102
102
|
import { isRadarFeatureUnsupported } from '../../api/radarFeatures'
|
|
103
103
|
import { useTrafficAvailable } from '../../api/traffic'
|
|
104
|
-
import { useResourceAudit, useResourceIssues, useSubjectIssues, useRadarFeature, useTrace, fetchTraceWithProbes, fetchInClusterCapability, runInClusterMerged } from '../../api/client'
|
|
104
|
+
import { isNotFoundError, useResourceAudit, useResourceIssues, useSubjectIssues, useRadarFeature, useTrace, fetchTraceWithProbes, fetchInClusterCapability, runInClusterMerged } from '../../api/client'
|
|
105
105
|
import { AuditAlerts, getRadarUpgradeRequirement, ResourceIssuesSection, ReachabilityView, TraceSummary, InClusterConsentDialog, traceFingerprint, staticPollUnreliable, summarizeInClusterTests, type Trace as NetworkTrace, type InClusterCapability, inClusterConsentGiven, consentRequestRows } from '@skyhook-io/k8s-ui'
|
|
106
106
|
import { WorkloadLogsViewer } from '../logs/WorkloadLogsViewer'
|
|
107
107
|
import { ScheduledWorkloadLogsViewer } from '../logs/ScheduledWorkloadLogsViewer'
|
|
108
108
|
import { LogsViewer } from '../logs/LogsViewer'
|
|
109
|
+
import { MultiPodLogsTab } from '../logs/MultiPodLogsTab'
|
|
110
|
+
import { RayClusterLogsTab } from '../logs/RayClusterLogsTab'
|
|
111
|
+
import { isKubeRayCluster } from '../logs/rayClusterPods'
|
|
109
112
|
import { BatchExecutionFullscreen } from '../execution/BatchExecutionView'
|
|
110
113
|
import { workloadRunTimelineEvents } from '../execution/batch-timeline'
|
|
111
114
|
import {
|
|
@@ -131,8 +134,20 @@ import { useDesktopDownload } from '../../hooks/useDesktopDownload'
|
|
|
131
134
|
import { useCompareLauncher } from '../compare/useCompareLauncher'
|
|
132
135
|
import { useDiagnoseCustomization } from '../../context/DiagnoseCustomization'
|
|
133
136
|
import { NodeDrainStatus } from './NodeDrainStatus'
|
|
137
|
+
import { recordUsageEvent } from '../../api/usage-data'
|
|
138
|
+
import { issueResourceOpener } from './issueResourceOpener'
|
|
134
139
|
|
|
135
140
|
type TabType = WorkloadTabType
|
|
141
|
+
|
|
142
|
+
// The usage-report view a tab counts under. Timeline holds the resource's
|
|
143
|
+
// events (it replaced the Events tab), so it counts as panel:events.
|
|
144
|
+
const PANEL_USAGE_VIEWS: Partial<Record<TabType, string>> = {
|
|
145
|
+
logs: 'panel:logs',
|
|
146
|
+
yaml: 'panel:yaml',
|
|
147
|
+
metrics: 'panel:metrics',
|
|
148
|
+
timeline: 'panel:events',
|
|
149
|
+
}
|
|
150
|
+
|
|
136
151
|
const BATCH_EXECUTION_KINDS = new Set([
|
|
137
152
|
'Job',
|
|
138
153
|
'CronJob',
|
|
@@ -357,6 +372,8 @@ function useActionsBarProps(
|
|
|
357
372
|
const argoRefreshMutation = useArgoRefresh()
|
|
358
373
|
const argoSuspendMutation = useArgoSuspend()
|
|
359
374
|
const argoResumeMutation = useArgoResume()
|
|
375
|
+
const { upgrade: argoResumeUpgrade, blockedReason: argoResumeBlockedReason } = useRadarFeature('argoAutoSyncEnable')
|
|
376
|
+
const { support: argoInheritanceSupport } = useRadarFeature('argoSyncInheritance')
|
|
360
377
|
|
|
361
378
|
const {
|
|
362
379
|
data: cascadePreview,
|
|
@@ -461,9 +478,10 @@ function useActionsBarProps(
|
|
|
461
478
|
onFluxResume: (params: Parameters<typeof fluxResumeMutation.mutate>[0]) =>
|
|
462
479
|
fluxResumeMutation.mutate(params),
|
|
463
480
|
isFluxResuming: fluxResumeMutation.isPending,
|
|
464
|
-
onArgoSync: (params: Parameters<typeof argoSyncMutation.
|
|
465
|
-
argoSyncMutation.
|
|
481
|
+
onArgoSync: (params: Parameters<typeof argoSyncMutation.mutateAsync>[0]) =>
|
|
482
|
+
argoSyncMutation.mutateAsync(params),
|
|
466
483
|
isArgoSyncing: argoSyncMutation.isPending,
|
|
484
|
+
argoSyncDialog: { pinsComparedRevision: argoInheritanceSupport === 'supported' },
|
|
467
485
|
onArgoRefresh: (params: Parameters<typeof argoRefreshMutation.mutate>[0]) =>
|
|
468
486
|
argoRefreshMutation.mutate(params),
|
|
469
487
|
isArgoRefreshing: argoRefreshMutation.isPending,
|
|
@@ -473,6 +491,8 @@ function useActionsBarProps(
|
|
|
473
491
|
onArgoResume: (params: Parameters<typeof argoResumeMutation.mutate>[0]) =>
|
|
474
492
|
argoResumeMutation.mutate(params),
|
|
475
493
|
isArgoResuming: argoResumeMutation.isPending,
|
|
494
|
+
argoResumeUpgrade,
|
|
495
|
+
argoResumeBlockedReason,
|
|
476
496
|
canNodeWrite,
|
|
477
497
|
onCordonNode: (params: Parameters<typeof cordonMutation.mutate>[0]) =>
|
|
478
498
|
cordonMutation.mutate(params),
|
|
@@ -526,8 +546,14 @@ export function WorkloadView({
|
|
|
526
546
|
? 'reachability' // the network tab was renamed Reachability
|
|
527
547
|
: (rawTab as TabType) || 'overview'
|
|
528
548
|
|
|
549
|
+
|
|
550
|
+
// A panel counts when someone switches to it. Counting renders instead would
|
|
551
|
+
// recount the same open tab: the drawer mounts hidden WorkloadView layers
|
|
552
|
+
// for expand-on-hover and crossfades.
|
|
529
553
|
const handleTabChange = useCallback(
|
|
530
554
|
(tab: TabType, opts?: { replace?: boolean }) => {
|
|
555
|
+
const panel = PANEL_USAGE_VIEWS[tab]
|
|
556
|
+
if (panel && tab !== migratedTab) recordUsageEvent({ type: 'view', name: panel })
|
|
531
557
|
const params = new URLSearchParams(searchParams)
|
|
532
558
|
if (tab === 'overview') {
|
|
533
559
|
params.delete('tab')
|
|
@@ -536,7 +562,7 @@ export function WorkloadView({
|
|
|
536
562
|
}
|
|
537
563
|
setSearchParams(params, { replace: opts?.replace ?? !pushTabHistory, state: location.state })
|
|
538
564
|
},
|
|
539
|
-
[pushTabHistory, searchParams, setSearchParams, location.state],
|
|
565
|
+
[migratedTab, pushTabHistory, searchParams, setSearchParams, location.state],
|
|
540
566
|
)
|
|
541
567
|
|
|
542
568
|
const selectedRunKey = searchParams.get('run') ?? ''
|
|
@@ -549,6 +575,13 @@ export function WorkloadView({
|
|
|
549
575
|
},
|
|
550
576
|
[searchParams, setSearchParams],
|
|
551
577
|
)
|
|
578
|
+
// A pushed entry, so Back returns to the graph.
|
|
579
|
+
const handleSelectTopologyMember = useCallback(
|
|
580
|
+
(memberKey: string) => {
|
|
581
|
+
setSearchParams(memberOverviewParams(searchParams, memberKey), { state: location.state })
|
|
582
|
+
},
|
|
583
|
+
[searchParams, setSearchParams, location.state],
|
|
584
|
+
)
|
|
552
585
|
|
|
553
586
|
// Fetch resource with relationships
|
|
554
587
|
const {
|
|
@@ -814,7 +847,9 @@ export function WorkloadView({
|
|
|
814
847
|
const isCronJob = apiKind === 'cronjobs' && (!effectiveGroup || effectiveGroup === 'batch')
|
|
815
848
|
const { support: coverageSupport } = useRadarFeature('resourceIssueCoverage')
|
|
816
849
|
const useCronJobCoverage = isCronJob && coverageSupport === 'supported'
|
|
817
|
-
const
|
|
850
|
+
const issueObservation = resource ? JSON.stringify([resource.metadata?.uid, resource.metadata?.resourceVersion]) : undefined
|
|
851
|
+
const ordinaryIssues = useResourceIssues(apiKind, rest.group, namespace, name,
|
|
852
|
+
rest.active !== false && !useCronJobCoverage && !isNotFoundError(resourceError), issueObservation)
|
|
818
853
|
const cronJobIssues = useSubjectIssues(useCronJobCoverage ? { kind: 'CronJob', group: 'batch', namespace, name, uid: resource?.metadata?.uid } : null, useCronJobCoverage && Boolean(resource))
|
|
819
854
|
const liveIssues = useCronJobCoverage ? cronJobIssues.data?.issues : ordinaryIssues.data
|
|
820
855
|
const issuesPending = useCronJobCoverage ? cronJobIssues.isPending : ordinaryIssues.isPending
|
|
@@ -826,6 +861,7 @@ export function WorkloadView({
|
|
|
826
861
|
}, [schedulingEvidence, handleTabChange])
|
|
827
862
|
const { data: auditFindings } = useResourceAudit(apiKind, namespace, name, effectiveGroup)
|
|
828
863
|
const hasOperationalIssues = Boolean(liveIssues?.length)
|
|
864
|
+
const openIssueResource = issueResourceOpener(rest.onNavigateToResource)
|
|
829
865
|
const {
|
|
830
866
|
onCompareTo,
|
|
831
867
|
onCompareAcrossClusters,
|
|
@@ -1178,6 +1214,8 @@ export function WorkloadView({
|
|
|
1178
1214
|
olderHistoryError={historyFallback ? null : olderHistoryError}
|
|
1179
1215
|
historyScoped={!historyFallback}
|
|
1180
1216
|
historyIncomplete={!historyFallback && Boolean(historyQuery.data?.incomplete)}
|
|
1217
|
+
historyCoverage={historyFallback ? undefined : historyQuery.data?.historyCoverage}
|
|
1218
|
+
historyGaps={historyFallback ? undefined : historyQuery.data?.gaps}
|
|
1181
1219
|
historyError={(historyFallback ? namespaceChanges.error : historyQuery.error) as Error | null}
|
|
1182
1220
|
onRetryHistory={() => void (historyFallback ? namespaceChanges.refetch() : historyQuery.refetch())}
|
|
1183
1221
|
relatedTimelineEvents={relatedTimelineEvents}
|
|
@@ -1205,6 +1243,8 @@ export function WorkloadView({
|
|
|
1205
1243
|
renderLogsTab={(props) => (
|
|
1206
1244
|
<LogsTabContent
|
|
1207
1245
|
{...props}
|
|
1246
|
+
resourceLoading={resourceLoading}
|
|
1247
|
+
resourceError={resourceError}
|
|
1208
1248
|
group={effectiveGroup}
|
|
1209
1249
|
selectedRunKey={selectedRunKey}
|
|
1210
1250
|
onSelectRun={handleSelectedRunChange}
|
|
@@ -1212,6 +1252,7 @@ export function WorkloadView({
|
|
|
1212
1252
|
/>
|
|
1213
1253
|
)}
|
|
1214
1254
|
{...resourceDetailSlots({ kind: apiKind, group: resource?.apiVersion ? resourceGroup : effectiveGroup, namespace, name }, rest.extraTabs)}
|
|
1255
|
+
onSelectTopologyMember={batchExecution && batchKind === 'JobSet' ? handleSelectTopologyMember : undefined}
|
|
1215
1256
|
renderExpandedOverview={({ kind: k, apiKind, namespace: ns, name: n, resource: res, leadContent }) =>
|
|
1216
1257
|
supportsBatchExecution(k, apiKind, effectiveGroup, res?.apiVersion) &&
|
|
1217
1258
|
res ? (
|
|
@@ -1298,7 +1339,12 @@ export function WorkloadView({
|
|
|
1298
1339
|
return (
|
|
1299
1340
|
<>
|
|
1300
1341
|
{diagnoseInline}
|
|
1342
|
+
<ApplicationEvidenceAction kind={k} namespace={ns} name={n} group={g} uid={resource?.metadata?.uid ?? ''} />
|
|
1301
1343
|
{diagnoseHint}
|
|
1344
|
+
<RelatedFindingsSection
|
|
1345
|
+
data={resourceResponse?.relatedFindings}
|
|
1346
|
+
onResourceClick={openIssueResource}
|
|
1347
|
+
/>
|
|
1302
1348
|
<AuditOverviewSection
|
|
1303
1349
|
findings={auditFindings ?? []}
|
|
1304
1350
|
onViewAll={() => navigateRouter('/checks')}
|
|
@@ -1314,17 +1360,7 @@ export function WorkloadView({
|
|
|
1314
1360
|
renderDetailSection={schedulingEvidence?.state === 'reported' ? ({ issue }) => issue.kind === 'CronJob' && issue.reason === schedulingEvidence.reason ? <CronJobSchedulingDetails evidence={schedulingEvidence} onViewTimeline={viewSchedulingReport} /> : null : undefined}
|
|
1315
1361
|
compact={!expanded}
|
|
1316
1362
|
subjectResource={{ kind: apiKind, namespace, name, group: rest.group }}
|
|
1317
|
-
onResourceClick={
|
|
1318
|
-
rest.onNavigateToResource
|
|
1319
|
-
? (ref) =>
|
|
1320
|
-
rest.onNavigateToResource?.({
|
|
1321
|
-
kind: kindToPluralWithGroup(ref.kind, ref.group ?? ''),
|
|
1322
|
-
namespace: ref.namespace ?? '',
|
|
1323
|
-
name: ref.name,
|
|
1324
|
-
group: ref.group ?? '',
|
|
1325
|
-
})
|
|
1326
|
-
: undefined
|
|
1327
|
-
}
|
|
1363
|
+
onResourceClick={openIssueResource}
|
|
1328
1364
|
/>
|
|
1329
1365
|
</div>
|
|
1330
1366
|
)}
|
|
@@ -1365,6 +1401,16 @@ export function WorkloadView({
|
|
|
1365
1401
|
)
|
|
1366
1402
|
}
|
|
1367
1403
|
|
|
1404
|
+
/** The search params that open `memberKey` in the Overview: the member and
|
|
1405
|
+
* the tab change in one write, since two writes from the same render would
|
|
1406
|
+
* each start from the old params and the second would drop the first. */
|
|
1407
|
+
export function memberOverviewParams(current: URLSearchParams, memberKey: string): URLSearchParams {
|
|
1408
|
+
const params = new URLSearchParams(current)
|
|
1409
|
+
params.set('run', memberKey)
|
|
1410
|
+
params.delete('tab')
|
|
1411
|
+
return params
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1368
1414
|
export function collectServingRefs(relationships: Relationships | undefined): ResourceRef[] {
|
|
1369
1415
|
if (!relationships) return []
|
|
1370
1416
|
return dedupeResourceRefs([
|
|
@@ -1484,6 +1530,8 @@ function LogsTabContent({
|
|
|
1484
1530
|
selectedRunKey,
|
|
1485
1531
|
onSelectRun,
|
|
1486
1532
|
viewNamespaces,
|
|
1533
|
+
resourceLoading,
|
|
1534
|
+
resourceError,
|
|
1487
1535
|
}: {
|
|
1488
1536
|
kind: string
|
|
1489
1537
|
apiKind: string
|
|
@@ -1499,6 +1547,8 @@ function LogsTabContent({
|
|
|
1499
1547
|
selectedRunKey: string
|
|
1500
1548
|
onSelectRun: (runKey: string) => void
|
|
1501
1549
|
viewNamespaces: string[]
|
|
1550
|
+
resourceLoading: boolean
|
|
1551
|
+
resourceError: Error | null
|
|
1502
1552
|
}) {
|
|
1503
1553
|
if (SCHEDULED_LOG_KINDS.has(kind) && supportsBatchExecution(kind, apiKind, group, resource?.apiVersion)) {
|
|
1504
1554
|
return (
|
|
@@ -1518,6 +1568,22 @@ function LogsTabContent({
|
|
|
1518
1568
|
const integrationLogs = resourceLogs({ kind, group, namespace, name }, resource)
|
|
1519
1569
|
if (integrationLogs) return integrationLogs
|
|
1520
1570
|
|
|
1571
|
+
if (isKubeRayCluster(kind, group, resource?.apiVersion)) {
|
|
1572
|
+
return (
|
|
1573
|
+
<RayClusterLogsTab
|
|
1574
|
+
namespace={namespace}
|
|
1575
|
+
name={name}
|
|
1576
|
+
uid={resource?.metadata?.uid}
|
|
1577
|
+
suspendRequested={resource?.spec?.suspend === true}
|
|
1578
|
+
rootLoading={resourceLoading}
|
|
1579
|
+
rootError={resourceError}
|
|
1580
|
+
historyPods={pods}
|
|
1581
|
+
selectedPod={selectedPod}
|
|
1582
|
+
onSelectPod={onSelectPod}
|
|
1583
|
+
/>
|
|
1584
|
+
)
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1521
1587
|
// Workload kinds with stable pod selectors use the aggregated workload logs viewer
|
|
1522
1588
|
if (WORKLOAD_LOG_KINDS.has(kind) && (kind !== 'Job' || isCoreBatchJob(apiKind, group))) {
|
|
1523
1589
|
return (
|
|
@@ -1613,85 +1679,6 @@ function PodLogsTab({
|
|
|
1613
1679
|
)
|
|
1614
1680
|
}
|
|
1615
1681
|
|
|
1616
|
-
function MultiPodLogsTab({
|
|
1617
|
-
pods,
|
|
1618
|
-
namespace,
|
|
1619
|
-
selectedPod,
|
|
1620
|
-
onSelectPod,
|
|
1621
|
-
initialContainer,
|
|
1622
|
-
}: {
|
|
1623
|
-
pods: ResourceRef[]
|
|
1624
|
-
namespace: string
|
|
1625
|
-
selectedPod: string | null
|
|
1626
|
-
onSelectPod: (name: string | null) => void
|
|
1627
|
-
initialContainer?: string | null
|
|
1628
|
-
}) {
|
|
1629
|
-
useEffect(() => {
|
|
1630
|
-
if (pods.length > 0 && !selectedPod) {
|
|
1631
|
-
onSelectPod(pods[0].name)
|
|
1632
|
-
}
|
|
1633
|
-
}, [pods, selectedPod, onSelectPod])
|
|
1634
|
-
|
|
1635
|
-
const podNamespace = pods.find((p) => p.name === selectedPod)?.namespace || namespace
|
|
1636
|
-
|
|
1637
|
-
// Fetch container list for the selected pod
|
|
1638
|
-
const { data: logsData } = usePodLogs(podNamespace, selectedPod || '', {
|
|
1639
|
-
tailLines: 1,
|
|
1640
|
-
})
|
|
1641
|
-
const containers = logsData?.containers || []
|
|
1642
|
-
|
|
1643
|
-
// A terminated pod (common for Job/CronJob children) has nothing to follow —
|
|
1644
|
-
// only stream live ones. Wait for the pod to load before deciding so we don't
|
|
1645
|
-
// briefly auto-stream a completed pod while its phase is still unknown.
|
|
1646
|
-
const { data: selectedPodResource } = useResource<any>('Pod', podNamespace, selectedPod || '')
|
|
1647
|
-
const phase = selectedPodResource?.status?.phase
|
|
1648
|
-
const autoStream = !!phase && phase !== 'Succeeded' && phase !== 'Failed'
|
|
1649
|
-
|
|
1650
|
-
if (pods.length === 0) {
|
|
1651
|
-
return (
|
|
1652
|
-
<div className="flex flex-col items-center justify-center h-full text-theme-text-tertiary">
|
|
1653
|
-
<Terminal className="w-12 h-12 mb-4 opacity-50" />
|
|
1654
|
-
<p>No pods available</p>
|
|
1655
|
-
</div>
|
|
1656
|
-
)
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
return (
|
|
1660
|
-
<div className="h-full flex flex-col">
|
|
1661
|
-
{pods.length > 1 && (
|
|
1662
|
-
<div className="shrink-0 border-b border-theme-border bg-theme-surface/50 px-4 py-2 flex gap-2 overflow-x-auto">
|
|
1663
|
-
{pods.map((pod) => (
|
|
1664
|
-
<button
|
|
1665
|
-
key={pod.name}
|
|
1666
|
-
onClick={() => onSelectPod(pod.name)}
|
|
1667
|
-
className={clsx(
|
|
1668
|
-
'px-3 py-1.5 text-sm rounded-lg whitespace-nowrap transition-colors',
|
|
1669
|
-
selectedPod === pod.name
|
|
1670
|
-
? 'bg-blue-500 text-theme-text-primary'
|
|
1671
|
-
: 'bg-theme-elevated text-theme-text-secondary hover:bg-theme-hover',
|
|
1672
|
-
)}
|
|
1673
|
-
>
|
|
1674
|
-
{pod.name.length > 40 ? '...' + pod.name.slice(-37) : pod.name}
|
|
1675
|
-
</button>
|
|
1676
|
-
))}
|
|
1677
|
-
</div>
|
|
1678
|
-
)}
|
|
1679
|
-
{selectedPod && containers.length > 0 && (
|
|
1680
|
-
<div className="flex-1 min-h-0">
|
|
1681
|
-
<LogsViewer
|
|
1682
|
-
key={selectedPod}
|
|
1683
|
-
namespace={podNamespace}
|
|
1684
|
-
podName={selectedPod}
|
|
1685
|
-
containers={containers}
|
|
1686
|
-
initialContainer={initialContainer || undefined}
|
|
1687
|
-
autoStream={autoStream}
|
|
1688
|
-
/>
|
|
1689
|
-
</div>
|
|
1690
|
-
)}
|
|
1691
|
-
</div>
|
|
1692
|
-
)
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
1682
|
function AuditOverviewSection({
|
|
1696
1683
|
findings,
|
|
1697
1684
|
onViewAll,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { recordUsageEvent } from '../../api/usage-data'
|
|
3
|
+
import { issueResourceOpener } from './issueResourceOpener'
|
|
4
|
+
|
|
5
|
+
vi.mock('../../api/usage-data', () => ({ recordUsageEvent: vi.fn() }))
|
|
6
|
+
|
|
7
|
+
describe('issueResourceOpener', () => {
|
|
8
|
+
afterEach(() => vi.mocked(recordUsageEvent).mockClear())
|
|
9
|
+
|
|
10
|
+
it('opens the resource and counts it once', () => {
|
|
11
|
+
const navigate = vi.fn()
|
|
12
|
+
issueResourceOpener(navigate)?.({ kind: 'Deployment', group: 'apps', namespace: 'shop', name: 'cart' })
|
|
13
|
+
expect(navigate).toHaveBeenCalledWith({ kind: 'deployments', namespace: 'shop', name: 'cart', group: 'apps' })
|
|
14
|
+
expect(vi.mocked(recordUsageEvent).mock.calls).toEqual([[{ type: 'ui', name: 'issue_action:open' }]])
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('leaves links off when the host has nowhere to navigate', () => {
|
|
18
|
+
expect(issueResourceOpener(undefined)).toBeUndefined()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { kindToPluralWithGroup, type IssueResourceRef } from '@skyhook-io/k8s-ui'
|
|
2
|
+
import { recordUsageEvent } from '../../api/usage-data'
|
|
3
|
+
import type { NavigateToResource } from '../../utils/navigation'
|
|
4
|
+
|
|
5
|
+
// Opens a resource linked from an issue or finding, and counts it for usage data.
|
|
6
|
+
export function issueResourceOpener(navigate: NavigateToResource | undefined) {
|
|
7
|
+
if (!navigate) return undefined
|
|
8
|
+
return (ref: IssueResourceRef) => {
|
|
9
|
+
recordUsageEvent({ type: 'ui', name: 'issue_action:open' })
|
|
10
|
+
navigate({
|
|
11
|
+
kind: kindToPluralWithGroup(ref.kind, ref.group ?? ''),
|
|
12
|
+
namespace: ref.namespace ?? '',
|
|
13
|
+
name: ref.name,
|
|
14
|
+
group: ref.group ?? '',
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
}
|