@skyhook-io/radar-app 1.21.8 → 1.22.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/package.json +1 -1
- package/src/App.tsx +16 -1
- package/src/api/client.ts +18 -0
- package/src/api/cnpg-history.ts +3 -3
- package/src/api/cnpg-storage.ts +3 -3
- package/src/api/diagnose.test.ts +34 -0
- package/src/api/diagnose.ts +17 -4
- package/src/api/radarFeatures.test.ts +13 -1
- package/src/api/radarFeatures.ts +6 -0
- package/src/api/resourceActions.test.ts +829 -0
- package/src/api/resourceActions.ts +584 -0
- package/src/api/resourceActions.ui.test.tsx +1882 -0
- package/src/api/reviewedActionMutation.ts +56 -28
- package/src/api/substrateHealth.ts +2 -3
- package/src/api/traefik.ts +33 -0
- package/src/api/traffic.ts +14 -5
- package/src/api/workloadMetrics.test.ts +11 -2
- package/src/api/workloadMetrics.ts +2 -2
- package/src/components/CloudFunnelButton.test.tsx +39 -1
- package/src/components/CloudFunnelButton.tsx +10 -3
- package/src/components/cnpg/CNPGOverview.test.tsx +75 -3
- package/src/components/cnpg/CNPGOverview.tsx +62 -4
- package/src/components/diagnose/AnalysisStory.test.tsx +12 -0
- package/src/components/diagnose/DiagnoseContext.question.test.tsx +34 -1
- package/src/components/diagnose/DiagnoseContext.tsx +28 -3
- package/src/components/diagnose/DiagnoseSurface.tsx +5 -4
- package/src/components/diagnose/Home.tsx +3 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +61 -0
- package/src/components/diagnose/InvestigationView.followupFailure.test.tsx +122 -0
- package/src/components/diagnose/InvestigationView.tsx +10 -2
- package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +1 -1
- package/src/components/diagnose/LocalDiagnoseAction.tsx +2 -2
- package/src/components/diagnose/QuestionComposer.test.tsx +16 -2
- package/src/components/diagnose/QuestionComposer.tsx +13 -8
- package/src/components/diagnose/diagnoseEvidenceTypes.ts +47 -8
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.test.ts +153 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +9 -13
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +21 -5
- package/src/components/diagnose/investigationEvidence/bodies/network.tsx +63 -26
- package/src/components/diagnose/launch.ts +1 -1
- package/src/components/dock/PodDebugSession.test.tsx +66 -0
- package/src/components/dock/PodDebugSession.tsx +3 -1
- package/src/components/dock/TerminalTab.test.tsx +43 -3
- package/src/components/dock/TerminalTab.tsx +10 -1
- package/src/components/helm/HelmReleaseDrawer.tsx +1 -1
- package/src/components/helm/InstallWizard.tsx +1 -1
- package/src/components/home/NetworkPolicyCoverageCard.test.tsx +37 -0
- package/src/components/home/NetworkPolicyCoverageCard.tsx +26 -2
- package/src/components/home/mcpToolCatalog.ts +1 -1
- package/src/components/resources/PodEvictAction.test.tsx +951 -0
- package/src/components/resources/PodEvictAction.tsx +167 -0
- package/src/components/resources/ResourcesView.tsx +3 -0
- 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/resources/renderers/WorkloadRenderer.tsx +3 -0
- package/src/components/settings/LocalConnectionSettings.tsx +4 -4
- package/src/components/settings/SettingsDialog.tsx +23 -18
- package/src/components/settings/integrationQueries.test.ts +98 -0
- package/src/components/settings/integrationQueries.ts +36 -0
- 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.reconnect.test.tsx +229 -0
- package/src/components/traffic/TrafficView.tsx +108 -41
- 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/Markdown.test.tsx +37 -0
- package/src/components/ui/Markdown.tsx +15 -2
- package/src/components/ui/command-items-crd.test.tsx +23 -8
- package/src/components/useContextSwitchFlow.test.tsx +27 -2
- package/src/components/useContextSwitchFlow.tsx +20 -22
- package/src/components/whats-new/releaseNotes.ts +75 -1
- package/src/components/workload/WorkloadView.tsx +16 -3
- package/src/integrations/resourceHosts.test.tsx +1 -1
- package/src/integrations/resourceHosts.tsx +3 -0
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { HomeView } from './components/home/HomeView'
|
|
|
9
9
|
import { DebugOverlay } from './components/DebugOverlay'
|
|
10
10
|
import { GlobalDiagnoseButton } from './components/diagnose/LocalDiagnoseAction'
|
|
11
11
|
import { switchInProgress } from './api/contextSwitch'
|
|
12
|
+
import { connectionHeaderValue } from './api/connectionBinding'
|
|
12
13
|
import { ContextSwitchActions } from './components/ContextSwitchActions'
|
|
13
14
|
import { investigationWorkspaceSearch, isInvestigationWorkspacePath, useDiagnoseLayout } from './components/diagnose/DiagnoseContext'
|
|
14
15
|
import { DiagnoseSurface } from './components/diagnose/DiagnoseSurface'
|
|
@@ -1164,6 +1165,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1164
1165
|
}>({ changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null })
|
|
1165
1166
|
const cnpgInvalidationPendingRef = useRef(false)
|
|
1166
1167
|
const veleroInvalidationPendingRef = useRef(false)
|
|
1168
|
+
// Traefik route facts scan every visible IngressRoute per request, so an open
|
|
1169
|
+
// drawer refreshes at most once per batch of this length.
|
|
1170
|
+
const traefikInvalidationRef = useRef<{ timer: number | null }>({ timer: null })
|
|
1167
1171
|
const slowInvalidationRef = useRef<{
|
|
1168
1172
|
updatedKinds: Set<string> // update-only churn → throttled list + dashboard
|
|
1169
1173
|
gitopsRowsChanged: boolean // Argo/Flux row and source kinds → GitOps table rows
|
|
@@ -1265,6 +1269,15 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1265
1269
|
}, 3000)
|
|
1266
1270
|
}
|
|
1267
1271
|
|
|
1272
|
+
// Traefik route facts join routes, Middlewares, Services, Pods and Secrets;
|
|
1273
|
+
// only an open drawer's query refetches.
|
|
1274
|
+
if (traefikInvalidationRef.current.timer === null) {
|
|
1275
|
+
traefikInvalidationRef.current.timer = window.setTimeout(() => {
|
|
1276
|
+
traefikInvalidationRef.current = { timer: null }
|
|
1277
|
+
queryClient.invalidateQueries({ queryKey: ['traefik'] })
|
|
1278
|
+
}, 15000)
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1268
1281
|
// SLOW tier — throttle expensive status churn. Workload membership changes
|
|
1269
1282
|
// also pass through here so the Applications refetch lands after its cache TTL.
|
|
1270
1283
|
if ((!structural || applicationWorkload || gitops.rows || gitops.counts) && slow.timer === null) {
|
|
@@ -1292,6 +1305,8 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1292
1305
|
if (fastInvalidationRef.current.timer !== null) clearTimeout(fastInvalidationRef.current.timer)
|
|
1293
1306
|
if (slowInvalidationRef.current.timer !== null) clearTimeout(slowInvalidationRef.current.timer)
|
|
1294
1307
|
if (timelineInvalidationRef.current.timer !== null) clearTimeout(timelineInvalidationRef.current.timer)
|
|
1308
|
+
if (traefikInvalidationRef.current.timer !== null) clearTimeout(traefikInvalidationRef.current.timer)
|
|
1309
|
+
traefikInvalidationRef.current = { timer: null }
|
|
1295
1310
|
fastInvalidationRef.current = { changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null }
|
|
1296
1311
|
slowInvalidationRef.current = { updatedKinds: new Set(), gitopsRowsChanged: false, gitopsCountsChanged: false, timer: null }
|
|
1297
1312
|
timelineInvalidationRef.current = { timer: null }
|
|
@@ -2773,7 +2788,7 @@ function App({ manageDocumentTitle = false, documentTitleSuffix, onClusterLoadSt
|
|
|
2773
2788
|
<CapabilitiesProvider>
|
|
2774
2789
|
<RadarUpgradeProvider>
|
|
2775
2790
|
<ContextSwitchProvider>
|
|
2776
|
-
<DockProvider>
|
|
2791
|
+
<DockProvider connectionId={connectionHeaderValue}>
|
|
2777
2792
|
<KeyboardShortcutProvider>
|
|
2778
2793
|
<AppInner
|
|
2779
2794
|
manageDocumentTitle={manageDocumentTitle}
|
package/src/api/client.ts
CHANGED
|
@@ -199,13 +199,19 @@ export function apiFetch(
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
let authMode: string | undefined;
|
|
202
|
+
let errorCode: string | undefined;
|
|
202
203
|
try {
|
|
203
204
|
const body = await response.clone().json();
|
|
204
205
|
authMode = body.authMode;
|
|
206
|
+
if (typeof body.code === "string") errorCode = body.code;
|
|
205
207
|
} catch {
|
|
206
208
|
console.warn("Authentication required (unable to determine auth mode)");
|
|
207
209
|
}
|
|
208
210
|
|
|
211
|
+
if (!authMode && errorCode === "identity_required") {
|
|
212
|
+
return response;
|
|
213
|
+
}
|
|
214
|
+
|
|
209
215
|
if (authMode === "oidc") {
|
|
210
216
|
// Only the first 401 in a burst navigates; concurrent 401s within the
|
|
211
217
|
// window are suppressed so they don't rotate radar_oidc_state. The gate
|
|
@@ -256,6 +262,10 @@ export class ApiError extends Error {
|
|
|
256
262
|
}
|
|
257
263
|
}
|
|
258
264
|
|
|
265
|
+
export function shouldRetryReplacedMember(failureCount: number, error: unknown): boolean {
|
|
266
|
+
return failureCount < 1 && error instanceof ApiError && (error.status === 409 || error.status === 503);
|
|
267
|
+
}
|
|
268
|
+
|
|
259
269
|
export function isForbiddenError(error: unknown): boolean {
|
|
260
270
|
return error instanceof ApiError && error.status === 403;
|
|
261
271
|
}
|
|
@@ -682,6 +692,9 @@ export interface DashboardNetworkPolicyCoverage {
|
|
|
682
692
|
coveredWorkloads: number;
|
|
683
693
|
coveredWorkloadsIfStaged?: number;
|
|
684
694
|
totalWorkloads: number;
|
|
695
|
+
// Workloads left out of totalWorkloads.
|
|
696
|
+
ignoredNamespaceWorkloads?: number;
|
|
697
|
+
hostNetworkWorkloads?: number;
|
|
685
698
|
}
|
|
686
699
|
|
|
687
700
|
export interface DashboardGitOpsControllers {
|
|
@@ -2616,6 +2629,9 @@ export interface CloudConnectSelf {
|
|
|
2616
2629
|
namespace?: string
|
|
2617
2630
|
name: string
|
|
2618
2631
|
}
|
|
2632
|
+
// 'nkp' when Nutanix NKP manages this install: wizardUrl then opens Radar
|
|
2633
|
+
// Cloud's NKP steps. Older Radar omits it.
|
|
2634
|
+
platform?: 'nkp'
|
|
2619
2635
|
wizardUrl?: string
|
|
2620
2636
|
}
|
|
2621
2637
|
|
|
@@ -4733,6 +4749,8 @@ export function useRightsizingScan(namespaces: string[], context = "") {
|
|
|
4733
4749
|
if (inaccessible) {
|
|
4734
4750
|
previous.current = null;
|
|
4735
4751
|
queryClient.setQueryData(cache.queryKey, null);
|
|
4752
|
+
} else if (current === null) {
|
|
4753
|
+
previous.current = null;
|
|
4736
4754
|
} else if (current && current.coverage.workloadsEvaluated > 0) {
|
|
4737
4755
|
previous.current = { scope, result: current };
|
|
4738
4756
|
}
|
package/src/api/cnpg-history.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query'
|
|
2
2
|
import type { CNPGFleetMetricsReading, Grant } from '@skyhook-io/k8s-ui'
|
|
3
|
-
import { fetchJSON, useRadarFeature } from './client'
|
|
3
|
+
import { fetchJSON, shouldRetryReplacedMember, useRadarFeature } from './client'
|
|
4
4
|
import { shouldRetryRadarQuery } from './radarFeatures'
|
|
5
5
|
import type { CNPGClusterActivityResponse } from './cnpg'
|
|
6
6
|
|
|
@@ -76,7 +76,7 @@ export function useCNPGClusterHistory(namespace: string, name: string, range: CN
|
|
|
76
76
|
refetchInterval: range === '15m' ? 30_000 : 60_000,
|
|
77
77
|
refetchIntervalInBackground: false,
|
|
78
78
|
staleTime: 10_000,
|
|
79
|
-
retry:
|
|
79
|
+
retry: shouldRetryReplacedMember,
|
|
80
80
|
placeholderData: (prev) => (prev?.range === range ? prev : undefined),
|
|
81
81
|
})
|
|
82
82
|
}
|
|
@@ -101,7 +101,7 @@ export function useCNPGFleetMetrics(namespaces: string[], enabled = true) {
|
|
|
101
101
|
enabled,
|
|
102
102
|
staleTime: 20_000,
|
|
103
103
|
refetchInterval: 60_000,
|
|
104
|
-
retry:
|
|
104
|
+
retry: shouldRetryReplacedMember,
|
|
105
105
|
placeholderData: (prev) => prev,
|
|
106
106
|
})
|
|
107
107
|
}
|
package/src/api/cnpg-storage.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query'
|
|
2
2
|
import type { CNPGDiskReading, CNPGMetricIsolation, Grant } from '@skyhook-io/k8s-ui'
|
|
3
|
-
import { fetchJSON, useRadarFeature } from './client'
|
|
3
|
+
import { fetchJSON, shouldRetryReplacedMember, useRadarFeature } from './client'
|
|
4
4
|
|
|
5
5
|
export type CNPGPVCRole = 'PG_DATA' | 'PG_WAL' | 'PG_TABLESPACE'
|
|
6
6
|
|
|
@@ -110,7 +110,7 @@ export function useCNPGClusterStorage(namespace: string, name: string, enabled =
|
|
|
110
110
|
refetchInterval: 30_000,
|
|
111
111
|
refetchIntervalInBackground: false,
|
|
112
112
|
staleTime: 10_000,
|
|
113
|
-
retry:
|
|
113
|
+
retry: shouldRetryReplacedMember,
|
|
114
114
|
placeholderData: (prev) => prev,
|
|
115
115
|
})
|
|
116
116
|
}
|
|
@@ -132,7 +132,7 @@ export function useCNPGFleetDisk(namespaces: string[], enabled = true) {
|
|
|
132
132
|
enabled,
|
|
133
133
|
staleTime: 20_000,
|
|
134
134
|
refetchInterval: 60_000,
|
|
135
|
-
retry:
|
|
135
|
+
retry: shouldRetryReplacedMember,
|
|
136
136
|
placeholderData: (prev) => prev,
|
|
137
137
|
})
|
|
138
138
|
}
|
package/src/api/diagnose.test.ts
CHANGED
|
@@ -438,3 +438,37 @@ describe("fetchAgents agents normalisation", () => {
|
|
|
438
438
|
expect(r.agents.map((a) => a.name)).toEqual(["claude"]);
|
|
439
439
|
});
|
|
440
440
|
});
|
|
441
|
+
|
|
442
|
+
describe("Diagnose writes name the tab's connection", () => {
|
|
443
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
444
|
+
|
|
445
|
+
it("sends the connection ID when starting a run and adding a turn", async () => {
|
|
446
|
+
const { observeConnectionStatus, resetConnectionBindingForTest, CONNECTION_HEADER } = await import("./connectionBinding");
|
|
447
|
+
resetConnectionBindingForTest();
|
|
448
|
+
observeConnectionStatus({ connectionId: "conn-a" });
|
|
449
|
+
const fetchMock = vi.fn(async () => new Response(JSON.stringify({ id: "run-1" }), { status: 200 }));
|
|
450
|
+
vi.stubGlobal("fetch", fetchMock);
|
|
451
|
+
await createRun({ kind: "Pod", group: "", namespace: "default", name: "web" });
|
|
452
|
+
await addTurn("run-1", { question: "why?" });
|
|
453
|
+
for (const [, init] of fetchMock.mock.calls as unknown as [string, RequestInit][]) {
|
|
454
|
+
expect((init.headers as Record<string, string>)[CONNECTION_HEADER]).toBe("conn-a");
|
|
455
|
+
}
|
|
456
|
+
expect(fetchMock).toHaveBeenCalledTimes(2);
|
|
457
|
+
resetConnectionBindingForTest();
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
describe("Diagnose names connection refusals in its own words", () => {
|
|
462
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
463
|
+
|
|
464
|
+
it.each([
|
|
465
|
+
["context_changed", 409, "The cluster changed since this view loaded"],
|
|
466
|
+
["cluster_unavailable", 503, "Radar isn't connected to a cluster right now"],
|
|
467
|
+
])("%s", async (code, status, text) => {
|
|
468
|
+
vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify({ error: "Nothing was changed: …", error_code: code }), { status })));
|
|
469
|
+
const err = await createRun({ kind: "Pod", group: "", namespace: "default", name: "web" }).catch((e: unknown) => e);
|
|
470
|
+
expect(err).toBeInstanceOf(DiagnoseError);
|
|
471
|
+
expect((err as DiagnoseError).message).toContain(text);
|
|
472
|
+
expect((err as DiagnoseError).message).not.toContain("Nothing was changed");
|
|
473
|
+
});
|
|
474
|
+
});
|
package/src/api/diagnose.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// on the user's own machine/subscription against Radar's MCP; this just starts
|
|
3
3
|
// the investigation and consumes its SSE event stream.
|
|
4
4
|
import { getApiBase, getAuthHeaders, getCredentialsMode } from "./config";
|
|
5
|
+
import { connectionHeaderValue, connectionHeaders } from "./connectionBinding";
|
|
5
6
|
|
|
6
7
|
export interface AgentInfo {
|
|
7
8
|
name: string;
|
|
@@ -20,8 +21,10 @@ export interface AgentInfo {
|
|
|
20
21
|
/** The backend re-checks the resource after an Apply. Absent means it does not. */
|
|
21
22
|
verification?: boolean;
|
|
22
23
|
/** The backend opens a run from a question, with or without a resource.
|
|
23
|
-
*
|
|
24
|
+
* Also enables resource-pinned questions. */
|
|
24
25
|
questions?: boolean;
|
|
26
|
+
/** The backend accepts an opening question about one selected resource. */
|
|
27
|
+
targetQuestions?: boolean;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
export interface AgentsResponse {
|
|
@@ -341,6 +344,13 @@ export interface DiagnoseRefusal {
|
|
|
341
344
|
// The sentence to show is `detail` when a host sends one, else `error`. A
|
|
342
345
|
// host's machine-readable code is `code`, or `error` when that is not the
|
|
343
346
|
// sentence itself.
|
|
347
|
+
const connectionRefusals: Record<string, string> = {
|
|
348
|
+
context_changed:
|
|
349
|
+
"The cluster changed since this view loaded. Check which cluster you're on and ask again.",
|
|
350
|
+
cluster_unavailable:
|
|
351
|
+
"Radar isn't connected to a cluster right now. Ask again once it reconnects.",
|
|
352
|
+
};
|
|
353
|
+
|
|
344
354
|
async function diagnoseError(res: Response): Promise<DiagnoseError> {
|
|
345
355
|
let body: Record<string, unknown> | null = null;
|
|
346
356
|
try {
|
|
@@ -353,7 +363,10 @@ async function diagnoseError(res: Response): Promise<DiagnoseError> {
|
|
|
353
363
|
typeof v === "string" && v.trim() !== "" ? v : undefined;
|
|
354
364
|
const detail = str(body?.detail);
|
|
355
365
|
const error = str(body?.error);
|
|
356
|
-
|
|
366
|
+
// The connection check refuses before Diagnose runs; its general wording is
|
|
367
|
+
// about writes ("Nothing was changed"), which reads oddly for an investigation.
|
|
368
|
+
const refusal = connectionRefusals[str(body?.error_code) ?? ""];
|
|
369
|
+
const message = refusal ?? detail ?? error ?? `request failed (${res.status})`;
|
|
357
370
|
return new DiagnoseError(res.status, message, {
|
|
358
371
|
code: str(body?.code) ?? (detail && error !== detail ? error : undefined),
|
|
359
372
|
reason: str(body?.reason),
|
|
@@ -475,7 +488,7 @@ export async function createRun(
|
|
|
475
488
|
const res = await fetch(RUNS(), {
|
|
476
489
|
method: "POST",
|
|
477
490
|
credentials: getCredentialsMode(),
|
|
478
|
-
headers: { "Content-Type": "application/json", ...getAuthHeaders() },
|
|
491
|
+
headers: { "Content-Type": "application/json", ...getAuthHeaders(), ...connectionHeaders(connectionHeaderValue()) },
|
|
479
492
|
body: JSON.stringify({ ...target, ...opts }),
|
|
480
493
|
});
|
|
481
494
|
if (!res.ok) throw await diagnoseError(res);
|
|
@@ -553,7 +566,7 @@ export async function addTurn(
|
|
|
553
566
|
const res = await fetch(`${RUNS()}/${id}/turns`, {
|
|
554
567
|
method: "POST",
|
|
555
568
|
credentials: getCredentialsMode(),
|
|
556
|
-
headers: { "Content-Type": "application/json", ...getAuthHeaders() },
|
|
569
|
+
headers: { "Content-Type": "application/json", ...getAuthHeaders(), ...connectionHeaders(connectionHeaderValue()) },
|
|
557
570
|
body: JSON.stringify(body),
|
|
558
571
|
});
|
|
559
572
|
if (!res.ok) throw await diagnoseError(res);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest'
|
|
2
2
|
import { getRadarUpgradeRequirement } from '@skyhook-io/k8s-ui'
|
|
3
|
-
import { ApiError } from './client'
|
|
3
|
+
import { ApiError, shouldRetryReplacedMember } from './client'
|
|
4
4
|
import {
|
|
5
5
|
RADAR_FEATURES,
|
|
6
6
|
RadarFeatureUnsupportedError,
|
|
@@ -187,6 +187,18 @@ describe('shouldRetryRadarQuery', () => {
|
|
|
187
187
|
})
|
|
188
188
|
})
|
|
189
189
|
|
|
190
|
+
describe('shouldRetryReplacedMember', () => {
|
|
191
|
+
it('retries only HTTP 409 and 503, once each', () => {
|
|
192
|
+
for (const status of [409, 503]) {
|
|
193
|
+
expect(shouldRetryReplacedMember(0, new ApiError('x', status))).toBe(true)
|
|
194
|
+
expect(shouldRetryReplacedMember(1, new ApiError('x', status))).toBe(false)
|
|
195
|
+
}
|
|
196
|
+
for (const error of [new ApiError('x', 404), new ApiError('x', 500), new TypeError('Failed to fetch')]) {
|
|
197
|
+
expect(shouldRetryReplacedMember(0, error)).toBe(false)
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
})
|
|
201
|
+
|
|
190
202
|
describe('affirmative mutation support', () => {
|
|
191
203
|
it.each(['argoRollback', 'argoAutoSyncEnable', 'workloadRestartPreconditions'] as const)('%s distinguishes checking, failed and known answers', feature => {
|
|
192
204
|
expect(radarControlBlockedReason(feature, 'unknown', false)).toBe("Checking this cluster's Radar…")
|
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 },
|
|
@@ -54,14 +55,18 @@ export const RADAR_FEATURES = {
|
|
|
54
55
|
drainPlan: { label: 'Drain plans', minimumVersion: 'v1.14.0' },
|
|
55
56
|
applications: { label: 'Applications', minimumVersion: 'v1.7.7' },
|
|
56
57
|
workloadHistory: { label: 'Workload history', flag: 'workloadHistory', flagShippedWithEndpoint: true },
|
|
58
|
+
workloadSource: { label: 'Workload source', flag: 'workloadSource', flagShippedWithEndpoint: true },
|
|
57
59
|
deploymentPause: { label: 'Deployment rollout pause and resume', flag: 'deploymentPause', flagShippedWithEndpoint: true },
|
|
58
60
|
substrateHealthMetrics: { label: 'Agent Substrate charts', flag: 'substrateHealthMetrics', flagShippedWithEndpoint: true, requireAffirmativeSupport: true },
|
|
59
61
|
cnpgWorkspace: { label: 'CloudNativePG views', flag: 'cnpgWorkspace', flagShippedWithEndpoint: true },
|
|
60
62
|
sealedSecretsController: { label: 'Sealed Secrets controller status', flag: 'sealedSecretsController', flagShippedWithEndpoint: true },
|
|
63
|
+
traefikRoutes: { label: 'Traefik routes', flag: 'traefikRoutes', flagShippedWithEndpoint: true },
|
|
61
64
|
sealedSecretsCert: { label: 'Sealed Secrets sealing certificate', flag: 'sealedSecretsCert', flagShippedWithEndpoint: true },
|
|
62
65
|
workflowStop: { label: 'Argo Workflow stop actions', flag: 'workflowStop', flagShippedWithEndpoint: true },
|
|
63
66
|
workflowTemplateSubmit: { label: 'Argo WorkflowTemplate submissions', flag: 'workflowTemplateSubmit', flagShippedWithEndpoint: true },
|
|
64
67
|
cnpgProtectionSetup: { label: 'CloudNativePG backup setup', flag: 'cnpgProtectionSetup', flagShippedWithEndpoint: true },
|
|
68
|
+
// Radars from v1.21.0 report these Checks in the workspace without advertising the flag.
|
|
69
|
+
cnpgPostureChecks: { label: 'CloudNativePG backup and availability counts', minimumVersion: 'v1.21.0', flag: 'cnpgPostureChecks' },
|
|
65
70
|
veleroWorkspace: { label: 'Velero views', flag: 'veleroWorkspace', flagShippedWithEndpoint: true },
|
|
66
71
|
veleroBackupNow: { label: 'Back up now', flag: 'veleroBackupNow', flagShippedWithEndpoint: true },
|
|
67
72
|
veleroSchedulePause: { label: 'Pause and resume Velero schedules', flag: 'veleroSchedulePause', flagShippedWithEndpoint: true },
|
|
@@ -70,6 +75,7 @@ export const RADAR_FEATURES = {
|
|
|
70
75
|
veleroRuns: { label: 'Velero backup and restore lists', flag: 'veleroRuns', flagShippedWithEndpoint: true },
|
|
71
76
|
veleroDeleteBackup: { label: 'Delete a Velero backup', flag: 'veleroDeleteBackup', flagShippedWithEndpoint: true },
|
|
72
77
|
workloadRestartPreconditions: { label: 'Reviewed workload restarts', flag: 'workloadRestartPreconditions', flagShippedWithEndpoint: true, requireAffirmativeSupport: true },
|
|
78
|
+
resourceActions: { label: 'Resource action preview and execute', flag: 'resourceActions', flagShippedWithEndpoint: true, requireAffirmativeSupport: true },
|
|
73
79
|
resourceDeletePreconditions: { label: 'Delete only the object you reviewed', flag: 'resourceDeletePreconditions', flagShippedWithEndpoint: true },
|
|
74
80
|
gitopsWriteEvidence: { label: 'GitOps revert warnings', flag: 'gitopsWriteEvidence', flagShippedWithEndpoint: true },
|
|
75
81
|
serviceEndpointSlices: { label: 'Service EndpointSlice inventories', flag: 'serviceEndpointSlices', flagShippedWithEndpoint: true },
|