@skyhook-io/radar-app 1.20.0 → 1.20.3
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 +18 -11
- package/src/api/client.namespaceSwitch.hook.test.tsx +170 -1
- package/src/api/client.pauseDeployment.test.tsx +77 -0
- package/src/api/client.restartError.test.ts +14 -0
- package/src/api/client.revisionRefresh.test.tsx +44 -0
- package/src/api/client.rollbackError.test.ts +14 -0
- package/src/api/client.ts +287 -21
- package/src/api/helmInventory.test.tsx +108 -0
- package/src/api/networkAttachments.test.tsx +120 -0
- package/src/api/networkAttachments.ts +30 -0
- package/src/api/radarFeatures.test.ts +5 -0
- package/src/api/radarFeatures.ts +5 -0
- package/src/api/secretsStore.test.ts +33 -0
- package/src/api/secretsStore.ts +37 -0
- package/src/components/ConnectionErrorView.test.tsx +11 -0
- package/src/components/ConnectionErrorView.tsx +19 -0
- package/src/components/ContextSwitcher.tsx +9 -2
- package/src/components/applications/ApplicationsView.openResource.test.tsx +118 -0
- package/src/components/applications/ApplicationsView.tsx +8 -11
- package/src/components/cost/CostView.tsx +27 -9
- package/src/components/curl/ServiceCurlAvailability.test.tsx +32 -0
- package/src/components/curl/ServiceCurlButton.tsx +2 -2
- package/src/components/diagnose/InvestigationView.tsx +12 -3
- package/src/components/diagnose/investigationCase.test.tsx +41 -0
- package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +72 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.test.tsx +52 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.ts +61 -16
- 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/bodies/platform.tsx +82 -51
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/dock/TerminalPreferences.query.test.tsx +57 -0
- package/src/components/dock/TerminalPreferences.test.tsx +68 -0
- package/src/components/dock/TerminalPreferences.tsx +73 -0
- package/src/components/gitops/GitOpsView.tsx +1 -9
- package/src/components/helm/HelmDrawerFrame.tsx +101 -0
- package/src/components/helm/HelmDrawerRouting.test.tsx +86 -0
- package/src/components/helm/HelmReleaseDrawer.tsx +47 -98
- package/src/components/helm/HelmView.tsx +215 -71
- package/src/components/helm/NotCheckedBadge.test.tsx +62 -0
- package/src/components/helm/NotCheckedBadge.tsx +39 -0
- 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.test.tsx +86 -0
- package/src/components/helm/OwnedResources.tsx +69 -10
- package/src/components/home/ClusterHealthCard.heading.test.tsx +72 -0
- package/src/components/home/ClusterHealthCard.restricted.test.tsx +76 -0
- package/src/components/home/ClusterHealthCard.test.ts +44 -1
- package/src/components/home/ClusterHealthCard.tsx +49 -14
- package/src/components/home/HelmSummary.tsx +38 -19
- package/src/components/home/HelmSummary.unread.test.ts +16 -0
- package/src/components/home/HomeAgentBlock.tsx +7 -0
- package/src/components/home/MCPSetupDialog.test.tsx +38 -12
- package/src/components/home/MCPSetupDialog.tsx +5 -2
- package/src/components/home/mcpToolCatalog.ts +45 -5
- package/src/components/issues/uncheckedSources.test.ts +2 -0
- package/src/components/issues/uncheckedSources.ts +3 -0
- package/src/components/resource/RightsizingStrip.test.ts +57 -0
- package/src/components/resource/RightsizingStrip.tsx +53 -4
- package/src/components/resources/ImageFilesystemModal.test.tsx +74 -6
- package/src/components/resources/ImageFilesystemModal.tsx +98 -6
- package/src/components/resources/PodFileUploadPanel.tsx +150 -0
- package/src/components/resources/PodFilesystemModal.tsx +246 -3
- package/src/components/resources/pod-file-upload.test.tsx +223 -0
- package/src/components/resources/pod-file-upload.ts +266 -0
- package/src/components/resources/renderers/HTTPRouteRenderer.test.tsx +50 -0
- package/src/components/resources/renderers/HTTPRouteRenderer.tsx +27 -0
- package/src/components/resources/renderers/PodRenderer.tsx +26 -1
- package/src/components/resources/renderers/SecretProviderClassRenderer.tsx +25 -0
- package/src/components/resources/renderers/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/rightsizing/RightsizingScanView.tsx +16 -1
- package/src/components/rightsizing/model.test.ts +11 -0
- package/src/components/rightsizing/model.ts +3 -1
- package/src/components/rightsizing/presentation.test.ts +46 -0
- package/src/components/rightsizing/presentation.ts +17 -2
- package/src/components/traffic/TrafficView.tsx +27 -27
- package/src/components/traffic/trafficFilters.test.ts +18 -1
- package/src/components/traffic/trafficFilters.ts +30 -1
- package/src/components/ui/Omnibar.tsx +4 -1
- package/src/components/ui/RadarOmnibar.test.tsx +55 -2
- package/src/components/ui/RadarOmnibar.tsx +7 -1
- package/src/components/ui/SearchSyntaxHelp.test.tsx +9 -2
- package/src/components/ui/SearchSyntaxHelp.tsx +3 -2
- package/src/components/ui/UpdateNotification.test.tsx +23 -1
- package/src/components/ui/UpdateNotification.tsx +26 -2
- package/src/components/ui/omnibar-match.test.ts +7 -0
- package/src/components/ui/omnibar-match.ts +1 -0
- package/src/components/ui/searchCoverageNote.test.ts +17 -0
- package/src/components/ui/searchCoverageNote.ts +31 -7
- package/src/components/useContextSwitchFlow.tsx +9 -1
- package/src/components/whats-new/releaseNotes.ts +1 -1
- package/src/components/workload/NodeCertificateEvidence.test.tsx +51 -0
- package/src/components/workload/NodeCertificateEvidence.tsx +44 -0
- package/src/components/workload/WorkloadView.tsx +51 -11
- package/src/context/ConnectionContext.test.ts +1 -0
- package/src/context/ConnectionContext.tsx +2 -2
- package/src/contexts/CapabilitiesContext.tsx +2 -0
- package/src/hooks/useResolvedGitOpsOwner.test.ts +22 -0
- package/src/hooks/useResolvedGitOpsOwner.ts +6 -3
- package/src/integrations/resourceHosts.test.tsx +2 -2
- package/src/integrations/resourceHosts.tsx +9 -0
- package/src/utils/namespacePick.test.ts +87 -0
- package/src/utils/namespacePick.ts +88 -0
|
@@ -128,6 +128,7 @@ import {
|
|
|
128
128
|
rerunOpening,
|
|
129
129
|
} from "./target";
|
|
130
130
|
import { parseContextName } from "../../utils/context-name";
|
|
131
|
+
import { Tooltip } from "../ui/Tooltip";
|
|
131
132
|
import type { InvestigationSourceExcerpt } from "./investigationSourceFocus";
|
|
132
133
|
import { diagnosisHasStoryShape } from "./investigationStory";
|
|
133
134
|
import { assessmentStateLabel, verdictSentence } from "./verdictText";
|
|
@@ -2012,9 +2013,17 @@ export function InvestigationView({
|
|
|
2012
2013
|
<AlertTriangle className="h-4 w-4 shrink-0 text-amber-500" />
|
|
2013
2014
|
<span className="min-w-0 flex-1">
|
|
2014
2015
|
This investigation ran on{" "}
|
|
2015
|
-
<
|
|
2016
|
-
{
|
|
2017
|
-
|
|
2016
|
+
<Tooltip
|
|
2017
|
+
content={
|
|
2018
|
+
parseContextName(run.context).clusterName !== run.context
|
|
2019
|
+
? run.context
|
|
2020
|
+
: ""
|
|
2021
|
+
}
|
|
2022
|
+
>
|
|
2023
|
+
<span className="font-medium text-theme-text-primary">
|
|
2024
|
+
{parseContextName(run.context).clusterName}
|
|
2025
|
+
</span>
|
|
2026
|
+
</Tooltip>
|
|
2018
2027
|
. It is read-only because its agent session was closed after a
|
|
2019
2028
|
cluster switch.
|
|
2020
2029
|
</span>
|
|
@@ -841,6 +841,47 @@ describe("agent case placement (D-1, D-1b)", () => {
|
|
|
841
841
|
expect(resolved.items[0].placement).toBe("card");
|
|
842
842
|
});
|
|
843
843
|
|
|
844
|
+
it("places a citation of an observed Helm release stored in another namespace", () => {
|
|
845
|
+
const helmRef = evidenceRef("h", "o");
|
|
846
|
+
const projection = project(
|
|
847
|
+
tool("diag", "diagnose", diagnoseBundle, { evidenceRef: ref }),
|
|
848
|
+
tool(
|
|
849
|
+
"helm",
|
|
850
|
+
"get_helm_release",
|
|
851
|
+
{
|
|
852
|
+
summary: "Observed: Helm's release Secrets can't be read here.",
|
|
853
|
+
observed: {
|
|
854
|
+
name: "shop",
|
|
855
|
+
namespace: "shop",
|
|
856
|
+
storageNamespace: "flux-system",
|
|
857
|
+
chart: "shop",
|
|
858
|
+
chartVersion: "1.4.2",
|
|
859
|
+
resourceCount: 3,
|
|
860
|
+
},
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
evidenceRef: helmRef,
|
|
864
|
+
summary: JSON.stringify({ namespace: "flux-system", name: "shop" }),
|
|
865
|
+
},
|
|
866
|
+
),
|
|
867
|
+
);
|
|
868
|
+
const resolved = resolveInvestigationCase(
|
|
869
|
+
projection,
|
|
870
|
+
{
|
|
871
|
+
evidence: [
|
|
872
|
+
linked(helmRef, "context", "The release's chart is shop 1.4.2.", {
|
|
873
|
+
kind: "HelmRelease",
|
|
874
|
+
namespace: "shop",
|
|
875
|
+
name: "shop",
|
|
876
|
+
observation: "resource",
|
|
877
|
+
}),
|
|
878
|
+
],
|
|
879
|
+
},
|
|
880
|
+
0,
|
|
881
|
+
);
|
|
882
|
+
expect(resolved.items[0].placement).toBe("card");
|
|
883
|
+
});
|
|
884
|
+
|
|
844
885
|
it("keeps an ordinary listing's held entry to the listing's namespace", () => {
|
|
845
886
|
const listRef = evidenceRef("c", "e");
|
|
846
887
|
const projection = project(
|
|
@@ -457,6 +457,22 @@ describe("listing cards (helm releases, packages, search)", () => {
|
|
|
457
457
|
]);
|
|
458
458
|
});
|
|
459
459
|
|
|
460
|
+
it.each([[[]], [[{ name: "shop", namespace: "shop", chart: "shop" }]]])(
|
|
461
|
+
"keeps a partial Helm read's limits with its rows: %j",
|
|
462
|
+
(observed) => {
|
|
463
|
+
const summary = "Partial: 0 releases read from Helm and 1 observed.";
|
|
464
|
+
const projection = project([
|
|
465
|
+
tool("helm", "list_helm_releases", { summary, releases: [], observed }),
|
|
466
|
+
]);
|
|
467
|
+
expect(projection.limitations).toEqual(
|
|
468
|
+
expect.arrayContaining([
|
|
469
|
+
expect.objectContaining({ source: "Helm releases", kind: "unknown" }),
|
|
470
|
+
]),
|
|
471
|
+
);
|
|
472
|
+
expect(JSON.stringify(projection.limitations)).toContain(summary);
|
|
473
|
+
},
|
|
474
|
+
);
|
|
475
|
+
|
|
460
476
|
it("lists Helm releases with their status and chart", () => {
|
|
461
477
|
const projection = project([
|
|
462
478
|
tool(
|
|
@@ -497,6 +513,62 @@ describe("listing cards (helm releases, packages, search)", () => {
|
|
|
497
513
|
expect(data.resources[1].issue).toBe("0/1 pods ready");
|
|
498
514
|
});
|
|
499
515
|
|
|
516
|
+
it("lists observed Helm releases without a status of their own", () => {
|
|
517
|
+
const projection = project([
|
|
518
|
+
tool("helm", "list_helm_releases", {
|
|
519
|
+
summary: "Partial: 1 releases read from Helm and 1 observed.",
|
|
520
|
+
releases: [{ name: "podinfo", namespace: "shop", chart: "podinfo", chartVersion: "6.15.0", status: "failed", revision: 3 }],
|
|
521
|
+
observed: [{ name: "redis", namespace: "team-b", chart: "redis", chartVersion: "19.0.1", resourceCount: 2, healthIssue: "ImagePullBackOff" }],
|
|
522
|
+
storageDenied: { count: 1, names: ["team-b"] },
|
|
523
|
+
}),
|
|
524
|
+
]);
|
|
525
|
+
const [group] = groupsOf(projection.groups, "inventory");
|
|
526
|
+
const data = group.latest.data;
|
|
527
|
+
if (data.type !== "inventory") throw new Error("expected inventory");
|
|
528
|
+
expect(data.resources.map((row) => row.status)).toEqual([
|
|
529
|
+
"failed · podinfo 6.15.0",
|
|
530
|
+
"status unknown · redis 19.0.1",
|
|
531
|
+
]);
|
|
532
|
+
expect(data.resources[1].issue).toBe("ImagePullBackOff");
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
it("shows an observed get_helm_release as an observed row with its limits", () => {
|
|
536
|
+
const summary = "Observed: Helm's release Secrets can't be read here.";
|
|
537
|
+
const projection = project([
|
|
538
|
+
tool("helm", "get_helm_release", {
|
|
539
|
+
summary,
|
|
540
|
+
observed: { name: "redis", namespace: "team-b", chart: "redis", chartVersion: "19.0.1", resourceCount: 2, resources: [] },
|
|
541
|
+
}),
|
|
542
|
+
]);
|
|
543
|
+
const [group] = groupsOf(projection.groups, "inventory");
|
|
544
|
+
const data = group.latest.data;
|
|
545
|
+
if (data.type !== "inventory") throw new Error("expected inventory");
|
|
546
|
+
expect(data.resources.map((row) => row.status)).toEqual(["status unknown · redis 19.0.1"]);
|
|
547
|
+
expect(JSON.stringify(projection.limitations)).toContain(summary);
|
|
548
|
+
expect(JSON.stringify(projection.limitations)).not.toContain("couldn't summarize");
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
it.each([
|
|
552
|
+
["owns the target", "api", "producer-related"],
|
|
553
|
+
["doesn't own it", "worker", "broader"],
|
|
554
|
+
])("ranks an observed Helm release by whether it %s", (_, name, relevance) => {
|
|
555
|
+
const projection = project([
|
|
556
|
+
tool("diag", "diagnose", targetBundle),
|
|
557
|
+
tool("helm", "get_helm_release", {
|
|
558
|
+
summary: "Observed: Helm's release Secrets can't be read here.",
|
|
559
|
+
observed: {
|
|
560
|
+
name: "shop",
|
|
561
|
+
namespace: "shop",
|
|
562
|
+
chart: "shop",
|
|
563
|
+
resourceCount: 1,
|
|
564
|
+
resources: [{ kind: "Deployment", apiVersion: "apps/v1", namespace: "shop", name }],
|
|
565
|
+
},
|
|
566
|
+
}),
|
|
567
|
+
]);
|
|
568
|
+
const [group] = groupsOf(projection.groups, "inventory");
|
|
569
|
+
expect(group.latest.relevance).toBe(relevance);
|
|
570
|
+
});
|
|
571
|
+
|
|
500
572
|
it("lists packages with their version and sources", () => {
|
|
501
573
|
const projection = project([
|
|
502
574
|
tool(
|
|
@@ -3,6 +3,7 @@ import { investigationEvidenceSubjectRef } from "../index";
|
|
|
3
3
|
import { groupsOf, project, tool } from "../evidenceFixtures";
|
|
4
4
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
5
5
|
import { HelmBody } from "../bodies/platform";
|
|
6
|
+
import { EvidenceNavigationContext } from "../navigation";
|
|
6
7
|
|
|
7
8
|
const helmRelease = {
|
|
8
9
|
name: "shop",
|
|
@@ -302,4 +303,55 @@ describe("helm release card detail", () => {
|
|
|
302
303
|
expect(html).toContain("{ color, message }");
|
|
303
304
|
expect(html).toContain("[2 items]");
|
|
304
305
|
});
|
|
306
|
+
|
|
307
|
+
it("says how many objects were not checked and does not link them", () => {
|
|
308
|
+
const projection = project([
|
|
309
|
+
tool(
|
|
310
|
+
"helm",
|
|
311
|
+
"get_helm_release",
|
|
312
|
+
{
|
|
313
|
+
...helmRelease,
|
|
314
|
+
resourceHealth: "unknown",
|
|
315
|
+
statusUnreadCount: 1,
|
|
316
|
+
resources: [
|
|
317
|
+
helmRelease.resources[1],
|
|
318
|
+
{
|
|
319
|
+
kind: "Deployment",
|
|
320
|
+
apiVersion: "apps/v1",
|
|
321
|
+
name: "worker",
|
|
322
|
+
namespace: "shared",
|
|
323
|
+
statusUnread: "user_namespace_not_visible",
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
},
|
|
327
|
+
{ summary: JSON.stringify({ namespace: "shop", name: "shop" }) },
|
|
328
|
+
),
|
|
329
|
+
]);
|
|
330
|
+
const [group] = groupsOf(projection.groups, "helm");
|
|
331
|
+
const data = group.latest.data;
|
|
332
|
+
if (data.type !== "helm") throw new Error("expected a helm card");
|
|
333
|
+
expect(data.release.statusUnreadCount).toBe(1);
|
|
334
|
+
const html = renderToStaticMarkup(
|
|
335
|
+
<EvidenceNavigationContext.Provider value={{ onOpenResource: () => {} }}>
|
|
336
|
+
<HelmBody data={data} />
|
|
337
|
+
</EvidenceNavigationContext.Provider>,
|
|
338
|
+
);
|
|
339
|
+
expect(html).toContain("1 not checked");
|
|
340
|
+
expect(html).toContain("No access");
|
|
341
|
+
expect(html.match(/<button[^>]*>[^<]*shop\/api/)).not.toBeNull();
|
|
342
|
+
expect(html.match(/<button[^>]*>[^<]*shared\/worker/)).toBeNull();
|
|
343
|
+
});
|
|
344
|
+
it("shows Flux ownership without exposing or linking a hidden controller", () => {
|
|
345
|
+
const projection = project([tool("helm", "get_helm_release", {...helmRelease, managedByFlux: true})]);
|
|
346
|
+
const [group] = groupsOf(projection.groups, "helm");
|
|
347
|
+
const data = group.latest.data;
|
|
348
|
+
if (data.type !== "helm") throw new Error("expected a helm card");
|
|
349
|
+
expect(data.release.managedByFlux).toBe(true);
|
|
350
|
+
expect(data.release.managedByFluxHelmRelease).toBeUndefined();
|
|
351
|
+
const html = renderToStaticMarkup(<HelmBody data={data} />);
|
|
352
|
+
expect(html).toContain("Managed by Flux");
|
|
353
|
+
expect(html).not.toContain("undefined");
|
|
354
|
+
expect(html).not.toContain("private-manager");
|
|
355
|
+
});
|
|
356
|
+
|
|
305
357
|
});
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
InvestigationHelmRevision,
|
|
16
16
|
InvestigationHelmHook,
|
|
17
17
|
} from "../types";
|
|
18
|
+
import { adaptListHelmReleases } from "./listings";
|
|
18
19
|
|
|
19
20
|
function helmOwnedResource(
|
|
20
21
|
value: unknown,
|
|
@@ -35,6 +36,7 @@ function helmOwnedResource(
|
|
|
35
36
|
"message",
|
|
36
37
|
"summary",
|
|
37
38
|
"issue",
|
|
39
|
+
"statusUnread",
|
|
38
40
|
] as const) {
|
|
39
41
|
if (candidate[field] !== undefined && typeof candidate[field] !== "string")
|
|
40
42
|
return undefined;
|
|
@@ -124,12 +126,61 @@ function helmOperation(value: unknown): InvestigationHelmOperation | undefined {
|
|
|
124
126
|
return undefined;
|
|
125
127
|
return candidate as unknown as InvestigationHelmOperation;
|
|
126
128
|
}
|
|
129
|
+
// The release manages the target when the target is among the resources
|
|
130
|
+
// Helm rendered for it; a release is never the investigated object itself.
|
|
131
|
+
// Without an API version the owned row cannot tell colliding kinds apart
|
|
132
|
+
// (CNPG vs CAPI Cluster), so it establishes nothing.
|
|
133
|
+
function releaseRelevance(
|
|
134
|
+
builder: ProjectionBuilder,
|
|
135
|
+
resources: readonly InvestigationHelmOwnedResource[],
|
|
136
|
+
): InvestigationEvidenceRelevance {
|
|
137
|
+
return resources.some(
|
|
138
|
+
(owned) =>
|
|
139
|
+
owned.apiVersion !== undefined &&
|
|
140
|
+
resourceMatchesTarget(builder.target, {
|
|
141
|
+
kind: owned.kind,
|
|
142
|
+
group: apiVersionToGroup(owned.apiVersion),
|
|
143
|
+
namespace: owned.namespace || undefined,
|
|
144
|
+
name: owned.name,
|
|
145
|
+
}),
|
|
146
|
+
)
|
|
147
|
+
? "producer-related"
|
|
148
|
+
: "broader";
|
|
149
|
+
}
|
|
150
|
+
|
|
127
151
|
export function adaptHelmRelease(
|
|
128
152
|
builder: ProjectionBuilder,
|
|
129
153
|
source: InvestigationEvidenceSource,
|
|
130
154
|
payload: unknown,
|
|
131
155
|
): void {
|
|
132
156
|
const value = record(payload);
|
|
157
|
+
// Without Helm's Secrets the release comes from its objects, with no status
|
|
158
|
+
// or history: it reads as list_helm_releases' observed rows do. The call's
|
|
159
|
+
// namespace is where Helm stores the release, which a Flux HelmRelease can
|
|
160
|
+
// set apart from the release's own, so the card is scoped to the release.
|
|
161
|
+
const observed = record(value?.observed);
|
|
162
|
+
if (value && observed && nonEmptyString(value.summary)) {
|
|
163
|
+
adaptListHelmReleases(
|
|
164
|
+
builder,
|
|
165
|
+
{
|
|
166
|
+
...source,
|
|
167
|
+
args: JSON.stringify({
|
|
168
|
+
namespace: observed.namespace,
|
|
169
|
+
name: observed.name,
|
|
170
|
+
}),
|
|
171
|
+
},
|
|
172
|
+
{ summary: value.summary, releases: [], observed: [observed] },
|
|
173
|
+
releaseRelevance(
|
|
174
|
+
builder,
|
|
175
|
+
(Array.isArray(observed.resources) ? observed.resources : [])
|
|
176
|
+
.map(helmOwnedResource)
|
|
177
|
+
.filter((item): item is InvestigationHelmOwnedResource =>
|
|
178
|
+
Boolean(item),
|
|
179
|
+
),
|
|
180
|
+
),
|
|
181
|
+
);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
133
184
|
if (
|
|
134
185
|
!value ||
|
|
135
186
|
!nonEmptyString(value.name) ||
|
|
@@ -157,6 +208,10 @@ export function adaptHelmRelease(
|
|
|
157
208
|
return;
|
|
158
209
|
}
|
|
159
210
|
}
|
|
211
|
+
if (value.managedByFlux !== undefined && typeof value.managedByFlux !== "boolean") {
|
|
212
|
+
invalidPayload(builder, source);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
160
215
|
const resourcesRaw =
|
|
161
216
|
value.resources === undefined || value.resources === null
|
|
162
217
|
? []
|
|
@@ -199,6 +254,11 @@ export function adaptHelmRelease(
|
|
|
199
254
|
resourceHealth: value.resourceHealth as string | undefined,
|
|
200
255
|
healthIssue: value.healthIssue as string | undefined,
|
|
201
256
|
healthSummary: value.healthSummary as string | undefined,
|
|
257
|
+
...(typeof value.statusUnreadCount === "number" &&
|
|
258
|
+
value.statusUnreadCount > 0
|
|
259
|
+
? { statusUnreadCount: value.statusUnreadCount }
|
|
260
|
+
: {}),
|
|
261
|
+
...(value.managedByFlux === true ? { managedByFlux: true } : {}),
|
|
202
262
|
managedByFluxHelmRelease: value.managedByFluxHelmRelease as
|
|
203
263
|
string | undefined,
|
|
204
264
|
lastOperation,
|
|
@@ -207,22 +267,7 @@ export function adaptHelmRelease(
|
|
|
207
267
|
...(hooks ? { hooks } : {}),
|
|
208
268
|
...(values ? { values } : {}),
|
|
209
269
|
};
|
|
210
|
-
|
|
211
|
-
// Helm rendered for it; a release is never the investigated object itself.
|
|
212
|
-
// Without an API version the owned row cannot tell colliding kinds apart
|
|
213
|
-
// (CNPG vs CAPI Cluster), so it establishes nothing.
|
|
214
|
-
const relevance: InvestigationEvidenceRelevance = resources.some(
|
|
215
|
-
(owned) =>
|
|
216
|
-
owned.apiVersion !== undefined &&
|
|
217
|
-
resourceMatchesTarget(builder.target, {
|
|
218
|
-
kind: owned.kind,
|
|
219
|
-
group: apiVersionToGroup(owned.apiVersion),
|
|
220
|
-
namespace: owned.namespace || undefined,
|
|
221
|
-
name: owned.name,
|
|
222
|
-
}),
|
|
223
|
-
)
|
|
224
|
-
? "producer-related"
|
|
225
|
-
: "broader";
|
|
270
|
+
const relevance = releaseRelevance(builder, resources);
|
|
226
271
|
const status = release.status.toLowerCase();
|
|
227
272
|
const operationFailed =
|
|
228
273
|
lastOperation?.status === "failed" ||
|
|
@@ -1,24 +1,51 @@
|
|
|
1
1
|
import { adaptListResources } from "./resource";
|
|
2
2
|
import { nonEmptyString, parseJSON, record, stringArray } from "../parse";
|
|
3
3
|
import { invalidPayload, type ProjectionBuilder } from "../observations";
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
InvestigationEvidenceRelevance,
|
|
6
|
+
InvestigationEvidenceSource,
|
|
7
|
+
} from "../types";
|
|
5
8
|
|
|
6
9
|
// Helm releases, installed packages and search hits are inventories: rows
|
|
7
10
|
// with a kind, a name and a namespace, one line of status, and for a hit
|
|
8
11
|
// the text that matched. They render on the inventory card so a citation
|
|
9
12
|
// can name a row the way it names a resource in a listing.
|
|
10
13
|
|
|
14
|
+
// A caller who can't read all of Helm's storage gets an object, whose observed
|
|
15
|
+
// rows have no status of their own; the card must not read as though they did.
|
|
16
|
+
function helmReleaseRows(payload: unknown): unknown[] | undefined {
|
|
17
|
+
if (Array.isArray(payload)) return payload;
|
|
18
|
+
const value = record(payload);
|
|
19
|
+
if (!value || !Array.isArray(value.releases) || !Array.isArray(value.observed)) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return [
|
|
23
|
+
...value.releases,
|
|
24
|
+
...value.observed.map((entry) => {
|
|
25
|
+
const item = record(entry);
|
|
26
|
+
return item ? { ...item, status: "status unknown" } : entry;
|
|
27
|
+
}),
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
|
|
11
31
|
export function adaptListHelmReleases(
|
|
12
32
|
builder: ProjectionBuilder,
|
|
13
33
|
source: InvestigationEvidenceSource,
|
|
14
34
|
payload: unknown,
|
|
35
|
+
relevance?: InvestigationEvidenceRelevance,
|
|
15
36
|
): void {
|
|
16
37
|
// Retained runs may contain the Helm producer's nil-slice encoding.
|
|
17
38
|
if (payload === null) payload = [];
|
|
18
|
-
|
|
39
|
+
const rows = helmReleaseRows(payload);
|
|
40
|
+
if (!rows) {
|
|
19
41
|
invalidPayload(builder, source);
|
|
20
42
|
return;
|
|
21
43
|
}
|
|
44
|
+
// A partial read can miss releases, which its rows can't show.
|
|
45
|
+
const partial = record(payload)?.summary;
|
|
46
|
+
if (nonEmptyString(partial)) {
|
|
47
|
+
builder.limit(source, "Helm releases", partial, "unknown");
|
|
48
|
+
}
|
|
22
49
|
const args = record(parseJSON(source.args ?? ""));
|
|
23
50
|
const namespace = nonEmptyString(args?.namespace)
|
|
24
51
|
? args.namespace
|
|
@@ -26,7 +53,7 @@ export function adaptListHelmReleases(
|
|
|
26
53
|
adaptListResources(
|
|
27
54
|
builder,
|
|
28
55
|
source,
|
|
29
|
-
|
|
56
|
+
rows.map((entry) => {
|
|
30
57
|
const item = record(entry);
|
|
31
58
|
if (!item) return entry;
|
|
32
59
|
const chart = [item.chart, item.chartVersion]
|
|
@@ -44,7 +71,10 @@ export function adaptListHelmReleases(
|
|
|
44
71
|
: {}),
|
|
45
72
|
};
|
|
46
73
|
}),
|
|
47
|
-
{
|
|
74
|
+
{
|
|
75
|
+
title: namespace ? `Helm releases in ${namespace}` : "Helm releases",
|
|
76
|
+
relevance,
|
|
77
|
+
},
|
|
48
78
|
);
|
|
49
79
|
}
|
|
50
80
|
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
} from "../parse";
|
|
29
29
|
import {
|
|
30
30
|
type InvestigationEventEvidence,
|
|
31
|
+
type InvestigationEvidenceRelevance,
|
|
31
32
|
type InvestigationEvidenceSource,
|
|
32
33
|
type InvestigationResourceSummary,
|
|
33
34
|
} from "../types";
|
|
@@ -299,7 +300,7 @@ export function adaptListResources(
|
|
|
299
300
|
builder: ProjectionBuilder,
|
|
300
301
|
source: InvestigationEvidenceSource,
|
|
301
302
|
payload: unknown,
|
|
302
|
-
options: { title?: string } = {},
|
|
303
|
+
options: { title?: string; relevance?: InvestigationEvidenceRelevance } = {},
|
|
303
304
|
): void {
|
|
304
305
|
const listed = listedRows(payload);
|
|
305
306
|
if (!listed) {
|
|
@@ -363,7 +364,7 @@ export function adaptListResources(
|
|
|
363
364
|
source,
|
|
364
365
|
{
|
|
365
366
|
tier: "context",
|
|
366
|
-
relevance: "broader",
|
|
367
|
+
relevance: options.relevance ?? "broader",
|
|
367
368
|
tone: hasAdverseResource ? "warning" : "neutral",
|
|
368
369
|
title,
|
|
369
370
|
summary: [
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
ResourceLink,
|
|
9
9
|
} from "@skyhook-io/k8s-ui";
|
|
10
10
|
import { apiVersionToGroup } from "../../../../utils/navigation";
|
|
11
|
+
import { readActionFor } from "@skyhook-io/k8s-ui/utils/read-actions";
|
|
12
|
+
import { notCheckedTooltip } from "../../../helm/NotCheckedBadge";
|
|
11
13
|
import { Tooltip } from "../../../ui/Tooltip";
|
|
12
14
|
import { EvidenceNavigationContext } from "../navigation";
|
|
13
15
|
import { type EvidenceDataOf, ResourceFact, severityBadge } from "../cardParts";
|
|
@@ -67,6 +69,20 @@ export function HelmBody({ data }: { data: EvidenceDataOf<"helm"> }) {
|
|
|
67
69
|
resources {release.resourceHealth}
|
|
68
70
|
</Badge>
|
|
69
71
|
) : null}
|
|
72
|
+
{release.statusUnreadCount ? (
|
|
73
|
+
<Tooltip
|
|
74
|
+
content={
|
|
75
|
+
<div className="max-w-xs">
|
|
76
|
+
{notCheckedTooltip(release.statusUnreadCount, "either", "health")}
|
|
77
|
+
</div>
|
|
78
|
+
}
|
|
79
|
+
delay={150}
|
|
80
|
+
>
|
|
81
|
+
<Badge severity="neutral" size="sm">
|
|
82
|
+
{release.statusUnreadCount} not checked
|
|
83
|
+
</Badge>
|
|
84
|
+
</Tooltip>
|
|
85
|
+
) : null}
|
|
70
86
|
<Tooltip
|
|
71
87
|
content={new Date(release.updated).toLocaleString()}
|
|
72
88
|
delay={150}
|
|
@@ -132,9 +148,9 @@ export function HelmBody({ data }: { data: EvidenceDataOf<"helm"> }) {
|
|
|
132
148
|
Release metadata stored in namespace {release.storageNamespace}
|
|
133
149
|
</p>
|
|
134
150
|
) : null}
|
|
135
|
-
{release.managedByFluxHelmRelease ? (
|
|
151
|
+
{release.managedByFlux || release.managedByFluxHelmRelease ? (
|
|
136
152
|
<p className="text-xs text-theme-text-tertiary">
|
|
137
|
-
Managed by Flux HelmRelease {release.managedByFluxHelmRelease}
|
|
153
|
+
Managed by Flux{release.managedByFluxHelmRelease ? ` HelmRelease ${release.managedByFluxHelmRelease}` : ''}
|
|
138
154
|
</p>
|
|
139
155
|
) : null}
|
|
140
156
|
{release.hooks && release.hooks.length > 0 ? (
|
|
@@ -244,59 +260,74 @@ export function HelmBody({ data }: { data: EvidenceDataOf<"helm"> }) {
|
|
|
244
260
|
) : null}
|
|
245
261
|
{release.resources.length > 0 ? (
|
|
246
262
|
<div className="max-h-52 overflow-y-auto rounded-md border border-theme-border">
|
|
247
|
-
{release.resources.map((owned, index) =>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
"
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
263
|
+
{release.resources.map((owned, index) => {
|
|
264
|
+
const unread = owned.statusUnread
|
|
265
|
+
? readActionFor(owned.statusUnread) === "retry"
|
|
266
|
+
? "Not checked"
|
|
267
|
+
: "No access"
|
|
268
|
+
: undefined;
|
|
269
|
+
return (
|
|
270
|
+
<div
|
|
271
|
+
key={`${owned.kind}-${owned.namespace}-${owned.name}`}
|
|
272
|
+
className={clsx(
|
|
273
|
+
"flex min-w-0 items-center gap-2 px-2.5 py-1.5",
|
|
274
|
+
index > 0 && "border-t border-theme-border/60",
|
|
258
275
|
)}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
276
|
+
>
|
|
277
|
+
<StatusDot
|
|
278
|
+
tone={mapHealthToTone(
|
|
279
|
+
owned.issue ? "unhealthy" : (owned.status ?? ""),
|
|
280
|
+
)}
|
|
281
|
+
className="shrink-0"
|
|
282
|
+
/>
|
|
283
|
+
<Badge tone="structural" size="sm">
|
|
284
|
+
{owned.kind}
|
|
285
|
+
</Badge>
|
|
286
|
+
<span className="min-w-0 flex-1">
|
|
287
|
+
<span className="block truncate font-mono text-xs">
|
|
288
|
+
<ResourceLink
|
|
289
|
+
name={owned.name}
|
|
290
|
+
kind={owned.kind}
|
|
291
|
+
namespace={owned.namespace}
|
|
292
|
+
group={
|
|
293
|
+
owned.apiVersion
|
|
294
|
+
? apiVersionToGroup(owned.apiVersion)
|
|
295
|
+
: undefined
|
|
296
|
+
}
|
|
297
|
+
label={`${owned.namespace ? `${owned.namespace}/` : ""}${owned.name}`}
|
|
298
|
+
onNavigate={
|
|
299
|
+
owned.apiVersion && onOpenResource && !unread
|
|
300
|
+
? (ref) => onOpenResource(ref)
|
|
301
|
+
: undefined
|
|
302
|
+
}
|
|
303
|
+
/>
|
|
286
304
|
</span>
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
305
|
+
{owned.issue ? (
|
|
306
|
+
<span className="block truncate text-xs text-warning-text">
|
|
307
|
+
{owned.issue}
|
|
308
|
+
</span>
|
|
309
|
+
) : owned.summary || owned.message ? (
|
|
310
|
+
<span className="block truncate text-xs text-theme-text-tertiary">
|
|
311
|
+
{owned.summary || owned.message}
|
|
312
|
+
</span>
|
|
313
|
+
) : null}
|
|
314
|
+
</span>
|
|
315
|
+
{unread ? (
|
|
316
|
+
<Badge
|
|
317
|
+
severity="neutral"
|
|
318
|
+
size="sm"
|
|
319
|
+
className="ml-auto shrink-0"
|
|
320
|
+
>
|
|
321
|
+
{unread}
|
|
322
|
+
</Badge>
|
|
323
|
+
) : owned.ready || owned.status ? (
|
|
324
|
+
<span className="ml-auto shrink-0 font-mono text-xs text-theme-text-tertiary">
|
|
325
|
+
{owned.ready || owned.status}
|
|
290
326
|
</span>
|
|
291
327
|
) : null}
|
|
292
|
-
</
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
{owned.ready || owned.status}
|
|
296
|
-
</span>
|
|
297
|
-
) : null}
|
|
298
|
-
</div>
|
|
299
|
-
))}
|
|
328
|
+
</div>
|
|
329
|
+
);
|
|
330
|
+
})}
|
|
300
331
|
</div>
|
|
301
332
|
) : null}
|
|
302
333
|
</div>
|
|
@@ -264,6 +264,8 @@ export interface InvestigationHelmOwnedResource {
|
|
|
264
264
|
message?: string;
|
|
265
265
|
summary?: string;
|
|
266
266
|
issue?: string;
|
|
267
|
+
/** Why the caller isn't shown this object's live status (a read code). */
|
|
268
|
+
statusUnread?: string;
|
|
267
269
|
}
|
|
268
270
|
export interface InvestigationHelmRelease {
|
|
269
271
|
name: string;
|
|
@@ -280,6 +282,9 @@ export interface InvestigationHelmRelease {
|
|
|
280
282
|
resourceHealth?: string;
|
|
281
283
|
healthIssue?: string;
|
|
282
284
|
healthSummary?: string;
|
|
285
|
+
/** Workloads and Pods whose live status wasn't read. */
|
|
286
|
+
statusUnreadCount?: number;
|
|
287
|
+
managedByFlux?: boolean;
|
|
283
288
|
managedByFluxHelmRelease?: string;
|
|
284
289
|
lastOperation?: InvestigationHelmOperation;
|
|
285
290
|
resources: InvestigationHelmOwnedResource[];
|