@skyhook-io/radar-app 1.17.1 → 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/package.json +9 -9
- package/src/App.tsx +14 -30
- package/src/api/client.gitopsPoll.test.ts +99 -0
- package/src/api/client.helmPreview.test.tsx +48 -0
- package/src/api/client.resourceAvailability.test.ts +24 -0
- package/src/api/client.ts +337 -87
- package/src/api/client.workloadRuns.test.ts +53 -0
- 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.ts +1 -0
- package/src/api/traffic.scope.render.test.tsx +60 -0
- package/src/api/traffic.ts +3 -1
- package/src/components/cnpg/CNPGSummaryHost.tsx +4 -3
- 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 -51
- 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 +107 -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 +6 -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/GitOpsView.tsx +7 -0
- package/src/components/helm/HelmReleaseDrawer.tsx +139 -55
- 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 +76 -4
- package/src/components/helm/TrackChartSourceDialog.test.ts +3 -2
- package/src/components/helm/TrackChartSourceDialog.tsx +41 -15
- package/src/components/helm/ValuesDiffPreview.tsx +4 -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 +15 -6
- package/src/components/home/MCPSetupDialog.test.tsx +30 -0
- package/src/components/home/MCPSetupDialog.tsx +13 -6
- package/src/components/home/ProblemsPanel.test.tsx +1 -0
- package/src/components/home/mcpToolCatalog.ts +18 -2
- package/src/components/issues/IssuesPane.render.test.tsx +21 -0
- package/src/components/issues/IssuesPane.tsx +31 -7
- 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 +58 -5
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
- 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/ResourcesView.scope.render.test.tsx +58 -0
- package/src/components/resources/ResourcesView.tsx +18 -3
- 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/SettingsDialog.tsx +21 -15
- 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/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/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.tsx +37 -5
- package/src/context/ConnectionContext.test.ts +27 -1
- package/src/context/ConnectionContext.tsx +17 -7
- package/src/integrations/resourceHosts.test.tsx +1 -0
- package/src/integrations/resourceHosts.tsx +2 -0
- package/src/utils/navigation.ts +14 -0
- package/src/utils/wails-clipboard.ts +4 -2
package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compacted": {
|
|
3
|
+
"changes": [
|
|
4
|
+
{
|
|
5
|
+
"kind": "Deployment",
|
|
6
|
+
"apiVersion": "apps/v1",
|
|
7
|
+
"namespace": "shop",
|
|
8
|
+
"name": "checkout",
|
|
9
|
+
"changeType": "update",
|
|
10
|
+
"summary": "env(checkout/CART_ADDR) changed",
|
|
11
|
+
"timestamp": "2026-10-16T04:55:24+03:00",
|
|
12
|
+
"change_category": "spec_config",
|
|
13
|
+
"rank_reason": "application configuration field changed",
|
|
14
|
+
"application_configuration_change": true,
|
|
15
|
+
"fields": [
|
|
16
|
+
{
|
|
17
|
+
"path": "spec.template.spec.containers[checkout].env[CART_ADDR]",
|
|
18
|
+
"oldValue": "cart:7070",
|
|
19
|
+
"newValue": "localhost:7070"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"kind": "Deployment",
|
|
25
|
+
"apiVersion": "apps/v1",
|
|
26
|
+
"namespace": "shop",
|
|
27
|
+
"name": "debug",
|
|
28
|
+
"changeType": "add",
|
|
29
|
+
"summary": "add",
|
|
30
|
+
"timestamp": "2026-10-16T04:53:24+03:00",
|
|
31
|
+
"change_category": "lifecycle",
|
|
32
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"kind": "NetworkPolicy",
|
|
36
|
+
"apiVersion": "networking.k8s.io/v1",
|
|
37
|
+
"namespace": "shop",
|
|
38
|
+
"name": "deny-all",
|
|
39
|
+
"changeType": "add",
|
|
40
|
+
"summary": "add",
|
|
41
|
+
"timestamp": "2026-10-16T04:43:28+03:00",
|
|
42
|
+
"change_category": "lifecycle",
|
|
43
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"kind": "Service",
|
|
47
|
+
"apiVersion": "v1",
|
|
48
|
+
"namespace": "shop",
|
|
49
|
+
"name": "legacy",
|
|
50
|
+
"changeType": "delete",
|
|
51
|
+
"summary": "delete",
|
|
52
|
+
"timestamp": "2026-10-16T04:43:26+03:00",
|
|
53
|
+
"change_category": "lifecycle",
|
|
54
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"kind": "Deployment",
|
|
58
|
+
"apiVersion": "apps/v1",
|
|
59
|
+
"namespace": "shop",
|
|
60
|
+
"name": "cart",
|
|
61
|
+
"changeType": "update",
|
|
62
|
+
"summary": "ready: 0→1",
|
|
63
|
+
"timestamp": "2026-10-16T04:43:54+03:00",
|
|
64
|
+
"change_category": "runtime_status",
|
|
65
|
+
"rank_reason": "status field changed",
|
|
66
|
+
"fields": [
|
|
67
|
+
{
|
|
68
|
+
"path": "status.readyReplicas",
|
|
69
|
+
"oldValue": 0,
|
|
70
|
+
"newValue": 1
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"created": [
|
|
76
|
+
{
|
|
77
|
+
"namespace": "shop",
|
|
78
|
+
"first": "2026-10-16T04:43:24+03:00",
|
|
79
|
+
"count": 13,
|
|
80
|
+
"apiVersions": {
|
|
81
|
+
"ConfigMap": "v1",
|
|
82
|
+
"Deployment": "apps/v1",
|
|
83
|
+
"Service": "v1"
|
|
84
|
+
},
|
|
85
|
+
"objects": [
|
|
86
|
+
"+0s Deployment/cart",
|
|
87
|
+
"+0s Service/cart",
|
|
88
|
+
"+1s Deployment/checkout",
|
|
89
|
+
"+1s Service/checkout",
|
|
90
|
+
"+2s Deployment/frontend",
|
|
91
|
+
"+2s Service/frontend",
|
|
92
|
+
"+3s ConfigMap/checkout-config (used by Deployment/checkout)",
|
|
93
|
+
"+3s Deployment/payment",
|
|
94
|
+
"+3s Service/payment",
|
|
95
|
+
"+4s Deployment/shipping",
|
|
96
|
+
"+4s Service/shipping",
|
|
97
|
+
"+5s Deployment/catalog",
|
|
98
|
+
"+5s Service/catalog"
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"original": {
|
|
104
|
+
"changes": [
|
|
105
|
+
{
|
|
106
|
+
"kind": "Deployment",
|
|
107
|
+
"apiVersion": "apps/v1",
|
|
108
|
+
"namespace": "shop",
|
|
109
|
+
"name": "checkout",
|
|
110
|
+
"changeType": "update",
|
|
111
|
+
"summary": "env(checkout/CART_ADDR) changed",
|
|
112
|
+
"timestamp": "2026-10-16T04:55:24+03:00",
|
|
113
|
+
"change_category": "spec_config",
|
|
114
|
+
"rank_reason": "application configuration field changed",
|
|
115
|
+
"application_configuration_change": true,
|
|
116
|
+
"fields": [
|
|
117
|
+
{
|
|
118
|
+
"path": "spec.template.spec.containers[checkout].env[CART_ADDR]",
|
|
119
|
+
"oldValue": "cart:7070",
|
|
120
|
+
"newValue": "localhost:7070"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"kind": "Deployment",
|
|
126
|
+
"apiVersion": "apps/v1",
|
|
127
|
+
"namespace": "shop",
|
|
128
|
+
"name": "debug",
|
|
129
|
+
"changeType": "add",
|
|
130
|
+
"summary": "add",
|
|
131
|
+
"timestamp": "2026-10-16T04:53:24+03:00",
|
|
132
|
+
"change_category": "lifecycle",
|
|
133
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"kind": "Deployment",
|
|
137
|
+
"apiVersion": "apps/v1",
|
|
138
|
+
"namespace": "shop",
|
|
139
|
+
"name": "catalog",
|
|
140
|
+
"changeType": "add",
|
|
141
|
+
"summary": "add",
|
|
142
|
+
"timestamp": "2026-10-16T04:43:29+03:00",
|
|
143
|
+
"change_category": "lifecycle",
|
|
144
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"kind": "Service",
|
|
148
|
+
"apiVersion": "v1",
|
|
149
|
+
"namespace": "shop",
|
|
150
|
+
"name": "catalog",
|
|
151
|
+
"changeType": "add",
|
|
152
|
+
"summary": "add",
|
|
153
|
+
"timestamp": "2026-10-16T04:43:29+03:00",
|
|
154
|
+
"change_category": "lifecycle",
|
|
155
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"kind": "Deployment",
|
|
159
|
+
"apiVersion": "apps/v1",
|
|
160
|
+
"namespace": "shop",
|
|
161
|
+
"name": "shipping",
|
|
162
|
+
"changeType": "add",
|
|
163
|
+
"summary": "add",
|
|
164
|
+
"timestamp": "2026-10-16T04:43:28+03:00",
|
|
165
|
+
"change_category": "lifecycle",
|
|
166
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"kind": "NetworkPolicy",
|
|
170
|
+
"apiVersion": "networking.k8s.io/v1",
|
|
171
|
+
"namespace": "shop",
|
|
172
|
+
"name": "deny-all",
|
|
173
|
+
"changeType": "add",
|
|
174
|
+
"summary": "add",
|
|
175
|
+
"timestamp": "2026-10-16T04:43:28+03:00",
|
|
176
|
+
"change_category": "lifecycle",
|
|
177
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"kind": "Service",
|
|
181
|
+
"apiVersion": "v1",
|
|
182
|
+
"namespace": "shop",
|
|
183
|
+
"name": "shipping",
|
|
184
|
+
"changeType": "add",
|
|
185
|
+
"summary": "add",
|
|
186
|
+
"timestamp": "2026-10-16T04:43:28+03:00",
|
|
187
|
+
"change_category": "lifecycle",
|
|
188
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"kind": "ConfigMap",
|
|
192
|
+
"apiVersion": "v1",
|
|
193
|
+
"namespace": "shop",
|
|
194
|
+
"name": "checkout-config",
|
|
195
|
+
"changeType": "add",
|
|
196
|
+
"summary": "add",
|
|
197
|
+
"timestamp": "2026-10-16T04:43:27+03:00",
|
|
198
|
+
"change_category": "lifecycle",
|
|
199
|
+
"rank_reason": "resource create/delete for config or desired state",
|
|
200
|
+
"consumed_by": [
|
|
201
|
+
"Deployment/checkout"
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"kind": "Deployment",
|
|
206
|
+
"apiVersion": "apps/v1",
|
|
207
|
+
"namespace": "shop",
|
|
208
|
+
"name": "payment",
|
|
209
|
+
"changeType": "add",
|
|
210
|
+
"summary": "add",
|
|
211
|
+
"timestamp": "2026-10-16T04:43:27+03:00",
|
|
212
|
+
"change_category": "lifecycle",
|
|
213
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"kind": "Service",
|
|
217
|
+
"apiVersion": "v1",
|
|
218
|
+
"namespace": "shop",
|
|
219
|
+
"name": "payment",
|
|
220
|
+
"changeType": "add",
|
|
221
|
+
"summary": "add",
|
|
222
|
+
"timestamp": "2026-10-16T04:43:27+03:00",
|
|
223
|
+
"change_category": "lifecycle",
|
|
224
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"kind": "Deployment",
|
|
228
|
+
"apiVersion": "apps/v1",
|
|
229
|
+
"namespace": "shop",
|
|
230
|
+
"name": "frontend",
|
|
231
|
+
"changeType": "add",
|
|
232
|
+
"summary": "add",
|
|
233
|
+
"timestamp": "2026-10-16T04:43:26+03:00",
|
|
234
|
+
"change_category": "lifecycle",
|
|
235
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"kind": "Service",
|
|
239
|
+
"apiVersion": "v1",
|
|
240
|
+
"namespace": "shop",
|
|
241
|
+
"name": "frontend",
|
|
242
|
+
"changeType": "add",
|
|
243
|
+
"summary": "add",
|
|
244
|
+
"timestamp": "2026-10-16T04:43:26+03:00",
|
|
245
|
+
"change_category": "lifecycle",
|
|
246
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"kind": "Service",
|
|
250
|
+
"apiVersion": "v1",
|
|
251
|
+
"namespace": "shop",
|
|
252
|
+
"name": "legacy",
|
|
253
|
+
"changeType": "delete",
|
|
254
|
+
"summary": "delete",
|
|
255
|
+
"timestamp": "2026-10-16T04:43:26+03:00",
|
|
256
|
+
"change_category": "lifecycle",
|
|
257
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"kind": "Deployment",
|
|
261
|
+
"apiVersion": "apps/v1",
|
|
262
|
+
"namespace": "shop",
|
|
263
|
+
"name": "checkout",
|
|
264
|
+
"changeType": "add",
|
|
265
|
+
"summary": "add",
|
|
266
|
+
"timestamp": "2026-10-16T04:43:25+03:00",
|
|
267
|
+
"change_category": "lifecycle",
|
|
268
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"kind": "Service",
|
|
272
|
+
"apiVersion": "v1",
|
|
273
|
+
"namespace": "shop",
|
|
274
|
+
"name": "checkout",
|
|
275
|
+
"changeType": "add",
|
|
276
|
+
"summary": "add",
|
|
277
|
+
"timestamp": "2026-10-16T04:43:25+03:00",
|
|
278
|
+
"change_category": "lifecycle",
|
|
279
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"kind": "Deployment",
|
|
283
|
+
"apiVersion": "apps/v1",
|
|
284
|
+
"namespace": "shop",
|
|
285
|
+
"name": "cart",
|
|
286
|
+
"changeType": "add",
|
|
287
|
+
"summary": "add",
|
|
288
|
+
"timestamp": "2026-10-16T04:43:24+03:00",
|
|
289
|
+
"change_category": "lifecycle",
|
|
290
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"kind": "Service",
|
|
294
|
+
"apiVersion": "v1",
|
|
295
|
+
"namespace": "shop",
|
|
296
|
+
"name": "cart",
|
|
297
|
+
"changeType": "add",
|
|
298
|
+
"summary": "add",
|
|
299
|
+
"timestamp": "2026-10-16T04:43:24+03:00",
|
|
300
|
+
"change_category": "lifecycle",
|
|
301
|
+
"rank_reason": "resource create/delete for config or desired state"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"kind": "Deployment",
|
|
305
|
+
"apiVersion": "apps/v1",
|
|
306
|
+
"namespace": "shop",
|
|
307
|
+
"name": "cart",
|
|
308
|
+
"changeType": "update",
|
|
309
|
+
"summary": "ready: 0→1",
|
|
310
|
+
"timestamp": "2026-10-16T04:43:54+03:00",
|
|
311
|
+
"change_category": "runtime_status",
|
|
312
|
+
"rank_reason": "status field changed",
|
|
313
|
+
"fields": [
|
|
314
|
+
{
|
|
315
|
+
"path": "status.readyReplicas",
|
|
316
|
+
"oldValue": 0,
|
|
317
|
+
"newValue": 1
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { VISIBLE_LOG_EVIDENCE_LINES } from "../excerpt";
|
|
2
|
-
import { useContext } from "react";
|
|
2
|
+
import { Fragment, useContext } from "react";
|
|
3
3
|
import {
|
|
4
|
+
AlertBanner,
|
|
4
5
|
Badge,
|
|
5
6
|
DiffViewer,
|
|
6
7
|
TerminalBlock,
|
|
7
8
|
formatRelativeAgeTime,
|
|
9
|
+
pluralize,
|
|
8
10
|
ResourceLink,
|
|
9
11
|
stripAnsi,
|
|
10
12
|
} from "@skyhook-io/k8s-ui";
|
|
13
|
+
import { builtinGroupForKind } from "@skyhook-io/k8s-ui/utils/api-resources";
|
|
11
14
|
import { apiVersionToGroup } from "../../../../utils/navigation";
|
|
12
15
|
import { Tooltip } from "../../../ui/Tooltip";
|
|
13
16
|
import { EvidenceNavigationContext } from "../navigation";
|
|
@@ -133,6 +136,49 @@ export function EventsBody({ data }: { data: EvidenceDataOf<"events"> }) {
|
|
|
133
136
|
);
|
|
134
137
|
}
|
|
135
138
|
|
|
139
|
+
// The producer caps consumed_by and running_previous_value.workloads at five
|
|
140
|
+
// (maxConsumersPerEntry), so a full list may not be the whole set.
|
|
141
|
+
const REFERENCE_LIST_CAP = 5;
|
|
142
|
+
|
|
143
|
+
function ChangeReferences({
|
|
144
|
+
references,
|
|
145
|
+
namespace,
|
|
146
|
+
}: {
|
|
147
|
+
references: string[];
|
|
148
|
+
namespace?: string;
|
|
149
|
+
}) {
|
|
150
|
+
const { onOpenResource } = useContext(EvidenceNavigationContext);
|
|
151
|
+
return references.map((reference) => {
|
|
152
|
+
const slash = reference.indexOf("/");
|
|
153
|
+
const kind = reference.slice(0, slash);
|
|
154
|
+
const name = reference.slice(slash + 1);
|
|
155
|
+
// The producer names only Kind/name, so a link is safe only for kinds
|
|
156
|
+
// whose group is known and a row with a namespace; a CRD owner such as a
|
|
157
|
+
// CNPG Cluster stays text.
|
|
158
|
+
const group =
|
|
159
|
+
kind === "Rollout" ? "argoproj.io" : builtinGroupForKind(kind);
|
|
160
|
+
return (
|
|
161
|
+
<span
|
|
162
|
+
key={reference}
|
|
163
|
+
className="min-w-0 max-w-full font-mono [overflow-wrap:anywhere]"
|
|
164
|
+
>
|
|
165
|
+
{group === undefined || !namespace ? (
|
|
166
|
+
reference
|
|
167
|
+
) : (
|
|
168
|
+
<ResourceLink
|
|
169
|
+
name={name}
|
|
170
|
+
kind={kind}
|
|
171
|
+
namespace={namespace}
|
|
172
|
+
group={group}
|
|
173
|
+
label={reference}
|
|
174
|
+
onNavigate={onOpenResource}
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
</span>
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
136
182
|
export function ChangesBody({ data }: { data: EvidenceDataOf<"changes"> }) {
|
|
137
183
|
const { onOpenResource } = useContext(EvidenceNavigationContext);
|
|
138
184
|
return (
|
|
@@ -145,13 +191,13 @@ export function ChangesBody({ data }: { data: EvidenceDataOf<"changes"> }) {
|
|
|
145
191
|
{data.changes.map((change, index) => (
|
|
146
192
|
<div
|
|
147
193
|
key={`${change.kind}-${change.namespace ?? ""}-${change.name}-${change.timestamp}-${index}`}
|
|
148
|
-
className="rounded-md border border-theme-border/70 bg-theme-base/30 p-2.5"
|
|
194
|
+
className="min-w-0 rounded-md border border-theme-border/70 bg-theme-base/30 p-2.5 [overflow-wrap:anywhere]"
|
|
149
195
|
>
|
|
150
196
|
<div className="flex flex-wrap items-center gap-1.5">
|
|
151
197
|
<Badge tone="structural" size="sm">
|
|
152
198
|
{change.kind}
|
|
153
199
|
</Badge>
|
|
154
|
-
<span className="font-mono text-xs">
|
|
200
|
+
<span className="min-w-0 max-w-full font-mono text-xs">
|
|
155
201
|
<ResourceLink
|
|
156
202
|
name={change.name}
|
|
157
203
|
kind={change.kind}
|
|
@@ -172,25 +218,108 @@ export function ChangesBody({ data }: { data: EvidenceDataOf<"changes"> }) {
|
|
|
172
218
|
<Badge tone="note" size="sm">
|
|
173
219
|
{change.changeType.replaceAll("_", " ")}
|
|
174
220
|
</Badge>
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
221
|
+
<div className="ml-auto flex min-w-0 flex-wrap items-center gap-1.5">
|
|
222
|
+
{(change.updates_in_window ?? 0) > 1 ? (
|
|
223
|
+
<Badge
|
|
224
|
+
tone="structural"
|
|
225
|
+
size="sm"
|
|
226
|
+
className="max-w-full whitespace-normal"
|
|
227
|
+
>
|
|
228
|
+
{change.updates_in_window} updates
|
|
229
|
+
{change.first_update_at
|
|
230
|
+
? `, first ${formatRelativeAgeTime(change.first_update_at)}`
|
|
231
|
+
: ""}
|
|
232
|
+
</Badge>
|
|
233
|
+
) : null}
|
|
234
|
+
<Tooltip
|
|
235
|
+
content={new Date(change.timestamp).toLocaleString()}
|
|
236
|
+
delay={150}
|
|
237
|
+
position="left"
|
|
184
238
|
>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
239
|
+
<time
|
|
240
|
+
dateTime={change.timestamp}
|
|
241
|
+
className="text-xs text-theme-text-tertiary"
|
|
242
|
+
>
|
|
243
|
+
{formatRelativeAgeTime(change.timestamp)}
|
|
244
|
+
</time>
|
|
245
|
+
</Tooltip>
|
|
246
|
+
</div>
|
|
188
247
|
</div>
|
|
189
248
|
{change.summary ? (
|
|
190
249
|
<p className="mt-1.5 text-xs text-theme-text-secondary">
|
|
191
250
|
{change.summary}
|
|
192
251
|
</p>
|
|
193
252
|
) : null}
|
|
253
|
+
{change.running_previous_value ? (
|
|
254
|
+
<AlertBanner
|
|
255
|
+
variant="warning"
|
|
256
|
+
className="mt-2"
|
|
257
|
+
title={`${pluralize(change.running_previous_value.pods, "Pod")} likely still ${change.running_previous_value.pods === 1 ? "holds" : "hold"} the earlier value`}
|
|
258
|
+
>
|
|
259
|
+
<div className="mt-1 space-y-1.5 text-xs text-theme-text-secondary">
|
|
260
|
+
<p>
|
|
261
|
+
Changed keys read as env:{" "}
|
|
262
|
+
{change.running_previous_value.keys.map((key, keyIndex) => (
|
|
263
|
+
<Fragment key={key}>
|
|
264
|
+
{keyIndex > 0 ? ", " : null}
|
|
265
|
+
<Badge
|
|
266
|
+
tone="structural"
|
|
267
|
+
size="sm"
|
|
268
|
+
className="max-w-full whitespace-normal font-mono [overflow-wrap:anywhere]"
|
|
269
|
+
>
|
|
270
|
+
{key}
|
|
271
|
+
</Badge>
|
|
272
|
+
</Fragment>
|
|
273
|
+
))}
|
|
274
|
+
</p>
|
|
275
|
+
{(change.running_previous_value.workloads ?? []).length > 0 ? (
|
|
276
|
+
<div className="flex min-w-0 flex-wrap gap-x-2 gap-y-1">
|
|
277
|
+
<span>In workloads you can view:</span>
|
|
278
|
+
<ChangeReferences
|
|
279
|
+
references={change.running_previous_value.workloads ?? []}
|
|
280
|
+
namespace={change.namespace}
|
|
281
|
+
/>
|
|
282
|
+
{(change.running_previous_value.workloads ?? []).length >=
|
|
283
|
+
REFERENCE_LIST_CAP ? (
|
|
284
|
+
<span>(first {REFERENCE_LIST_CAP})</span>
|
|
285
|
+
) : null}
|
|
286
|
+
{change.running_previous_value.withheld ? (
|
|
287
|
+
<span>
|
|
288
|
+
+{change.running_previous_value.withheld.count} more
|
|
289
|
+
you can't view
|
|
290
|
+
</span>
|
|
291
|
+
) : null}
|
|
292
|
+
</div>
|
|
293
|
+
) : (
|
|
294
|
+
<p>
|
|
295
|
+
{change.running_previous_value.withheld
|
|
296
|
+
? `In ${pluralize(change.running_previous_value.withheld.count, "workload")} you can't view`
|
|
297
|
+
: "workload names hidden by your permissions"}
|
|
298
|
+
</p>
|
|
299
|
+
)}
|
|
300
|
+
<p>{change.running_previous_value.note}</p>
|
|
301
|
+
</div>
|
|
302
|
+
</AlertBanner>
|
|
303
|
+
) : null}
|
|
304
|
+
{change.consumed_by?.length || change.consumed_by_withheld ? (
|
|
305
|
+
<div className="mt-1.5 flex min-w-0 flex-wrap gap-x-2 gap-y-1 text-xs text-theme-text-secondary">
|
|
306
|
+
<span>Referenced by</span>
|
|
307
|
+
<ChangeReferences
|
|
308
|
+
references={change.consumed_by ?? []}
|
|
309
|
+
namespace={change.namespace}
|
|
310
|
+
/>
|
|
311
|
+
{(change.consumed_by?.length ?? 0) >= REFERENCE_LIST_CAP ? (
|
|
312
|
+
<span>(first {REFERENCE_LIST_CAP})</span>
|
|
313
|
+
) : null}
|
|
314
|
+
{change.consumed_by_withheld ? (
|
|
315
|
+
<span>
|
|
316
|
+
{change.consumed_by?.length
|
|
317
|
+
? `+${change.consumed_by_withheld.count} more you can't view`
|
|
318
|
+
: `${pluralize(change.consumed_by_withheld.count, "workload")} you can't view`}
|
|
319
|
+
</span>
|
|
320
|
+
) : null}
|
|
321
|
+
</div>
|
|
322
|
+
) : null}
|
|
194
323
|
{change.fields?.length ? (
|
|
195
324
|
<div className="mt-2">
|
|
196
325
|
<DiffViewer
|
|
@@ -182,6 +182,7 @@ const INVESTIGATION_RESULT_LABELS: Readonly<Record<string, string>> = {
|
|
|
182
182
|
get_neighborhood: "Relationships",
|
|
183
183
|
get_topology: "Topology",
|
|
184
184
|
get_workload_logs: "Workload logs",
|
|
185
|
+
wait_for: "Wait",
|
|
185
186
|
get_prometheus_rules: "Alert rules",
|
|
186
187
|
get_helm_release: "Helm release",
|
|
187
188
|
get_subject_permissions: "Permissions",
|
|
@@ -700,6 +701,11 @@ export function addResourceObservation(
|
|
|
700
701
|
: warnings.length > 0
|
|
701
702
|
? "warning"
|
|
702
703
|
: "neutral";
|
|
704
|
+
// A Pod/template difference is listed with the warnings but does not set
|
|
705
|
+
// the tone: admission defaults (LimitRange, injected sidecars) produce it on
|
|
706
|
+
// healthy Pods.
|
|
707
|
+
const divergence = templateDivergenceWarning(context);
|
|
708
|
+
if (divergence) warnings = [...warnings, divergence];
|
|
703
709
|
const namespace = resource.metadata.namespace;
|
|
704
710
|
const identity = `${resource.apiVersion}:${resource.kind}:${namespace ?? ""}:${resource.metadata.name}`;
|
|
705
711
|
builder.observe(identity, "resource", source, {
|
|
@@ -724,6 +730,20 @@ export function addResourceObservation(
|
|
|
724
730
|
});
|
|
725
731
|
addResourceContextLimitations(builder, source, context);
|
|
726
732
|
}
|
|
733
|
+
// The live Pod spec differing from its template is context, not a fault, so
|
|
734
|
+
// it reads as a line on the resource card rather than a finding of its own.
|
|
735
|
+
function templateDivergenceWarning(
|
|
736
|
+
context: InvestigationResourceContext | undefined,
|
|
737
|
+
): string | undefined {
|
|
738
|
+
const divergence = context?.templateDivergence;
|
|
739
|
+
const first = divergence?.differences?.[0];
|
|
740
|
+
if (!divergence || !nonEmptyString(first)) return undefined;
|
|
741
|
+
const scope = divergence.examplePod
|
|
742
|
+
? `${divergence.podsDiffering} of ${divergence.podsCompared} compared Pods${divergence.podsCapped ? " (the most recent)" : ""} differ from their template${divergence.podsNotCompared ? `, ${divergence.podsNotCompared} more not compared` : ""}`
|
|
743
|
+
: "Live Pod spec differs from its template";
|
|
744
|
+
const more = divergence.differences.length > 1 ? " (and more)" : "";
|
|
745
|
+
return `${scope}: ${first}${more}`;
|
|
746
|
+
}
|
|
727
747
|
export function addIssueObservation(
|
|
728
748
|
builder: ProjectionBuilder,
|
|
729
749
|
source: InvestigationEvidenceSource,
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
type Issue,
|
|
3
3
|
type IssueRecentChange,
|
|
4
4
|
stripAnsi,
|
|
5
|
+
type IssueWithheld,
|
|
5
6
|
} from "@skyhook-io/k8s-ui";
|
|
6
7
|
import { type TimeSeries } from "@skyhook-io/k8s-ui/components/charts";
|
|
7
8
|
import {
|
|
@@ -186,7 +187,62 @@ export function recentChange(value: unknown): IssueRecentChange | undefined {
|
|
|
186
187
|
) {
|
|
187
188
|
return undefined;
|
|
188
189
|
}
|
|
189
|
-
|
|
190
|
+
const {
|
|
191
|
+
running_previous_value,
|
|
192
|
+
updates_in_window,
|
|
193
|
+
first_update_at,
|
|
194
|
+
consumed_by,
|
|
195
|
+
consumed_by_withheld,
|
|
196
|
+
...change
|
|
197
|
+
} = candidate;
|
|
198
|
+
const running = record(running_previous_value);
|
|
199
|
+
const workloads =
|
|
200
|
+
running?.workloads === null ? [] : stringArray(running?.workloads);
|
|
201
|
+
const keys = stringArray(running?.keys);
|
|
202
|
+
const consumers = stringArray(consumed_by);
|
|
203
|
+
const runningWithheld = withheld(running?.withheld);
|
|
204
|
+
const consumersWithheld = withheld(consumed_by_withheld);
|
|
205
|
+
return {
|
|
206
|
+
...change,
|
|
207
|
+
...(running &&
|
|
208
|
+
workloads &&
|
|
209
|
+
keys &&
|
|
210
|
+
nonNegativeInteger(running.pods) &&
|
|
211
|
+
typeof running.note === "string"
|
|
212
|
+
? {
|
|
213
|
+
running_previous_value: {
|
|
214
|
+
workloads,
|
|
215
|
+
...(runningWithheld ? { withheld: runningWithheld } : {}),
|
|
216
|
+
pods: running.pods,
|
|
217
|
+
keys,
|
|
218
|
+
note: running.note,
|
|
219
|
+
},
|
|
220
|
+
}
|
|
221
|
+
: {}),
|
|
222
|
+
...(nonNegativeInteger(updates_in_window) && updates_in_window > 0
|
|
223
|
+
? { updates_in_window }
|
|
224
|
+
: {}),
|
|
225
|
+
...(typeof first_update_at === "string" &&
|
|
226
|
+
Number.isFinite(Date.parse(first_update_at))
|
|
227
|
+
? { first_update_at }
|
|
228
|
+
: {}),
|
|
229
|
+
...(consumers ? { consumed_by: consumers } : {}),
|
|
230
|
+
...(consumersWithheld ? { consumed_by_withheld: consumersWithheld } : {}),
|
|
231
|
+
} as unknown as IssueRecentChange;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// withheld keeps a well-formed {count, reason} marker; anything else drops it.
|
|
235
|
+
function withheld(value: unknown): IssueWithheld | undefined {
|
|
236
|
+
const candidate = record(value);
|
|
237
|
+
if (
|
|
238
|
+
!candidate ||
|
|
239
|
+
!nonNegativeInteger(candidate.count) ||
|
|
240
|
+
candidate.count === 0 ||
|
|
241
|
+
!nonEmptyString(candidate.reason)
|
|
242
|
+
) {
|
|
243
|
+
return undefined;
|
|
244
|
+
}
|
|
245
|
+
return { count: candidate.count, reason: candidate.reason };
|
|
190
246
|
}
|
|
191
247
|
export function diagnosisChangeContext(
|
|
192
248
|
value: unknown,
|