@skyhook-io/radar-app 1.21.7 → 1.22.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/README.md +1 -1
- package/package.json +2 -2
- package/src/App.tsx +26 -3
- package/src/api/client.ts +16 -3
- package/src/api/radarFeatures.ts +4 -0
- package/src/api/traefik.ts +33 -0
- package/src/api/traffic.ts +1 -0
- package/src/components/CloudFunnelButton.test.tsx +39 -1
- package/src/components/CloudFunnelButton.tsx +10 -3
- package/src/components/NamespaceSwitcher.tsx +6 -2
- package/src/components/applications/ApplicationsView.identity.test.ts +35 -7
- package/src/components/applications/ApplicationsView.tsx +71 -142
- package/src/components/cnpg/CNPGOperatorConditions.test.tsx +3 -0
- package/src/components/cnpg/CNPGOperatorConditions.tsx +4 -14
- package/src/components/cnpg/CNPGOverview.test.tsx +75 -3
- package/src/components/cnpg/CNPGOverview.tsx +62 -4
- package/src/components/home/HomeView.tsx +9 -1
- package/src/components/home/NetworkPolicyCoverageCard.test.tsx +37 -0
- package/src/components/home/NetworkPolicyCoverageCard.tsx +26 -2
- package/src/components/home/ProblemsPanel.investigate.test.tsx +12 -2
- package/src/components/issues/IssuesPane.render.test.tsx +78 -2
- package/src/components/issues/IssuesPane.tsx +38 -6
- package/src/components/resources/renderers/TraefikIngressRouteRenderer.test.tsx +23 -0
- package/src/components/resources/renderers/TraefikIngressRouteRenderer.tsx +23 -0
- package/src/components/resources/renderers/TraefikMiddlewareRenderer.test.tsx +23 -0
- package/src/components/resources/renderers/TraefikMiddlewareRenderer.tsx +29 -0
- package/src/components/settings/FormSaveActions.tsx +6 -2
- package/src/components/settings/MetricsBackendSwitch.tsx +13 -15
- package/src/components/settings/OpenObserveSetup.test.tsx +68 -27
- package/src/components/settings/OpenObserveSetup.tsx +93 -123
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +23 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +5 -4
- package/src/components/traffic/TrafficFilterSidebar.test.tsx +14 -0
- package/src/components/traffic/TrafficFilterSidebar.tsx +17 -0
- package/src/components/traffic/TrafficFlowList.tsx +5 -5
- package/src/components/traffic/TrafficGraph.test.tsx +11 -0
- package/src/components/traffic/TrafficGraph.tsx +31 -19
- package/src/components/traffic/TrafficView.tsx +17 -6
- package/src/components/traffic/traffic-export.test.ts +8 -0
- package/src/components/traffic/traffic-export.ts +7 -4
- package/src/components/traffic/trafficFilters.test.ts +51 -1
- package/src/components/traffic/trafficFilters.ts +39 -11
- package/src/components/ui/command-items-crd.test.tsx +23 -8
- package/src/components/whats-new/releaseNotes.ts +75 -1
- package/src/components/workload/WorkloadView.tsx +8 -6
- package/src/components/workspace/WorkspaceConditions.tsx +56 -0
- package/src/components/workspace/layout.test.tsx +20 -0
- package/src/components/workspace/layout.tsx +1 -1
- package/src/contexts/CapabilitiesContext.tsx +2 -0
- package/src/integrations/resourceHosts.test.tsx +1 -1
- package/src/integrations/resourceHosts.tsx +3 -0
- package/src/utils/page-links.ts +15 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ This package is source-only — it ships TypeScript + TSX files under `src/`. Co
|
|
|
10
10
|
npm install @skyhook-io/radar-app
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Peer deps: `react >=19`, `react-dom >=19`, `react-router-dom >=7`, `@tanstack/react-query >=5`, `@skyhook-io/k8s-ui >=1.21.
|
|
13
|
+
Peer deps: `react >=19`, `react-dom >=19`, `react-router-dom >=7`, `@tanstack/react-query >=5`, `@skyhook-io/k8s-ui >=1.21.8`, plus `clsx`, `tailwind-merge`, `lucide-react`, `@xyflow/react`, `elkjs`.
|
|
14
14
|
|
|
15
15
|
## Use
|
|
16
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyhook-io/radar-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "Radar's full web UI as a reusable React component. Used by Radar's own binary and by external consumers like Radar Cloud.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"yaml": "^2.9.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@skyhook-io/k8s-ui": ">=1.21.
|
|
46
|
+
"@skyhook-io/k8s-ui": ">=1.21.9",
|
|
47
47
|
"@tanstack/react-query": ">=5",
|
|
48
48
|
"@xyflow/react": ">=12.0.0",
|
|
49
49
|
"clsx": ">=2",
|
package/src/App.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect, useLayoutEffect, useCallback, useMemo, useRef } from 'react'
|
|
2
2
|
import { flushSync } from 'react-dom'
|
|
3
|
-
import { isRightsizingScanPath } from './utils/page-links'
|
|
3
|
+
import { isRightsizingScanPath, useClearLinkedIssue } from './utils/page-links'
|
|
4
4
|
import { startViewTransitionSafe } from '@skyhook-io/k8s-ui/utils/view-transition'
|
|
5
5
|
import { englishPlural } from '@skyhook-io/k8s-ui/utils/pluralize'
|
|
6
6
|
import { useQueryClient } from '@tanstack/react-query'
|
|
@@ -367,6 +367,7 @@ interface AppProps {
|
|
|
367
367
|
function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterLoadStateChange }: AppProps) {
|
|
368
368
|
useLayoutEffect(() => () => resetNavigationMap(), [])
|
|
369
369
|
const navigate = useNavigate()
|
|
370
|
+
const clearLinkedIssue = useClearLinkedIssue()
|
|
370
371
|
const location = useLocation()
|
|
371
372
|
const navigationType = useNavigationType()
|
|
372
373
|
const [searchParams, setSearchParams] = useSearchParams()
|
|
@@ -1163,6 +1164,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1163
1164
|
}>({ changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null })
|
|
1164
1165
|
const cnpgInvalidationPendingRef = useRef(false)
|
|
1165
1166
|
const veleroInvalidationPendingRef = useRef(false)
|
|
1167
|
+
// Traefik route facts scan every visible IngressRoute per request, so an open
|
|
1168
|
+
// drawer refreshes at most once per batch of this length.
|
|
1169
|
+
const traefikInvalidationRef = useRef<{ timer: number | null }>({ timer: null })
|
|
1166
1170
|
const slowInvalidationRef = useRef<{
|
|
1167
1171
|
updatedKinds: Set<string> // update-only churn → throttled list + dashboard
|
|
1168
1172
|
gitopsRowsChanged: boolean // Argo/Flux row and source kinds → GitOps table rows
|
|
@@ -1264,6 +1268,15 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1264
1268
|
}, 3000)
|
|
1265
1269
|
}
|
|
1266
1270
|
|
|
1271
|
+
// Traefik route facts join routes, Middlewares, Services, Pods and Secrets;
|
|
1272
|
+
// only an open drawer's query refetches.
|
|
1273
|
+
if (traefikInvalidationRef.current.timer === null) {
|
|
1274
|
+
traefikInvalidationRef.current.timer = window.setTimeout(() => {
|
|
1275
|
+
traefikInvalidationRef.current = { timer: null }
|
|
1276
|
+
queryClient.invalidateQueries({ queryKey: ['traefik'] })
|
|
1277
|
+
}, 15000)
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1267
1280
|
// SLOW tier — throttle expensive status churn. Workload membership changes
|
|
1268
1281
|
// also pass through here so the Applications refetch lands after its cache TTL.
|
|
1269
1282
|
if ((!structural || applicationWorkload || gitops.rows || gitops.counts) && slow.timer === null) {
|
|
@@ -1291,6 +1304,8 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1291
1304
|
if (fastInvalidationRef.current.timer !== null) clearTimeout(fastInvalidationRef.current.timer)
|
|
1292
1305
|
if (slowInvalidationRef.current.timer !== null) clearTimeout(slowInvalidationRef.current.timer)
|
|
1293
1306
|
if (timelineInvalidationRef.current.timer !== null) clearTimeout(timelineInvalidationRef.current.timer)
|
|
1307
|
+
if (traefikInvalidationRef.current.timer !== null) clearTimeout(traefikInvalidationRef.current.timer)
|
|
1308
|
+
traefikInvalidationRef.current = { timer: null }
|
|
1294
1309
|
fastInvalidationRef.current = { changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null }
|
|
1295
1310
|
slowInvalidationRef.current = { updatedKinds: new Set(), gitopsRowsChanged: false, gitopsCountsChanged: false, timer: null }
|
|
1296
1311
|
timelineInvalidationRef.current = { timer: null }
|
|
@@ -1923,7 +1938,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1923
1938
|
scroll sideways at desktop width instead (see PHONE_READY_VIEWS). */}
|
|
1924
1939
|
<div
|
|
1925
1940
|
className={`relative flex bg-theme-base ${navCustomization.embedded ? 'h-full min-h-0' : 'h-screen'}`}
|
|
1926
|
-
style={{ minWidth:
|
|
1941
|
+
style={{ minWidth: isMobile && mainView === 'issues'
|
|
1942
|
+
? 0 // Issue rows adapt to the space beside the rail, even on a 360px phone.
|
|
1943
|
+
: (isMobile ? 360 : 800) + (showNavRail ? (navRailEffectivePinned ? 176 : 56) : 0) }}
|
|
1927
1944
|
>
|
|
1928
1945
|
{showNavRail && (
|
|
1929
1946
|
<PrimaryNavRail
|
|
@@ -1964,6 +1981,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1964
1981
|
variant="segment"
|
|
1965
1982
|
disabled={namespaceFilter.disabled}
|
|
1966
1983
|
disabledTooltip={namespaceFilter.tooltip}
|
|
1984
|
+
onApply={mainView === 'issues' ? clearLinkedIssue : undefined}
|
|
1967
1985
|
/>
|
|
1968
1986
|
</ScopePill>
|
|
1969
1987
|
{/* Connection status — a fixed-size dot (state in the tooltip), an
|
|
@@ -2037,7 +2055,11 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2037
2055
|
navigate({ pathname: `/resources/${kind}`, search: params.toString() })
|
|
2038
2056
|
}}
|
|
2039
2057
|
onSwitchContext={commandSwitch.requestSwitch}
|
|
2040
|
-
onSetNamespaces={(ns) => {
|
|
2058
|
+
onSetNamespaces={(ns) => {
|
|
2059
|
+
if (mainView === 'issues') clearLinkedIssue()
|
|
2060
|
+
setNamespaces(ns)
|
|
2061
|
+
setActiveNamespace.mutate({ namespaces: ns })
|
|
2062
|
+
}}
|
|
2041
2063
|
onToggleTheme={toggleTheme}
|
|
2042
2064
|
onShowDiagnostics={() => setShowDiagnostics(true)}
|
|
2043
2065
|
onShowWhatsNew={whatsNewStatus.available ? openWhatsNew : undefined}
|
|
@@ -2221,6 +2243,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2221
2243
|
topology={topology}
|
|
2222
2244
|
fallbackClusterLoadState={showHomeClusterLoadFallback ? clusterLoadState : undefined}
|
|
2223
2245
|
onNavigateToView={setMainView}
|
|
2246
|
+
onNavigateToIssue={takeover.issues ? undefined : (id) => setMainView('issues', { issue: id })}
|
|
2224
2247
|
onNavigateToHelmRelease={navCustomization.embedded ? undefined : navigateToHelmRelease}
|
|
2225
2248
|
onNavigateToManagerPath={navCustomization.embedded || takeover.gitops ? undefined : navigateToPath}
|
|
2226
2249
|
// Upgrade impact lives under /checks, which a Cloud host takes
|
package/src/api/client.ts
CHANGED
|
@@ -682,6 +682,9 @@ export interface DashboardNetworkPolicyCoverage {
|
|
|
682
682
|
coveredWorkloads: number;
|
|
683
683
|
coveredWorkloadsIfStaged?: number;
|
|
684
684
|
totalWorkloads: number;
|
|
685
|
+
// Workloads left out of totalWorkloads.
|
|
686
|
+
ignoredNamespaceWorkloads?: number;
|
|
687
|
+
hostNetworkWorkloads?: number;
|
|
685
688
|
}
|
|
686
689
|
|
|
687
690
|
export interface DashboardGitOpsControllers {
|
|
@@ -859,7 +862,8 @@ export interface IssuesResponse {
|
|
|
859
862
|
recent_changes_guidance?: string
|
|
860
863
|
recent_changes_truncated?: boolean
|
|
861
864
|
// Present when the recent-changes window starts before the history Radar
|
|
862
|
-
// holds; complete_since is sent only to callers
|
|
865
|
+
// holds; when events were evicted, complete_since is sent only to callers
|
|
866
|
+
// who can read every namespace.
|
|
863
867
|
recent_changes_history_coverage?: {
|
|
864
868
|
incomplete: boolean
|
|
865
869
|
complete_since?: string
|
|
@@ -2615,6 +2619,9 @@ export interface CloudConnectSelf {
|
|
|
2615
2619
|
namespace?: string
|
|
2616
2620
|
name: string
|
|
2617
2621
|
}
|
|
2622
|
+
// 'nkp' when Nutanix NKP manages this install: wizardUrl then opens Radar
|
|
2623
|
+
// Cloud's NKP steps. Older Radar omits it.
|
|
2624
|
+
platform?: 'nkp'
|
|
2618
2625
|
wizardUrl?: string
|
|
2619
2626
|
}
|
|
2620
2627
|
|
|
@@ -2877,6 +2884,12 @@ export function useTopology(
|
|
|
2877
2884
|
});
|
|
2878
2885
|
}
|
|
2879
2886
|
|
|
2887
|
+
interface ApplicationsResponse {
|
|
2888
|
+
applications: AppRow[];
|
|
2889
|
+
/** Absent when Radar could not establish inventory coverage. */
|
|
2890
|
+
access?: { restricted: boolean };
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2880
2893
|
export function useApplications(
|
|
2881
2894
|
namespaces: string[],
|
|
2882
2895
|
options?: { enabled?: boolean },
|
|
@@ -2887,11 +2900,11 @@ export function useApplications(
|
|
|
2887
2900
|
|
|
2888
2901
|
const enabled = options?.enabled !== false;
|
|
2889
2902
|
const { guard, gatedKey } = useRadarFeature("applications");
|
|
2890
|
-
return useQuery<
|
|
2903
|
+
return useQuery<ApplicationsResponse>({
|
|
2891
2904
|
queryKey: ["applications", namespaces, ...gatedKey],
|
|
2892
2905
|
queryFn: () =>
|
|
2893
2906
|
guard(() =>
|
|
2894
|
-
fetchJSON<
|
|
2907
|
+
fetchJSON<ApplicationsResponse>(
|
|
2895
2908
|
`/applications${queryString ? `?${queryString}` : ""}`,
|
|
2896
2909
|
),
|
|
2897
2910
|
),
|
package/src/api/radarFeatures.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface RadarFeatureSpec {
|
|
|
32
32
|
export const RADAR_FEATURES = {
|
|
33
33
|
datadogRightsizing: { label: 'Datadog-backed rightsizing', flag: 'datadogRightsizing', flagShippedWithEndpoint: true, requireAffirmativeSupport: true },
|
|
34
34
|
datadogAgentPresence: { label: 'Datadog Agent setup hints', flag: 'datadogAgentPresence', flagShippedWithEndpoint: true },
|
|
35
|
+
ownerAccessGrantReview: { label: 'Cloud Owner permission checks', flag: 'ownerAccessGrantReview', flagShippedWithEndpoint: true },
|
|
35
36
|
gitopsActionCapabilities: { label: 'GitOps action permission checks', flag: 'gitopsActionCapabilities', flagShippedWithEndpoint: true },
|
|
36
37
|
openobserveCollectorPresence: { label: 'OpenObserve collector setup hints', flag: 'openobserveCollectorPresence', flagShippedWithEndpoint: true },
|
|
37
38
|
openobserveLocalSetup: { label: 'OpenObserve connections in Settings', flag: 'openobserveLocalSetup', flagShippedWithEndpoint: true },
|
|
@@ -58,10 +59,13 @@ export const RADAR_FEATURES = {
|
|
|
58
59
|
substrateHealthMetrics: { label: 'Agent Substrate charts', flag: 'substrateHealthMetrics', flagShippedWithEndpoint: true, requireAffirmativeSupport: true },
|
|
59
60
|
cnpgWorkspace: { label: 'CloudNativePG views', flag: 'cnpgWorkspace', flagShippedWithEndpoint: true },
|
|
60
61
|
sealedSecretsController: { label: 'Sealed Secrets controller status', flag: 'sealedSecretsController', flagShippedWithEndpoint: true },
|
|
62
|
+
traefikRoutes: { label: 'Traefik routes', flag: 'traefikRoutes', flagShippedWithEndpoint: true },
|
|
61
63
|
sealedSecretsCert: { label: 'Sealed Secrets sealing certificate', flag: 'sealedSecretsCert', flagShippedWithEndpoint: true },
|
|
62
64
|
workflowStop: { label: 'Argo Workflow stop actions', flag: 'workflowStop', flagShippedWithEndpoint: true },
|
|
63
65
|
workflowTemplateSubmit: { label: 'Argo WorkflowTemplate submissions', flag: 'workflowTemplateSubmit', flagShippedWithEndpoint: true },
|
|
64
66
|
cnpgProtectionSetup: { label: 'CloudNativePG backup setup', flag: 'cnpgProtectionSetup', flagShippedWithEndpoint: true },
|
|
67
|
+
// Radars from v1.21.0 report these Checks in the workspace without advertising the flag.
|
|
68
|
+
cnpgPostureChecks: { label: 'CloudNativePG backup and availability counts', minimumVersion: 'v1.21.0', flag: 'cnpgPostureChecks' },
|
|
65
69
|
veleroWorkspace: { label: 'Velero views', flag: 'veleroWorkspace', flagShippedWithEndpoint: true },
|
|
66
70
|
veleroBackupNow: { label: 'Back up now', flag: 'veleroBackupNow', flagShippedWithEndpoint: true },
|
|
67
71
|
veleroSchedulePause: { label: 'Pause and resume Velero schedules', flag: 'veleroSchedulePause', flagShippedWithEndpoint: true },
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import type { TraefikRoutesResponse } from '@skyhook-io/k8s-ui'
|
|
3
|
+
import { fetchJSON, useRadarFeature } from './client'
|
|
4
|
+
import { shouldRetryRadarQuery } from './radarFeatures'
|
|
5
|
+
|
|
6
|
+
// One IngressRoute's rule facts, with usedBy for its middlewares.
|
|
7
|
+
// group tells the two Traefik API groups apart; an older Radar ignores it.
|
|
8
|
+
export function useTraefikRouteFacts(namespace: string, name: string, group: string) {
|
|
9
|
+
const { support, guard, gatedKey } = useRadarFeature('traefikRoutes')
|
|
10
|
+
const query = useQuery({
|
|
11
|
+
queryKey: ['traefik', 'routes', 'route', group, namespace, name, ...gatedKey],
|
|
12
|
+
queryFn: ({ signal }) => guard(() => fetchJSON<TraefikRoutesResponse>(`/traefik/routes?namespace=${encodeURIComponent(namespace)}&name=${encodeURIComponent(name)}&group=${encodeURIComponent(group)}`, signal)),
|
|
13
|
+
enabled: !!namespace && !!name && support !== 'unsupported',
|
|
14
|
+
staleTime: 30_000,
|
|
15
|
+
retry: shouldRetryRadarQuery,
|
|
16
|
+
})
|
|
17
|
+
return { ...query, support }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// The IngressRoute rules that use one Middleware (at most 200).
|
|
21
|
+
export function useTraefikMiddlewareUsers(namespace: string, name: string) {
|
|
22
|
+
const { support, guard, gatedKey } = useRadarFeature('traefikRoutes')
|
|
23
|
+
const query = useQuery({
|
|
24
|
+
queryKey: ['traefik', 'routes', 'middleware', namespace, name, ...gatedKey],
|
|
25
|
+
queryFn: ({ signal }) => guard(() => fetchJSON<TraefikRoutesResponse>(`/traefik/routes?middleware=${encodeURIComponent(`${namespace}/${name}`)}`, signal)),
|
|
26
|
+
enabled: !!namespace && !!name && support !== 'unsupported',
|
|
27
|
+
staleTime: 30_000,
|
|
28
|
+
// While IngressRoutes are still syncing the drawer shows nothing; ask again.
|
|
29
|
+
refetchInterval: (q) => (q.state.data?.coverage?.ingressroutes?.state === 'syncing' ? 3_000 : false),
|
|
30
|
+
retry: shouldRetryRadarQuery,
|
|
31
|
+
})
|
|
32
|
+
return { ...query, support }
|
|
33
|
+
}
|
package/src/api/traffic.ts
CHANGED
|
@@ -24,6 +24,8 @@ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
|
24
24
|
let root: Root
|
|
25
25
|
let client: QueryClient
|
|
26
26
|
let lane: 'driver' | 'wizard'
|
|
27
|
+
let deploymentMode: 'local' | 'in-cluster'
|
|
28
|
+
let selfBody: Record<string, unknown>
|
|
27
29
|
let discovery: { connected: { namespace: string; deployment: string; clusterUrl: string }[] }
|
|
28
30
|
let discoveryStatus: number
|
|
29
31
|
let flowState: 'idle' | 'awaiting_approval'
|
|
@@ -36,6 +38,8 @@ const requests: string[] = []
|
|
|
36
38
|
beforeEach(() => {
|
|
37
39
|
connection.state = 'connecting'
|
|
38
40
|
lane = 'driver'
|
|
41
|
+
deploymentMode = 'local'
|
|
42
|
+
selfBody = { ownership: 'unknown' }
|
|
39
43
|
discovery = { connected: [] }
|
|
40
44
|
discoveryStatus = 200
|
|
41
45
|
flowState = 'idle'
|
|
@@ -51,12 +55,13 @@ beforeEach(() => {
|
|
|
51
55
|
const url = new URL(input, 'http://localhost')
|
|
52
56
|
requests.push(url.pathname + url.search)
|
|
53
57
|
const bodies: Record<string, unknown> = {
|
|
54
|
-
'/api/capabilities': { cloudConnect: { lane, appUrl: 'https://cloud.example', apiUrl: 'https://cloud.example' }, deployment: { mode:
|
|
58
|
+
'/api/capabilities': { cloudConnect: { lane, appUrl: 'https://cloud.example', apiUrl: 'https://cloud.example' }, deployment: { mode: deploymentMode } },
|
|
55
59
|
'/api/cluster-info': { context: 'test-cluster' },
|
|
56
60
|
'/api/cloud/install/status': statusBody ?? { state: flowState },
|
|
57
61
|
'/api/cloud/install/discover': discoveryStatus === 200 ? discovery : { error: 'Discovery failed' },
|
|
58
62
|
'/api/cloud/install/prepare': { error: 'Not connected to cluster' },
|
|
59
63
|
'/api/connect/info': {},
|
|
64
|
+
'/api/cloud/connect/self': selfBody,
|
|
60
65
|
}
|
|
61
66
|
if (!(url.pathname in bodies)) throw new Error(`Unexpected request: ${input}`)
|
|
62
67
|
if (url.pathname.endsWith('/prepare') && prepareReply) return prepareReply.promise
|
|
@@ -178,6 +183,39 @@ describe('Cloud dialog connection availability', () => {
|
|
|
178
183
|
expect(requests).not.toContain('/api/cloud/install/discover')
|
|
179
184
|
})
|
|
180
185
|
|
|
186
|
+
it('shows the NKP steps on NKP even when Radar cannot tell how it was installed', async () => {
|
|
187
|
+
lane = 'wizard'
|
|
188
|
+
deploymentMode = 'in-cluster'
|
|
189
|
+
connection.state = 'connected'
|
|
190
|
+
const nkpUrl = 'https://cloud.example/install?clusters=many&platform=nkp&utm_content=wizard-install-link-nkp-install'
|
|
191
|
+
selfBody = { ownership: 'unknown', platform: 'nkp', wizardUrl: nkpUrl }
|
|
192
|
+
await openDialog()
|
|
193
|
+
await until(() => expect(document.body.textContent).toContain('NKP manages this Radar'))
|
|
194
|
+
const link = Array.from(document.querySelectorAll('a')).find(element => element.textContent === 'Connect your NKP workspace')!
|
|
195
|
+
expect(link.href).toBe(nkpUrl)
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
it('sends an NKP-managed install to the NKP steps without asking for a repository change', async () => {
|
|
199
|
+
lane = 'wizard'
|
|
200
|
+
deploymentMode = 'in-cluster'
|
|
201
|
+
connection.state = 'connected'
|
|
202
|
+
const nkpUrl = 'https://cloud.example/install?clusters=many&platform=nkp&utm_content=wizard-install-link-nkp-install'
|
|
203
|
+
selfBody = {
|
|
204
|
+
ownership: 'gitops',
|
|
205
|
+
namespace: 'ws',
|
|
206
|
+
release: 'ws-radar',
|
|
207
|
+
controller: 'HelmRelease ws/radar',
|
|
208
|
+
platform: 'nkp',
|
|
209
|
+
wizardUrl: nkpUrl,
|
|
210
|
+
}
|
|
211
|
+
await openDialog()
|
|
212
|
+
await until(() => expect(document.body.textContent).toContain('NKP manages this Radar'))
|
|
213
|
+
expect(document.body.textContent).toContain("paste into the Radar app's configuration in NKP")
|
|
214
|
+
expect(document.body.textContent).not.toContain('values change in your repository')
|
|
215
|
+
const link = Array.from(document.querySelectorAll('a')).find(element => element.textContent === 'Connect your NKP workspace')!
|
|
216
|
+
expect(link.href).toBe(nkpUrl)
|
|
217
|
+
})
|
|
218
|
+
|
|
181
219
|
it('keeps an active server-owned install visible even while disconnected', async () => {
|
|
182
220
|
connection.state = 'disconnected'
|
|
183
221
|
flowState = 'awaiting_approval'
|
|
@@ -525,15 +525,22 @@ function ModalFooter({
|
|
|
525
525
|
// evidence it could not verify). A GitOps install with a link goes to the
|
|
526
526
|
// wizard's Argo/Flux tab, which generates a values patch for the repo rather
|
|
527
527
|
// than an imperative command the controller would revert.
|
|
528
|
+
const nkp = self?.platform === 'nkp'
|
|
528
529
|
const cliOnly = (gitops || ambiguous) && !self?.wizardUrl
|
|
529
530
|
// Until classification resolves we cannot know which lane applies, and a
|
|
530
531
|
// fast click would escape to signup before we could route this install.
|
|
531
532
|
const selfPending = selfLoading === true
|
|
532
533
|
return (
|
|
533
534
|
<div className="shrink-0 px-8 py-6 bg-theme-base border-t border-theme-border">
|
|
534
|
-
{self && self.ownership !== 'unknown' && (
|
|
535
|
+
{self && (self.ownership !== 'unknown' || nkp) && (
|
|
535
536
|
<div className="mb-3.5 card-inner p-3 text-[12px] leading-relaxed text-theme-text-secondary">
|
|
536
|
-
{
|
|
537
|
+
{nkp ? (
|
|
538
|
+
<>
|
|
539
|
+
NKP manages this Radar, so a change made to it directly would be undone. Radar Cloud gives you
|
|
540
|
+
settings to paste into the Radar app's configuration in NKP. They apply to every cluster in the
|
|
541
|
+
workspace.
|
|
542
|
+
</>
|
|
543
|
+
) : ambiguous ? (
|
|
537
544
|
<>
|
|
538
545
|
Radar found conflicting management metadata on this install, so it can't say whether a Helm
|
|
539
546
|
upgrade or a repository change is the right move. Run{' '}
|
|
@@ -628,7 +635,7 @@ function ModalFooter({
|
|
|
628
635
|
onClick={(e) => { if (selfPending) e.preventDefault() }}
|
|
629
636
|
className={`px-5 py-2 rounded-[10px] bg-emerald-500 hover:bg-emerald-400 text-emerald-950 text-[13.5px] font-bold shadow-[0_0_22px_rgba(16,185,129,0.35)] hover:shadow-[0_0_30px_rgba(16,185,129,0.5)] hover:-translate-y-px transition-all ${selfPending ? 'opacity-60 pointer-events-none' : ''}`}
|
|
630
637
|
>
|
|
631
|
-
{lane === 'driver' ? 'Continue in Radar Cloud' : self?.ownership === 'helm' || gitops ? 'Connect this cluster' : 'Try Cloud free'}
|
|
638
|
+
{lane === 'driver' ? 'Continue in Radar Cloud' : nkp ? 'Connect your NKP workspace' : self?.ownership === 'helm' || gitops ? 'Connect this cluster' : 'Try Cloud free'}
|
|
632
639
|
</a>
|
|
633
640
|
)}
|
|
634
641
|
{/* Self-Managed is a paid product with its own trial, so it gets a real
|
|
@@ -10,6 +10,7 @@ interface NamespaceSwitcherProps {
|
|
|
10
10
|
className?: string
|
|
11
11
|
disabled?: boolean
|
|
12
12
|
disabledTooltip?: string
|
|
13
|
+
onApply?: () => void
|
|
13
14
|
variant?: 'chip' | 'segment'
|
|
14
15
|
label?: string
|
|
15
16
|
}
|
|
@@ -20,7 +21,7 @@ interface NamespaceSwitcherProps {
|
|
|
20
21
|
* hooks; Radar Hub supplies its own container over the per-cluster apiBase.
|
|
21
22
|
*/
|
|
22
23
|
export const NamespaceSwitcher = forwardRef<NamespaceSwitcherHandle, NamespaceSwitcherProps>(function NamespaceSwitcher(
|
|
23
|
-
{ className, disabled, disabledTooltip, variant, label },
|
|
24
|
+
{ className, disabled, disabledTooltip, onApply, variant, label },
|
|
24
25
|
ref,
|
|
25
26
|
) {
|
|
26
27
|
const { data: scope, isLoading } = useNamespaceScope()
|
|
@@ -47,7 +48,10 @@ export const NamespaceSwitcher = forwardRef<NamespaceSwitcherHandle, NamespaceSw
|
|
|
47
48
|
scope={scope}
|
|
48
49
|
loading={isLoading}
|
|
49
50
|
pending={setActive.isPending}
|
|
50
|
-
onApply={namespaces =>
|
|
51
|
+
onApply={namespaces => {
|
|
52
|
+
onApply?.()
|
|
53
|
+
setActive.mutate({ namespaces })
|
|
54
|
+
}}
|
|
51
55
|
disabled={disabled}
|
|
52
56
|
disabledTooltip={disabledTooltip}
|
|
53
57
|
className={className}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
|
|
3
|
-
import type { AppWorkload, Issue } from '@skyhook-io/k8s-ui'
|
|
4
|
-
import {
|
|
3
|
+
import type { AppRow, AppWorkload, Issue } from '@skyhook-io/k8s-ui'
|
|
4
|
+
import { appIssuesForApplication } from './ApplicationsView'
|
|
5
5
|
|
|
6
6
|
function workload(group: string): AppWorkload {
|
|
7
7
|
return { kind: 'Job', group, namespace: 'ml', name: 'train', health: 'healthy', ready: 1, desired: 1, restarts: 0 }
|
|
@@ -24,16 +24,44 @@ function issue(id: string, group?: string): Issue {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
function application(key: string, workloads: AppWorkload[]): AppRow {
|
|
28
|
+
return { key, name: key, workloads } as AppRow
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('application issue membership', () => {
|
|
28
32
|
it('does not share an issue between same-named core and Volcano Jobs', () => {
|
|
29
33
|
const issues = [issue('core', 'batch'), issue('volcano', 'batch.volcano.sh')]
|
|
34
|
+
const core = application('core', [workload('batch')])
|
|
35
|
+
const volcano = application('volcano', [workload('batch.volcano.sh')])
|
|
30
36
|
|
|
31
|
-
expect(
|
|
32
|
-
expect(
|
|
37
|
+
expect(appIssuesForApplication(issues, core, [core, volcano], true).map(item => item.id)).toEqual(['core'])
|
|
38
|
+
expect(appIssuesForApplication(issues, volcano, [core, volcano], true).map(item => item.id)).toEqual(['volcano'])
|
|
33
39
|
})
|
|
34
40
|
|
|
35
41
|
it('treats an omitted built-in group as the canonical built-in identity', () => {
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
const core = application('core', [workload('batch')])
|
|
43
|
+
const volcano = application('volcano', [workload('batch.volcano.sh')])
|
|
44
|
+
|
|
45
|
+
expect(appIssuesForApplication([issue('legacy')], core, [core, volcano], true).map(item => item.id)).toEqual(['legacy'])
|
|
46
|
+
expect(appIssuesForApplication([issue('legacy')], volcano, [core, volcano], true)).toEqual([])
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('includes an issue on an owned Service alongside affected workloads, without duplicates', () => {
|
|
50
|
+
const app = application('checkout', [workload('batch')])
|
|
51
|
+
const service = { kind: 'Service', group: '', namespace: 'ml', name: 'checkout' }
|
|
52
|
+
app.relationships = { serviceRefs: [service] }
|
|
53
|
+
const endpoints = { ...issue('no-endpoints'), ...service, grouping_scope: 'service' }
|
|
54
|
+
const running = issue('workload', 'batch')
|
|
55
|
+
const affected = { ...issue('affected'), kind: 'Pod', name: 'pod-123', owner: workload('batch') }
|
|
56
|
+
const issues = [endpoints, running, running, affected]
|
|
57
|
+
|
|
58
|
+
expect(appIssuesForApplication(issues, app, [app], true).map(item => item.id))
|
|
59
|
+
.toEqual(['no-endpoints', 'workload', 'affected'])
|
|
60
|
+
expect(appIssuesForApplication(issues, app, [app], false).map(item => item.id))
|
|
61
|
+
.toEqual(['workload', 'affected'])
|
|
62
|
+
|
|
63
|
+
const other = { ...application('worker', []), relationships: { serviceRefs: [service] } }
|
|
64
|
+
expect(appIssuesForApplication(issues, app, [app, other], true).map(item => item.id))
|
|
65
|
+
.toEqual(['workload', 'affected'])
|
|
38
66
|
})
|
|
39
67
|
})
|