@skyhook-io/radar-app 1.17.0 → 1.18.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 +11 -11
- package/src/App.tsx +138 -116
- package/src/api/actions.errorCode.test.ts +40 -0
- package/src/api/actions.test.ts +48 -0
- package/src/api/actions.ts +79 -0
- package/src/api/apiResources.navigation.test.tsx +232 -0
- package/src/api/apiResources.ts +46 -3
- package/src/api/client.gitopsPoll.test.ts +99 -0
- package/src/api/client.helmPreview.test.tsx +48 -0
- package/src/api/client.helmSource.test.ts +39 -0
- package/src/api/client.namespaceSwitch.hook.test.tsx +54 -0
- package/src/api/client.namespaceSwitch.test.ts +107 -0
- package/src/api/client.resourceAvailability.test.ts +24 -0
- package/src/api/client.ts +580 -103
- package/src/api/client.workloadRuns.test.ts +53 -0
- package/src/api/cnpg-ha.live.test.ts +140 -0
- package/src/api/cnpg-ha.test.ts +78 -0
- package/src/api/cnpg-ha.ts +19 -0
- package/src/api/cnpg-history.ts +123 -0
- package/src/api/cnpg-inspect.ts +102 -0
- package/src/api/cnpg-protection.ts +112 -0
- package/src/api/cnpg-recovery.test.tsx +60 -0
- package/src/api/cnpg-recovery.ts +262 -0
- package/src/api/cnpg-sessions.ts +175 -0
- package/src/api/cnpg-storage.ts +138 -0
- package/src/api/cnpg.legacy-reads.test.ts +43 -0
- package/src/api/cnpg.pooler-runtime.test.ts +15 -0
- package/src/api/cnpg.ts +428 -10
- package/src/api/config.test.ts +23 -1
- package/src/api/config.ts +7 -3
- package/src/api/diagnose.ts +4 -1
- package/src/api/drain-plan.test.ts +70 -40
- package/src/api/policy.ts +5 -5
- package/src/api/radarFeatures.render.test.tsx +47 -3
- package/src/api/radarFeatures.ts +5 -1
- package/src/api/reviewedActionMutation.test.tsx +164 -0
- package/src/api/reviewedActionMutation.ts +66 -0
- package/src/api/timelineSource.test.ts +9 -0
- package/src/api/timelineSource.ts +8 -0
- package/src/api/traffic.scope.render.test.tsx +60 -0
- package/src/api/traffic.ts +3 -1
- package/src/components/audit/AuditView.tsx +9 -0
- package/src/components/capacity/CapacityActivity.tsx +3 -31
- package/src/components/capacity/CapacityDemand.tsx +4 -36
- package/src/components/capacity/CapacityOverview.tsx +217 -56
- package/src/components/capacity/CapacityPoolDetail.tsx +6 -55
- package/src/components/capacity/CapacityView.test.tsx +323 -0
- package/src/components/capacity/ClusterSchedulingCard.tsx +2 -10
- package/src/components/capacity/certaintyGlyph.test.tsx +2 -9
- package/src/components/capacity/routes.ts +42 -0
- package/src/components/capacity/shared.tsx +11 -129
- package/src/components/capacity/workspaceRoute.ts +18 -0
- package/src/components/cnpg/CNPGActionHost.compatibility.test.tsx +30 -0
- package/src/components/cnpg/CNPGArchivingRepair.tsx +191 -0
- package/src/components/cnpg/CNPGBlockingSessions.test.tsx +50 -0
- package/src/components/cnpg/CNPGBlockingSessions.tsx +333 -0
- package/src/components/cnpg/CNPGClusterActivity.test.tsx +11 -0
- package/src/components/cnpg/CNPGClusterActivity.tsx +18 -9
- package/src/components/cnpg/CNPGClusterLogs.compatibility.test.tsx +130 -0
- package/src/components/cnpg/CNPGClusterLogs.empty.test.tsx +29 -0
- package/src/components/cnpg/CNPGClusterLogs.test.ts +9 -0
- package/src/components/cnpg/CNPGClusterLogs.tsx +81 -24
- package/src/components/cnpg/CNPGClusterTabs.test.tsx +152 -0
- package/src/components/cnpg/CNPGClusterTabs.tsx +187 -0
- package/src/components/cnpg/CNPGClustersKindView.tsx +46 -0
- package/src/components/cnpg/CNPGConfiguration.test.tsx +223 -0
- package/src/components/cnpg/CNPGConfiguration.tsx +190 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.test.tsx +113 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.tsx +74 -0
- package/src/components/cnpg/CNPGDeclarations.test.ts +107 -0
- package/src/components/cnpg/CNPGDeclarations.tsx +236 -78
- package/src/components/cnpg/CNPGDetailPage.test.tsx +62 -0
- package/src/components/cnpg/CNPGDetailPage.tsx +159 -98
- package/src/components/cnpg/CNPGDrawerTrail.tsx +2 -2
- package/src/components/cnpg/CNPGInvestigationAction.test.tsx +30 -0
- package/src/components/cnpg/CNPGOperator.test.tsx +34 -0
- package/src/components/cnpg/CNPGOperator.tsx +78 -30
- package/src/components/cnpg/CNPGOperatorBanner.tsx +39 -0
- package/src/components/cnpg/CNPGOperatorConditions.test.tsx +45 -0
- package/src/components/cnpg/CNPGOperatorConditions.tsx +16 -0
- package/src/components/cnpg/CNPGOperatorConfig.test.tsx +27 -0
- package/src/components/cnpg/CNPGOperatorDiagnosis.tsx +247 -0
- package/src/components/cnpg/CNPGOverview.test.tsx +171 -0
- package/src/components/cnpg/CNPGOverview.tsx +238 -63
- package/src/components/cnpg/CNPGParametersInEffect.test.tsx +51 -0
- package/src/components/cnpg/CNPGParametersInEffect.tsx +120 -0
- package/src/components/cnpg/CNPGPerformance.prerequisite.test.tsx +48 -0
- package/src/components/cnpg/CNPGPerformance.test.tsx +73 -0
- package/src/components/cnpg/CNPGPerformance.tsx +477 -0
- package/src/components/cnpg/CNPGPooling.test.tsx +89 -0
- package/src/components/cnpg/CNPGPooling.tsx +97 -40
- package/src/components/cnpg/CNPGProtection.test.tsx +145 -0
- package/src/components/cnpg/CNPGProtection.tsx +228 -122
- package/src/components/cnpg/CNPGReplicationTab.test.tsx +87 -0
- package/src/components/cnpg/CNPGReplicationTab.tsx +212 -0
- package/src/components/cnpg/CNPGReplicationView.tsx +264 -0
- package/src/components/cnpg/CNPGStorage.test.tsx +140 -0
- package/src/components/cnpg/CNPGStorage.tsx +619 -0
- package/src/components/cnpg/CNPGSummaryHost.overview.test.tsx +44 -0
- package/src/components/cnpg/CNPGSummaryHost.test.tsx +23 -0
- package/src/components/cnpg/CNPGSummaryHost.tsx +230 -55
- package/src/components/cnpg/CNPGTrends.denied.test.tsx +33 -0
- package/src/components/cnpg/CNPGTrends.missing.test.tsx +69 -0
- package/src/components/cnpg/CNPGTrends.test.ts +38 -0
- package/src/components/cnpg/CNPGTrends.tsx +702 -0
- package/src/components/cnpg/CNPGView.tsx +34 -21
- package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +90 -0
- package/src/components/cnpg/actions/CNPGClusterActions.dialog.test.tsx +79 -0
- package/src/components/cnpg/actions/CNPGClusterActions.test.tsx +142 -0
- package/src/components/cnpg/actions/CNPGClusterActions.tsx +853 -0
- package/src/components/cnpg/actions/CNPGConnectButton.read.test.tsx +40 -0
- package/src/components/cnpg/actions/CNPGConnectButton.test.ts +25 -0
- package/src/components/cnpg/actions/CNPGConnectButton.tsx +131 -0
- package/src/components/cnpg/actions/CNPGDestroyInstanceDialog.tsx +185 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.test.tsx +38 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.tsx +74 -0
- package/src/components/cnpg/actions/CNPGMaintenanceBanner.tsx +53 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.test.tsx +35 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.tsx +79 -0
- package/src/components/cnpg/actions/CNPGReportDialog.test.tsx +12 -0
- package/src/components/cnpg/actions/CNPGReportDialog.tsx +91 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.run.test.tsx +58 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.test.tsx +54 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.tsx +208 -0
- package/src/components/cnpg/actions/actionModel.test.ts +111 -0
- package/src/components/cnpg/actions/actionModel.ts +127 -0
- package/src/components/cnpg/actions/renderCNPGHeaderActions.tsx +60 -0
- package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +58 -0
- package/src/components/cnpg/actions/useOpenCNPGPsql.ts +22 -0
- package/src/components/cnpg/archivingRepair.test.ts +104 -0
- package/src/components/cnpg/archivingRepair.ts +145 -0
- package/src/components/cnpg/baseBackup.test.ts +36 -0
- package/src/components/cnpg/baseBackup.ts +36 -0
- package/src/components/cnpg/blocking.test.ts +59 -0
- package/src/components/cnpg/blocking.ts +131 -0
- package/src/components/cnpg/coverageText.test.ts +27 -0
- package/src/components/cnpg/creation/CNPGTargetFields.tsx +110 -0
- package/src/components/cnpg/creation/targetModel.test.ts +137 -0
- package/src/components/cnpg/creation/targetModel.ts +149 -0
- package/src/components/cnpg/fleetStatus.test.ts +46 -0
- package/src/components/cnpg/fleetStatus.ts +43 -0
- package/src/components/cnpg/formFields.ts +2 -0
- package/src/components/cnpg/grantText.test.tsx +11 -0
- package/src/components/cnpg/host.test.tsx +24 -0
- package/src/components/cnpg/host.tsx +101 -0
- package/src/components/cnpg/inspectModel.test.ts +120 -0
- package/src/components/cnpg/inspectModel.ts +140 -0
- package/src/components/cnpg/logicalSlots.test.ts +30 -0
- package/src/components/cnpg/logicalSlots.ts +29 -0
- package/src/components/cnpg/lsn.test.ts +40 -0
- package/src/components/cnpg/lsn.ts +43 -0
- package/src/components/cnpg/operations/CNPGFleetOperation.tsx +30 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.test.tsx +247 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.tsx +255 -0
- package/src/components/cnpg/operations/model.test.ts +510 -0
- package/src/components/cnpg/operations/model.ts +499 -0
- package/src/components/cnpg/operations/presentation.test.ts +80 -0
- package/src/components/cnpg/operations/presentation.ts +84 -0
- package/src/components/cnpg/operations/store.ts +98 -0
- package/src/components/cnpg/operatorStatus.test.ts +134 -0
- package/src/components/cnpg/operatorStatus.ts +194 -0
- package/src/components/cnpg/paths.test.ts +54 -0
- package/src/components/cnpg/paths.ts +47 -4
- package/src/components/cnpg/protection/CNPGAttachArchiveDialog.tsx +185 -0
- package/src/components/cnpg/protection/CNPGCreateScheduleDialog.tsx +196 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.test.tsx +121 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.tsx +452 -0
- package/src/components/cnpg/protection/CNPGScheduleInput.tsx +115 -0
- package/src/components/cnpg/protection/CNPGScheduleRepairButton.tsx +120 -0
- package/src/components/cnpg/protection/scheduleModel.test.ts +19 -0
- package/src/components/cnpg/protection/scheduleModel.ts +16 -0
- package/src/components/cnpg/recovery/CNPGRecoveryPoint.tsx +220 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.test.tsx +29 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.tsx +26 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.test.tsx +23 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.tsx +153 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.back.test.tsx +149 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.test.tsx +46 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.tsx +333 -0
- package/src/components/cnpg/recovery/CNPGRestoreProgress.tsx +182 -0
- package/src/components/cnpg/recovery/CNPGRestoreValidation.tsx +216 -0
- package/src/components/cnpg/recovery/restoreModel.test.ts +709 -0
- package/src/components/cnpg/recovery/restoreModel.ts +685 -0
- package/src/components/cnpg/recovery/restoreOperation.ts +56 -0
- package/src/components/cnpg/refresh.test.ts +38 -0
- package/src/components/cnpg/refresh.ts +17 -0
- package/src/components/cnpg/refreshNotice.test.tsx +29 -0
- package/src/components/cnpg/routes.test.ts +34 -3
- package/src/components/cnpg/routes.ts +60 -48
- package/src/components/cnpg/runtimeAssessment.ts +198 -0
- package/src/components/cnpg/runtimeModel.test.ts +175 -0
- package/src/components/cnpg/runtimeModel.ts +196 -0
- package/src/components/cnpg/runtimeParts.test.tsx +17 -0
- package/src/components/cnpg/runtimeParts.tsx +79 -0
- package/src/components/cnpg/shared.test.tsx +59 -0
- package/src/components/cnpg/shared.tsx +100 -182
- package/src/components/cnpg/storageModel.test.ts +107 -0
- package/src/components/cnpg/storageModel.ts +101 -0
- package/src/components/cnpg/trendSamples.test.ts +148 -0
- package/src/components/cnpg/trendSamples.ts +222 -0
- package/src/components/cnpg/useCNPGClusterAssessment.ts +30 -0
- package/src/components/cnpg/useCNPGKubectlContext.test.tsx +45 -0
- package/src/components/cnpg/useCNPGKubectlContext.ts +13 -0
- package/src/components/cnpg/useCNPGNavigate.test.tsx +58 -0
- package/src/components/cnpg/useCNPGNavigate.ts +21 -0
- package/src/components/cnpg/useCNPGPoolerLive.ts +46 -0
- package/src/components/cnpg/useCNPGScreenParams.ts +24 -0
- package/src/components/cnpg/useCNPGSidebarWorkspace.ts +66 -16
- package/src/components/cnpg/workspaceRoute.ts +23 -0
- package/src/components/cost/ApplicationCostTab.test.ts +7 -0
- package/src/components/cost/ApplicationCostTab.tsx +7 -7
- package/src/components/cost/CostView.test.ts +2 -1
- package/src/components/cost/CostView.tsx +0 -2
- package/src/components/cost/WorkloadCostTab.tsx +2 -4
- package/src/components/cost/errors.ts +3 -1
- package/src/components/cost/source.test.ts +10 -0
- package/src/components/cost/source.ts +5 -1
- package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
- package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
- package/src/components/diagnose/InvestigationView.tsx +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -43
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
- package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
- package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
- package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
- package/src/components/diagnose/investigationEvidence/observations.ts +20 -0
- package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/types.ts +11 -0
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
- package/src/components/diagnose/investigationState.test.ts +36 -1
- package/src/components/diagnose/investigationState.ts +8 -0
- package/src/components/diagnose/launch.ts +2 -2
- package/src/components/dock/BottomDock.tsx +8 -3
- package/src/components/dock/TerminalTab.test.tsx +17 -0
- package/src/components/dock/TerminalTab.tsx +7 -3
- package/src/components/dock/WorkloadLogsTab.tsx +3 -0
- package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
- package/src/components/execution/BatchExecutionView.tsx +23 -8
- package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
- package/src/components/gitops/ArgoResourceDiffLoader.tsx +4 -2
- package/src/components/gitops/GitOpsView.tsx +23 -23
- package/src/components/helm/HelmCompareRoute.test.tsx +59 -0
- package/src/components/helm/HelmCompareRoute.tsx +57 -26
- package/src/components/helm/HelmReleaseDrawer.test.ts +55 -3
- package/src/components/helm/HelmReleaseDrawer.tsx +186 -64
- package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
- package/src/components/helm/HelmReleaseNotes.tsx +26 -0
- package/src/components/helm/OwnedResources.tsx +2 -2
- package/src/components/helm/TrackChartSourceDialog.render.test.tsx +192 -0
- package/src/components/helm/TrackChartSourceDialog.test.ts +51 -0
- package/src/components/helm/TrackChartSourceDialog.tsx +179 -176
- package/src/components/helm/ValuesDiffPreview.tsx +4 -1
- package/src/components/helm/ValuesViewer.test.tsx +301 -0
- package/src/components/helm/ValuesViewer.tsx +169 -78
- package/src/components/home/ActivitySummary.tsx +2 -1
- package/src/components/home/ClusterHealthCard.tsx +4 -4
- package/src/components/home/CostCard.test.tsx +100 -0
- package/src/components/home/CostCard.tsx +2 -2
- package/src/components/home/HelmSummary.tsx +2 -2
- package/src/components/home/HomeView.tsx +32 -12
- package/src/components/home/MCPSetupDialog.test.tsx +30 -0
- package/src/components/home/MCPSetupDialog.tsx +13 -6
- package/src/components/home/ProblemsPanel.test.tsx +82 -0
- package/src/components/home/TopologyPreview.tsx +2 -2
- package/src/components/home/mcpToolCatalog.ts +18 -2
- package/src/components/issues/IssuesPane.render.test.tsx +143 -0
- package/src/components/issues/IssuesPane.test.ts +65 -1
- package/src/components/issues/IssuesPane.tsx +213 -26
- package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
- package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
- package/src/components/issues/uncheckedSources.test.ts +43 -0
- package/src/components/issues/uncheckedSources.ts +74 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
- package/src/components/resource/PVCUsageBar.render.test.tsx +32 -0
- package/src/components/resource/PVCUsageBar.test.tsx +24 -0
- package/src/components/resource/PVCUsageBar.tsx +15 -6
- package/src/components/resource/WorkloadMetricsHelpDialog.test.tsx +3 -1
- package/src/components/resource/WorkloadMetricsHelpDialog.tsx +1 -1
- package/src/components/resources/CompositeRenderer.tsx +4 -4
- package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
- package/src/components/resources/ImageFilesystemModal.tsx +11 -4
- package/src/components/resources/PodFilesystemModal.tsx +2 -2
- package/src/components/resources/ResourceDetailDrawer.tsx +2 -2
- package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
- package/src/components/resources/ResourcesView.tsx +44 -15
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
- package/src/components/settings/LocalIntegrationStatus.test.tsx +52 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -4
- package/src/components/settings/SettingsDialog.tsx +49 -30
- package/src/components/timeline/TimelineList.tsx +22 -24
- package/src/components/timeline/TimelineLoadError.test.tsx +62 -0
- package/src/components/timeline/TimelineLoadError.tsx +96 -0
- package/src/components/timeline/TimelineView.tsx +18 -45
- package/src/components/timeline/ViewModeToggle.tsx +20 -0
- package/src/components/timeline/useStickyError.test.tsx +47 -0
- package/src/components/timeline/useStickyError.ts +15 -0
- package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
- package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
- package/src/components/traffic/TrafficView.tsx +12 -12
- package/src/components/traffic/trafficFilters.test.ts +20 -1
- package/src/components/traffic/trafficFilters.ts +13 -0
- package/src/components/ui/DiagnosticsOverlay.tsx +34 -2
- package/src/components/ui/Markdown.test.tsx +65 -0
- package/src/components/ui/Markdown.tsx +144 -127
- package/src/components/ui/Omnibar.tsx +13 -2
- package/src/components/ui/Toast.tsx +1 -1
- package/src/components/ui/omnibar-match.test.ts +30 -0
- package/src/components/ui/omnibar-match.ts +18 -0
- package/src/components/whats-new/releaseNotes.ts +63 -1
- package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
- package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
- package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
- package/src/components/workload/NodeDrainStatus.tsx +55 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +63 -243
- package/src/components/workspace/layout.test.tsx +29 -0
- package/src/components/workspace/layout.tsx +259 -0
- package/src/components/workspace/table.ts +7 -0
- package/src/context/ConnectionContext.test.ts +27 -1
- package/src/context/ConnectionContext.tsx +17 -7
- package/src/contexts/CapabilitiesContext.tsx +1 -1
- package/src/integrations/resourceHost.test.tsx +55 -0
- package/src/integrations/resourceHost.ts +99 -0
- package/src/integrations/resourceHosts.test.tsx +142 -0
- package/src/integrations/resourceHosts.tsx +121 -0
- package/src/integrations/workspaceRoute.ts +20 -0
- package/src/integrations/workspaceRoutes.test.ts +40 -0
- package/src/integrations/workspaceRoutes.ts +22 -0
- package/src/integrations/workspaceScreens.tsx +14 -0
- package/src/utils/drawer-trail.ts +35 -0
- package/src/utils/kindFilterStore.test.ts +147 -0
- package/src/utils/kindFilterStore.ts +91 -0
- package/src/utils/navigation.test.ts +13 -1
- package/src/utils/navigation.ts +53 -2
- package/src/utils/page-links.ts +21 -0
- package/src/utils/tabStorage.ts +40 -0
- package/src/utils/viewMemory.test.ts +78 -0
- package/src/utils/viewMemory.ts +54 -0
- package/src/utils/wails-clipboard.ts +4 -2
|
@@ -8,7 +8,13 @@ import {
|
|
|
8
8
|
scopeFromArgs,
|
|
9
9
|
sourceArgsRelevance,
|
|
10
10
|
} from "../observations";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
nonEmptyString,
|
|
13
|
+
parseJSON,
|
|
14
|
+
recentChange,
|
|
15
|
+
record,
|
|
16
|
+
stringArray,
|
|
17
|
+
} from "../parse";
|
|
12
18
|
import { type InvestigationEvidenceSource } from "../types";
|
|
13
19
|
|
|
14
20
|
export function adaptChanges(
|
|
@@ -23,13 +29,15 @@ export function adaptChanges(
|
|
|
23
29
|
invalidPayload(builder, source, "Recent changes");
|
|
24
30
|
return;
|
|
25
31
|
}
|
|
26
|
-
const
|
|
32
|
+
const rows = changesRaw
|
|
27
33
|
.map(recentChange)
|
|
28
34
|
.filter((item): item is IssueRecentChange => Boolean(item));
|
|
29
|
-
|
|
35
|
+
const created = createdChanges(value.created);
|
|
36
|
+
if (rows.length !== changesRaw.length || !created) {
|
|
30
37
|
invalidPayload(builder, source, "Recent changes");
|
|
31
38
|
return;
|
|
32
39
|
}
|
|
40
|
+
const changes = mergeCreated(rows, created);
|
|
33
41
|
addNarrowHint(builder, source, value);
|
|
34
42
|
let sourceErrors = 0;
|
|
35
43
|
if (Array.isArray(value.sourcesErrored)) {
|
|
@@ -57,4 +65,185 @@ export function adaptChanges(
|
|
|
57
65
|
changesSubjectFromArgs(source),
|
|
58
66
|
nonEmptyString(args?.since) ? args.since : undefined,
|
|
59
67
|
);
|
|
68
|
+
addClusterScopedChanges(builder, source, value.clusterScopedChanges);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const CLUSTER_SCOPED_LABEL = "Cluster-scoped admission changes";
|
|
72
|
+
|
|
73
|
+
// Admission configuration changes that apply, or may apply, to the queried
|
|
74
|
+
// namespace. Each row's summary carries why it is listed, because the
|
|
75
|
+
// applicability is the point: the row itself is a cluster-scoped object.
|
|
76
|
+
export function addClusterScopedChanges(
|
|
77
|
+
builder: ProjectionBuilder,
|
|
78
|
+
source: InvestigationEvidenceSource,
|
|
79
|
+
payload: unknown,
|
|
80
|
+
): void {
|
|
81
|
+
if (payload === undefined) return;
|
|
82
|
+
const value = record(payload);
|
|
83
|
+
const rowsRaw = value?.changes === null ? [] : value?.changes;
|
|
84
|
+
if (!value || !Array.isArray(rowsRaw)) {
|
|
85
|
+
invalidPayload(builder, source, CLUSTER_SCOPED_LABEL);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const changes: IssueRecentChange[] = [];
|
|
89
|
+
for (const raw of rowsRaw) {
|
|
90
|
+
const change = recentChange(raw);
|
|
91
|
+
const row = record(raw);
|
|
92
|
+
if (!change || !row || !nonEmptyString(row.applies_because)) {
|
|
93
|
+
invalidPayload(builder, source, CLUSTER_SCOPED_LABEL);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const applicability =
|
|
97
|
+
row.applicability === "applies" ? "Applies" : "May apply";
|
|
98
|
+
changes.push({
|
|
99
|
+
...change,
|
|
100
|
+
summary: [change.summary, `${applicability}: ${row.applies_because}`]
|
|
101
|
+
.filter(Boolean)
|
|
102
|
+
.join(" · "),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
if (nonEmptyString(value.error)) {
|
|
106
|
+
builder.limit(source, CLUSTER_SCOPED_LABEL, value.error, "error");
|
|
107
|
+
}
|
|
108
|
+
if (nonEmptyString(value.incomplete)) {
|
|
109
|
+
builder.limit(source, CLUSTER_SCOPED_LABEL, value.incomplete, "unknown");
|
|
110
|
+
}
|
|
111
|
+
const notListed = stringArray(value.not_listed) ?? [];
|
|
112
|
+
if (notListed.length > 0 || value.truncated === true) {
|
|
113
|
+
builder.limit(
|
|
114
|
+
source,
|
|
115
|
+
CLUSTER_SCOPED_LABEL,
|
|
116
|
+
notListed.length > 0
|
|
117
|
+
? `Also changed in this window: ${notListed.join(", ")}.`
|
|
118
|
+
: "More cluster-scoped admission changes occurred than were read.",
|
|
119
|
+
"truncated",
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
if (changes.length === 0) return;
|
|
123
|
+
addChanges(
|
|
124
|
+
builder,
|
|
125
|
+
source,
|
|
126
|
+
changes,
|
|
127
|
+
`changes:cluster-scoped:${scopeFromArgs(source)}`,
|
|
128
|
+
undefined,
|
|
129
|
+
value.truncated !== true,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// The constant fields of a plain create row, which the producer leaves out of
|
|
134
|
+
// `created` (issuesapi.CreatedObjects).
|
|
135
|
+
const PLAIN_CREATE = {
|
|
136
|
+
changeType: "add",
|
|
137
|
+
summary: "add",
|
|
138
|
+
change_category: "lifecycle",
|
|
139
|
+
rank_reason: "resource create/delete for config or desired state",
|
|
140
|
+
} as const;
|
|
141
|
+
|
|
142
|
+
const CREATED_LINE = /^\+(\d+)s ([^ /]+)\/([^ /]+)(?: \(used by (.+)\))?$/;
|
|
143
|
+
const RFC3339_SECONDS =
|
|
144
|
+
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[+-]\d{2}:\d{2})$/;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Expands get_changes `created` runs back into the rows they replaced. Each
|
|
148
|
+
* line is "+<seconds after first>s Kind/name", with " (used by ...)" for a
|
|
149
|
+
* consumed ConfigMap; a member's timestamp is `first` plus the offset, written
|
|
150
|
+
* in `first`'s zone so it matches the row the producer would have sent.
|
|
151
|
+
* Returns [] when the field is absent and undefined when it is malformed.
|
|
152
|
+
*/
|
|
153
|
+
export function createdChanges(
|
|
154
|
+
payload: unknown,
|
|
155
|
+
): IssueRecentChange[] | undefined {
|
|
156
|
+
if (payload === undefined || payload === null) return [];
|
|
157
|
+
if (!Array.isArray(payload)) return undefined;
|
|
158
|
+
const out: IssueRecentChange[] = [];
|
|
159
|
+
for (const raw of payload) {
|
|
160
|
+
const entry = record(raw);
|
|
161
|
+
const objects = stringArray(entry?.objects);
|
|
162
|
+
const first = typeof entry?.first === "string" ? entry.first : "";
|
|
163
|
+
const versions = record(entry?.apiVersions);
|
|
164
|
+
if (
|
|
165
|
+
!entry ||
|
|
166
|
+
!nonEmptyString(entry.namespace) ||
|
|
167
|
+
!objects ||
|
|
168
|
+
entry.count !== objects.length ||
|
|
169
|
+
addSeconds(first, 0) !== first ||
|
|
170
|
+
(entry.apiVersions !== undefined && !versions)
|
|
171
|
+
) {
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
for (const line of objects) {
|
|
175
|
+
const match = CREATED_LINE.exec(line);
|
|
176
|
+
if (!match) return undefined;
|
|
177
|
+
const [, offset, kind, name, consumers] = match;
|
|
178
|
+
const apiVersion = versions?.[kind];
|
|
179
|
+
const timestamp = addSeconds(first, Number(offset));
|
|
180
|
+
if (
|
|
181
|
+
(apiVersion !== undefined && !nonEmptyString(apiVersion)) ||
|
|
182
|
+
timestamp === undefined
|
|
183
|
+
)
|
|
184
|
+
return undefined;
|
|
185
|
+
out.push({
|
|
186
|
+
...PLAIN_CREATE,
|
|
187
|
+
kind,
|
|
188
|
+
...(apiVersion ? { apiVersion } : {}),
|
|
189
|
+
namespace: entry.namespace,
|
|
190
|
+
name,
|
|
191
|
+
timestamp,
|
|
192
|
+
...(consumers ? { consumed_by: consumers.split(", ") } : {}),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return out;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// addSeconds adds whole seconds to an RFC3339 timestamp and keeps its zone
|
|
200
|
+
// designator, so "2026-10-16T04:43:24+03:00" + 41 is "2026-10-16T04:44:05+03:00".
|
|
201
|
+
// Returns undefined for a malformed timestamp or an out-of-range result; a
|
|
202
|
+
// calendar-invalid date (February 30) is caught by callers comparing
|
|
203
|
+
// addSeconds(t, 0) with t.
|
|
204
|
+
function addSeconds(timestamp: string, seconds: number): string | undefined {
|
|
205
|
+
const m = RFC3339_SECONDS.exec(timestamp);
|
|
206
|
+
if (!m || !Number.isSafeInteger(seconds)) return undefined;
|
|
207
|
+
const [, y, mo, d, h, mi, s, zone] = m;
|
|
208
|
+
const wall = new Date(
|
|
209
|
+
Date.UTC(+y, +mo - 1, +d, +h, +mi, +s) + seconds * 1000,
|
|
210
|
+
);
|
|
211
|
+
if (Number.isNaN(wall.getTime())) return undefined;
|
|
212
|
+
const pad = (n: number, width = 2) => String(n).padStart(width, "0");
|
|
213
|
+
return (
|
|
214
|
+
`${pad(wall.getUTCFullYear(), 4)}-${pad(wall.getUTCMonth() + 1)}-${pad(wall.getUTCDate())}` +
|
|
215
|
+
`T${pad(wall.getUTCHours())}:${pad(wall.getUTCMinutes())}:${pad(wall.getUTCSeconds())}${zone}`
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Puts expanded creates back where get_changes ranked them: plain creates
|
|
221
|
+
* share the lifecycle rank, so they join the rows of that rank ordered newest
|
|
222
|
+
* first (ties by kind/namespace/name, as the producer breaks them), after
|
|
223
|
+
* every higher-ranked row and before status rows.
|
|
224
|
+
*/
|
|
225
|
+
export function mergeCreated(
|
|
226
|
+
rows: IssueRecentChange[],
|
|
227
|
+
created: IssueRecentChange[],
|
|
228
|
+
): IssueRecentChange[] {
|
|
229
|
+
if (created.length === 0) return rows;
|
|
230
|
+
const lifecycleBand = (c: IssueRecentChange) =>
|
|
231
|
+
c.change_category === "lifecycle" &&
|
|
232
|
+
!c.application_configuration_change &&
|
|
233
|
+
!c.not_linked_to_returned_issues;
|
|
234
|
+
const start = rows.findIndex(
|
|
235
|
+
(c) => lifecycleBand(c) || c.change_category === "runtime_status",
|
|
236
|
+
);
|
|
237
|
+
const bandStart = start === -1 ? rows.length : start;
|
|
238
|
+
let bandEnd = bandStart;
|
|
239
|
+
while (bandEnd < rows.length && lifecycleBand(rows[bandEnd])) bandEnd++;
|
|
240
|
+
const key = (c: IssueRecentChange) =>
|
|
241
|
+
`${c.kind}/${c.namespace ?? ""}/${c.name}/${c.changeType}`;
|
|
242
|
+
const band = [...rows.slice(bandStart, bandEnd), ...created].sort((a, b) => {
|
|
243
|
+
const at = Date.parse(a.timestamp);
|
|
244
|
+
const bt = Date.parse(b.timestamp);
|
|
245
|
+
if (at !== bt) return bt - at;
|
|
246
|
+
return key(a) < key(b) ? -1 : key(a) > key(b) ? 1 : 0;
|
|
247
|
+
});
|
|
248
|
+
return [...rows.slice(0, bandStart), ...band, ...rows.slice(bandEnd)];
|
|
60
249
|
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
stringArray,
|
|
20
20
|
} from "../parse";
|
|
21
21
|
import { type InvestigationEvidenceSource } from "../types";
|
|
22
|
+
import { addClusterScopedChanges } from "./changes";
|
|
22
23
|
|
|
23
24
|
export function adaptIssues(
|
|
24
25
|
builder: ProjectionBuilder,
|
|
@@ -63,22 +64,8 @@ export function adaptIssues(
|
|
|
63
64
|
"error",
|
|
64
65
|
);
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
source,
|
|
69
|
-
"Issue-related changes",
|
|
70
|
-
"The issue response omitted some recent changes.",
|
|
71
|
-
"truncated",
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
if (value.correlation_truncated === true) {
|
|
75
|
-
builder.limit(
|
|
76
|
-
source,
|
|
77
|
-
"Issue change correlation",
|
|
78
|
-
"Change correlation was not evaluated for every returned issue.",
|
|
79
|
-
"truncated",
|
|
80
|
-
);
|
|
81
|
-
}
|
|
67
|
+
const historyIncomplete =
|
|
68
|
+
record(value.recent_changes_history_coverage)?.incomplete === true;
|
|
82
69
|
const visibility = record(value.visibility);
|
|
83
70
|
if (
|
|
84
71
|
visibility &&
|
|
@@ -106,7 +93,7 @@ export function adaptIssues(
|
|
|
106
93
|
changes,
|
|
107
94
|
`changes:issues:${source.args ?? scopeFromArgs(source)}`,
|
|
108
95
|
undefined,
|
|
109
|
-
value.recent_changes_truncated !== true,
|
|
96
|
+
value.recent_changes_truncated !== true && !historyIncomplete,
|
|
110
97
|
);
|
|
111
98
|
} else {
|
|
112
99
|
invalidPayload(builder, source, "Issue-related changes");
|
|
@@ -114,6 +101,7 @@ export function adaptIssues(
|
|
|
114
101
|
} else if (issueChangesRaw !== undefined) {
|
|
115
102
|
invalidPayload(builder, source, "Issue-related changes");
|
|
116
103
|
}
|
|
104
|
+
addClusterScopedChanges(builder, source, value.cluster_scoped_changes);
|
|
117
105
|
const clusterDNS = record(record(value.cluster_context)?.dns);
|
|
118
106
|
if (clusterDNS) {
|
|
119
107
|
const signals = stringArray(clusterDNS.signals) ?? [];
|
|
@@ -140,33 +128,75 @@ export function adaptIssues(
|
|
|
140
128
|
}
|
|
141
129
|
}
|
|
142
130
|
if (issues.length === 0) {
|
|
143
|
-
|
|
144
|
-
return;
|
|
145
|
-
const args = record(source.args ? parseJSON(source.args) : undefined);
|
|
146
|
-
if (!nonEmptyString(args?.namespace)) {
|
|
147
|
-
builder.limit(
|
|
148
|
-
source,
|
|
149
|
-
"Issues",
|
|
150
|
-
"Radar found no matching issues, but the search covered only namespaces the current user can access.",
|
|
151
|
-
"unknown",
|
|
152
|
-
);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const scope = scopeFromArgs(source);
|
|
156
|
-
const relevance = sourceArgsRelevance(builder, source);
|
|
157
|
-
builder.observe(`issues:${source.args ?? scope}`, "receipt", source, {
|
|
158
|
-
tier: evidenceTierForRelevance("checked", relevance),
|
|
159
|
-
relevance,
|
|
160
|
-
tone: "neutral",
|
|
161
|
-
title: "No live issues matched this search",
|
|
162
|
-
summary: scope,
|
|
163
|
-
data: {
|
|
164
|
-
type: "receipt",
|
|
165
|
-
checked: "issues",
|
|
166
|
-
scope,
|
|
167
|
-
},
|
|
168
|
-
});
|
|
131
|
+
addNoIssuesReceipt(builder, source);
|
|
169
132
|
} else {
|
|
170
133
|
for (const item of issues) addIssueObservation(builder, source, item);
|
|
171
134
|
}
|
|
135
|
+
// Added last: these limit the change feed only, so they must not withhold
|
|
136
|
+
// the live-issue receipt above.
|
|
137
|
+
if (value.recent_changes_truncated === true) {
|
|
138
|
+
builder.limit(
|
|
139
|
+
source,
|
|
140
|
+
"Issue-related changes",
|
|
141
|
+
"The issue response omitted some recent changes.",
|
|
142
|
+
"truncated",
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
if (historyIncomplete) {
|
|
146
|
+
builder.limit(
|
|
147
|
+
source,
|
|
148
|
+
"Issue-related changes",
|
|
149
|
+
"Radar's change history is incomplete for part of the window, so earlier changes may be missing.",
|
|
150
|
+
"unknown",
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
if (nonEmptyString(value.recent_changes_error)) {
|
|
154
|
+
builder.limit(
|
|
155
|
+
source,
|
|
156
|
+
"Issue-related changes",
|
|
157
|
+
value.recent_changes_error,
|
|
158
|
+
"error",
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
if (value.correlation_truncated === true) {
|
|
162
|
+
builder.limit(
|
|
163
|
+
source,
|
|
164
|
+
"Issue change correlation",
|
|
165
|
+
"Change correlation was not evaluated for every returned issue.",
|
|
166
|
+
"truncated",
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// The receipt for a scan that found nothing, unless the scan itself was
|
|
172
|
+
// limited or covered only the caller's namespaces.
|
|
173
|
+
function addNoIssuesReceipt(
|
|
174
|
+
builder: ProjectionBuilder,
|
|
175
|
+
source: InvestigationEvidenceSource,
|
|
176
|
+
): void {
|
|
177
|
+
if (!source.confirmedSuccess || builder.limitedSources.has(source.id)) return;
|
|
178
|
+
const args = record(source.args ? parseJSON(source.args) : undefined);
|
|
179
|
+
if (!nonEmptyString(args?.namespace)) {
|
|
180
|
+
builder.limit(
|
|
181
|
+
source,
|
|
182
|
+
"Issues",
|
|
183
|
+
"Radar found no matching issues, but the search covered only namespaces the current user can access.",
|
|
184
|
+
"unknown",
|
|
185
|
+
);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const scope = scopeFromArgs(source);
|
|
189
|
+
const relevance = sourceArgsRelevance(builder, source);
|
|
190
|
+
builder.observe(`issues:${source.args ?? scope}`, "receipt", source, {
|
|
191
|
+
tier: evidenceTierForRelevance("checked", relevance),
|
|
192
|
+
relevance,
|
|
193
|
+
tone: "neutral",
|
|
194
|
+
title: "No live issues matched this search",
|
|
195
|
+
summary: scope,
|
|
196
|
+
data: {
|
|
197
|
+
type: "receipt",
|
|
198
|
+
checked: "issues",
|
|
199
|
+
scope,
|
|
200
|
+
},
|
|
201
|
+
});
|
|
172
202
|
}
|
|
@@ -620,6 +620,14 @@ const METRIC_FAMILY_LABELS: Record<string, string> = {
|
|
|
620
620
|
container_fs_usage_bytes: "Filesystem usage",
|
|
621
621
|
up: "Scrape target up",
|
|
622
622
|
};
|
|
623
|
+
|
|
624
|
+
function optionalStringList(value: unknown): boolean {
|
|
625
|
+
return (
|
|
626
|
+
value === undefined ||
|
|
627
|
+
(Array.isArray(value) && value.every((item) => typeof item === "string"))
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
|
|
623
631
|
export function adaptQueryPrometheus(
|
|
624
632
|
builder: ProjectionBuilder,
|
|
625
633
|
source: InvestigationEvidenceSource,
|
|
@@ -635,7 +643,12 @@ export function adaptQueryPrometheus(
|
|
|
635
643
|
!Array.isArray(value.selectors) ||
|
|
636
644
|
(value.selectorsUnknown !== undefined &&
|
|
637
645
|
typeof value.selectorsUnknown !== "boolean") ||
|
|
638
|
-
(value.truncated !== undefined && typeof value.truncated !== "boolean")
|
|
646
|
+
(value.truncated !== undefined && typeof value.truncated !== "boolean") ||
|
|
647
|
+
(value.partial !== undefined && typeof value.partial !== "boolean") ||
|
|
648
|
+
!optionalStringList(value.warnings) ||
|
|
649
|
+
!optionalStringList(value.infos) ||
|
|
650
|
+
(value.annotationsOmitted !== undefined &&
|
|
651
|
+
typeof value.annotationsOmitted !== "number")
|
|
639
652
|
) {
|
|
640
653
|
invalidPayload(builder, source, "Prometheus query");
|
|
641
654
|
return;
|
|
@@ -653,6 +666,43 @@ export function adaptQueryPrometheus(
|
|
|
653
666
|
invalidPayload(builder, source, "Prometheus query");
|
|
654
667
|
return;
|
|
655
668
|
}
|
|
669
|
+
if (value.partial === true) {
|
|
670
|
+
builder.limit(
|
|
671
|
+
source,
|
|
672
|
+
"Prometheus query",
|
|
673
|
+
"The metrics backend returned a partial result, so some series may be missing.",
|
|
674
|
+
"unknown",
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
const warnings = (value.warnings as string[] | undefined) ?? [];
|
|
678
|
+
const infos = (value.infos as string[] | undefined) ?? [];
|
|
679
|
+
if (warnings.length > 0) {
|
|
680
|
+
builder.limit(
|
|
681
|
+
source,
|
|
682
|
+
"Prometheus query",
|
|
683
|
+
`The metrics backend returned ${warnings.length === 1 ? "a warning" : `${warnings.length} warnings`} with this result: ${warnings.join("; ")}`,
|
|
684
|
+
"unknown",
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
if (infos.length > 0) {
|
|
688
|
+
builder.limit(
|
|
689
|
+
source,
|
|
690
|
+
"Prometheus query",
|
|
691
|
+
`Prometheus noted about this query: ${infos.join("; ")}`,
|
|
692
|
+
"unknown",
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
if (
|
|
696
|
+
typeof value.annotationsOmitted === "number" &&
|
|
697
|
+
value.annotationsOmitted > 0
|
|
698
|
+
) {
|
|
699
|
+
builder.limit(
|
|
700
|
+
source,
|
|
701
|
+
"Prometheus query",
|
|
702
|
+
`${value.annotationsOmitted} more backend ${value.annotationsOmitted === 1 ? "message was" : "messages were"} left out to keep the result small.`,
|
|
703
|
+
"unknown",
|
|
704
|
+
);
|
|
705
|
+
}
|
|
656
706
|
const selectorsUnknown = value.selectorsUnknown === true;
|
|
657
707
|
const relevance = metricsScope(
|
|
658
708
|
builder.target,
|
|
@@ -663,7 +713,19 @@ export function adaptQueryPrometheus(
|
|
|
663
713
|
const start = nonEmptyString(value.start) ? value.start : undefined;
|
|
664
714
|
const end = nonEmptyString(value.end) ? value.end : undefined;
|
|
665
715
|
const step = nonEmptyString(value.step) ? value.step : undefined;
|
|
666
|
-
const
|
|
716
|
+
const qualifications = [
|
|
717
|
+
warnings.length > 0
|
|
718
|
+
? `Backend warning${warnings.length === 1 ? "" : "s"}: ${warnings.join("; ")}.`
|
|
719
|
+
: "",
|
|
720
|
+
infos.length > 0 ? `Prometheus noted: ${infos.join("; ")}.` : "",
|
|
721
|
+
typeof value.annotationsOmitted === "number" && value.annotationsOmitted > 0
|
|
722
|
+
? `${value.annotationsOmitted} more backend ${value.annotationsOmitted === 1 ? "message" : "messages"} left out.`
|
|
723
|
+
: "",
|
|
724
|
+
].filter(Boolean);
|
|
725
|
+
const note =
|
|
726
|
+
[nonEmptyString(value.note) ? value.note : "", ...qualifications]
|
|
727
|
+
.filter(Boolean)
|
|
728
|
+
.join(" ") || undefined;
|
|
667
729
|
if (value.truncated === true) {
|
|
668
730
|
const summary = record(value.summary);
|
|
669
731
|
const cardinality = record(summary?.labelCardinality);
|
|
@@ -79,3 +79,40 @@ describe("resource cards scaled by an HPA", () => {
|
|
|
79
79
|
expect(card.summary).toBe("5/5 replicas ready");
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
describe("resource cards with Pod/template differences", () => {
|
|
84
|
+
it("shows the first difference as a card warning, not a finding", () => {
|
|
85
|
+
const result = project([
|
|
86
|
+
tool("workload", "diagnose", {
|
|
87
|
+
resource: {
|
|
88
|
+
apiVersion: "apps/v1",
|
|
89
|
+
kind: "Deployment",
|
|
90
|
+
metadata: { namespace: "shop", name: "api" },
|
|
91
|
+
},
|
|
92
|
+
resourceContext: {
|
|
93
|
+
tier: "diagnostic",
|
|
94
|
+
templateDivergence: {
|
|
95
|
+
summary: "1 of 3 current Pods differ.",
|
|
96
|
+
podsCompared: 3,
|
|
97
|
+
podsDiffering: 1,
|
|
98
|
+
podsNotCompared: 1,
|
|
99
|
+
examplePod: "api-2",
|
|
100
|
+
baseline: "ReplicaSet api-1",
|
|
101
|
+
differences: [
|
|
102
|
+
"containers[api].resources.limits.memory is 16Mi; template specifies 256Mi",
|
|
103
|
+
"containers[api].resources.requests.memory is 16Mi; template specifies 128Mi",
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
]);
|
|
109
|
+
const card = groupsOf(result.groups, "resource")[0].latest;
|
|
110
|
+
expect(card.tone).toBe("neutral");
|
|
111
|
+
if (card.data.type === "resource") {
|
|
112
|
+
expect(card.data.warnings).toEqual([
|
|
113
|
+
"1 of 3 compared Pods differ from their template, 1 more not compared: containers[api].resources.limits.memory is 16Mi; template specifies 256Mi (and more)",
|
|
114
|
+
]);
|
|
115
|
+
}
|
|
116
|
+
expect(groupsOf(result.groups, "issue")).toHaveLength(0);
|
|
117
|
+
});
|
|
118
|
+
});
|