@skyhook-io/radar-app 1.23.0 → 1.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/App.tsx +14 -3
- package/src/api/client.ts +29 -3
- package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
- package/src/api/poll.ts +78 -0
- package/src/api/radarFeatures.ts +3 -0
- package/src/components/CloudFunnelButton.tsx +1 -0
- package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
- package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
- package/src/components/helm/HelmView.tsx +4 -3
- package/src/components/helm/ObservedHelmNotice.tsx +39 -17
- package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
- package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
- package/src/components/issues/uncheckedSources.test.ts +8 -0
- package/src/components/issues/uncheckedSources.ts +3 -0
- package/src/components/nudges/activeNudges.test.ts +39 -0
- package/src/components/nudges/activeNudges.ts +76 -0
- package/src/components/poll/OssPoll.tsx +871 -0
- package/src/components/poll/mount.test.ts +12 -0
- package/src/components/poll/pollCloud.test.ts +23 -0
- package/src/components/poll/pollCloud.ts +6 -0
- package/src/components/poll/pollDefinition.ts +93 -0
- package/src/components/poll/pollFlow.test.ts +140 -0
- package/src/components/poll/pollFlow.ts +137 -0
- package/src/components/poll/pollSender.test.ts +137 -0
- package/src/components/poll/pollSender.ts +76 -0
- package/src/components/poll/pollStorage.test.ts +53 -0
- package/src/components/poll/pollStorage.ts +77 -0
- package/src/components/poll/round.json +350 -0
- package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
- package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
- package/src/components/resources/ImageFilesystemModal.tsx +42 -3
- package/src/components/resources/ResourcesView.tsx +22 -5
- package/src/components/ui/UpdateNotification.tsx +2 -0
- package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
- package/src/components/whats-new/WhatsNew.tsx +2 -0
- package/src/components/whats-new/releaseNotes.ts +75 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { COOLDOWN_MS, MIN_ACTIVE_DAYS, browserAllows, mergePollState, readPollState, recordActiveDay, writePollState } from './pollStorage'
|
|
3
|
+
|
|
4
|
+
function memoryStorage() {
|
|
5
|
+
const data = new Map<string, string>()
|
|
6
|
+
return { getItem: (k: string) => data.get(k) ?? null, setItem: (k: string, v: string) => void data.set(k, v), data }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const DAY = 24 * 60 * 60 * 1000
|
|
10
|
+
|
|
11
|
+
describe('browser poll state', () => {
|
|
12
|
+
it('is scoped by API base', () => {
|
|
13
|
+
const s = memoryStorage()
|
|
14
|
+
writePollState(s, '/api', { activeDays: 3 })
|
|
15
|
+
expect(readPollState(s, '/api')?.activeDays).toBe(3)
|
|
16
|
+
expect(readPollState(s, 'https://other/api')?.activeDays).toBe(0)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('treats unavailable storage as "never show"', () => {
|
|
20
|
+
const broken = { getItem: () => { throw new Error('denied') }, setItem: () => { throw new Error('denied') } }
|
|
21
|
+
const state = readPollState(broken, '/api')
|
|
22
|
+
expect(state).toBeNull()
|
|
23
|
+
expect(browserAllows(state, 'r', Date.now())).toBe(false)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('counts days of use, not launches', () => {
|
|
27
|
+
const morning = new Date(2026, 9, 5, 9).getTime()
|
|
28
|
+
let st = recordActiveDay({ activeDays: 0 }, morning)
|
|
29
|
+
st = recordActiveDay(st, morning + 3 * 60 * 60 * 1000)
|
|
30
|
+
expect(st.activeDays).toBe(1)
|
|
31
|
+
st = recordActiveDay(st, morning + DAY)
|
|
32
|
+
expect(st.activeDays).toBe(2)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('never lets a stale tab erase "Don\'t ask again"', () => {
|
|
36
|
+
const s = memoryStorage()
|
|
37
|
+
writePollState(s, '/api', { activeDays: 6, never: true })
|
|
38
|
+
const merged = mergePollState(s, '/api', { submittedRound: 'r', never: false })
|
|
39
|
+
expect(merged?.never).toBe(true)
|
|
40
|
+
expect(readPollState(s, '/api')?.never).toBe(true)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('applies never, submitted, cooldown and the days-of-use minimum', () => {
|
|
44
|
+
const now = 10 * COOLDOWN_MS
|
|
45
|
+
const used = { activeDays: MIN_ACTIVE_DAYS }
|
|
46
|
+
expect(browserAllows(used, 'r', now)).toBe(true)
|
|
47
|
+
expect(browserAllows({ ...used, never: true }, 'r', now)).toBe(false)
|
|
48
|
+
expect(browserAllows({ ...used, submittedRound: 'r' }, 'r', now)).toBe(false)
|
|
49
|
+
expect(browserAllows({ ...used, submittedRound: 'old' }, 'r', now)).toBe(true)
|
|
50
|
+
expect(browserAllows({ ...used, lastShownAt: now - COOLDOWN_MS + 1 }, 'r', now)).toBe(false)
|
|
51
|
+
expect(browserAllows({ activeDays: MIN_ACTIVE_DAYS - 1 }, 'r', now)).toBe(false)
|
|
52
|
+
})
|
|
53
|
+
})
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// What one browser remembers about the poll. A Radar one person uses also
|
|
2
|
+
// keeps state on the server; for a shared Radar this is the only place, so one
|
|
3
|
+
// viewer's answer or dismissal never decides for the others.
|
|
4
|
+
|
|
5
|
+
export const COOLDOWN_MS = 90 * 24 * 60 * 60 * 1000
|
|
6
|
+
// Separate days on which Radar was opened in this browser. Mileage, not a
|
|
7
|
+
// launch count: five launches can happen in one afternoon.
|
|
8
|
+
export const MIN_ACTIVE_DAYS = 5
|
|
9
|
+
|
|
10
|
+
export interface BrowserPollState {
|
|
11
|
+
activeDays: number
|
|
12
|
+
lastActiveDay?: string
|
|
13
|
+
lastShownAt?: number
|
|
14
|
+
never?: boolean
|
|
15
|
+
submittedRound?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type StorageLike = Pick<Storage, 'getItem' | 'setItem'>
|
|
19
|
+
|
|
20
|
+
const KEY_PREFIX = 'radar.poll'
|
|
21
|
+
|
|
22
|
+
function keyFor(apiBase: string) {
|
|
23
|
+
return `${KEY_PREFIX}:${apiBase}`
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function readPollState(storage: StorageLike, apiBase: string): BrowserPollState | null {
|
|
27
|
+
try {
|
|
28
|
+
const raw = storage.getItem(keyFor(apiBase))
|
|
29
|
+
if (!raw) return { activeDays: 0 }
|
|
30
|
+
const parsed = JSON.parse(raw)
|
|
31
|
+
return typeof parsed === 'object' && parsed ? { activeDays: 0, ...parsed } : { activeDays: 0 }
|
|
32
|
+
} catch {
|
|
33
|
+
return null
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function writePollState(storage: StorageLike, apiBase: string, state: BrowserPollState): void {
|
|
38
|
+
try {
|
|
39
|
+
storage.setItem(keyFor(apiBase), JSON.stringify(state))
|
|
40
|
+
} catch {
|
|
41
|
+
// Storage denied: the poll simply never shows here.
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function localDay(now: number): string {
|
|
46
|
+
const d = new Date(now)
|
|
47
|
+
return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Counts today as a day of use, once. */
|
|
51
|
+
export function recordActiveDay(state: BrowserPollState, now: number): BrowserPollState {
|
|
52
|
+
const day = localDay(now)
|
|
53
|
+
if (state.lastActiveDay === day) return state
|
|
54
|
+
return { ...state, activeDays: state.activeDays + 1, lastActiveDay: day }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Applies a change on top of what storage holds now, not on top of what this
|
|
59
|
+
* tab read when it loaded. Another tab may have recorded "Don't ask again" in
|
|
60
|
+
* the meantime, and a stale write must not erase it.
|
|
61
|
+
*/
|
|
62
|
+
export function mergePollState(storage: StorageLike, apiBase: string, patch: Partial<BrowserPollState>): BrowserPollState | null {
|
|
63
|
+
const fresh = readPollState(storage, apiBase)
|
|
64
|
+
if (!fresh) return null
|
|
65
|
+
const next = { ...fresh, ...patch, never: fresh.never || patch.never }
|
|
66
|
+
writePollState(storage, apiBase, next)
|
|
67
|
+
return next
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function browserAllows(state: BrowserPollState | null, roundId: string, now: number): boolean {
|
|
71
|
+
if (!state) return false
|
|
72
|
+
if (state.never) return false
|
|
73
|
+
if (state.submittedRound === roundId) return false
|
|
74
|
+
if (state.lastShownAt && now - state.lastShownAt < COOLDOWN_MS) return false
|
|
75
|
+
if (state.activeDays < MIN_ACTIVE_DAYS) return false
|
|
76
|
+
return true
|
|
77
|
+
}
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "2026-12",
|
|
3
|
+
"endsAt": "2027-03-01T00:00:00Z",
|
|
4
|
+
"questions": [
|
|
5
|
+
{
|
|
6
|
+
"id": "q1",
|
|
7
|
+
"kind": "multi",
|
|
8
|
+
"title": "What do you mostly use Radar for?",
|
|
9
|
+
"hint": "Pick any.",
|
|
10
|
+
"textOption": "other",
|
|
11
|
+
"options": [
|
|
12
|
+
{
|
|
13
|
+
"id": "debug",
|
|
14
|
+
"label": "Debugging incidents and broken workloads"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "browse",
|
|
18
|
+
"label": "Day-to-day browsing and editing resources"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "understand",
|
|
22
|
+
"label": "Understanding a cluster I don't know well"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "helm_gitops",
|
|
26
|
+
"label": "Helm and GitOps operations: upgrades, syncs, rollbacks"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "ai_context",
|
|
30
|
+
"label": "Giving AI agents cluster context (MCP, investigations)"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "security",
|
|
34
|
+
"label": "Security checks and vulnerabilities"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "cost",
|
|
38
|
+
"label": "Cost and rightsizing"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "other",
|
|
42
|
+
"label": "Something else"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "role",
|
|
48
|
+
"kind": "single",
|
|
49
|
+
"screen": "about_you",
|
|
50
|
+
"screenTitle": "A bit about you",
|
|
51
|
+
"title": "Your role",
|
|
52
|
+
"options": [
|
|
53
|
+
{
|
|
54
|
+
"id": "developer",
|
|
55
|
+
"label": "Developer"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"id": "devops_sre",
|
|
59
|
+
"label": "DevOps or SRE"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "platform",
|
|
63
|
+
"label": "Platform engineering"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "manager",
|
|
67
|
+
"label": "Engineering manager or lead"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "student",
|
|
71
|
+
"label": "Student or hobbyist"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "other",
|
|
75
|
+
"label": "Other"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "clusters",
|
|
81
|
+
"kind": "single",
|
|
82
|
+
"screen": "about_you",
|
|
83
|
+
"title": "How many clusters do you work with in a typical week?",
|
|
84
|
+
"options": [
|
|
85
|
+
{
|
|
86
|
+
"id": "one",
|
|
87
|
+
"label": "One"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "two_three",
|
|
91
|
+
"label": "Two or three"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"id": "four_ten",
|
|
95
|
+
"label": "Four to ten"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "more_ten",
|
|
99
|
+
"label": "More than ten"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "company",
|
|
105
|
+
"kind": "single",
|
|
106
|
+
"screen": "work",
|
|
107
|
+
"screenTitle": "About where you work",
|
|
108
|
+
"title": "How many engineers work at your company?",
|
|
109
|
+
"options": [
|
|
110
|
+
{
|
|
111
|
+
"id": "just_me",
|
|
112
|
+
"label": "Just me"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"id": "2_10",
|
|
116
|
+
"label": "2 to 10"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "11_50",
|
|
120
|
+
"label": "11 to 50"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "51_200",
|
|
124
|
+
"label": "51 to 200"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": "201_1000",
|
|
128
|
+
"label": "201 to 1,000"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "1000_plus",
|
|
132
|
+
"label": "More than 1,000"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"id": "others",
|
|
138
|
+
"kind": "single",
|
|
139
|
+
"screen": "work",
|
|
140
|
+
"title": "Who else at work uses Radar?",
|
|
141
|
+
"options": [
|
|
142
|
+
{
|
|
143
|
+
"id": "just_me",
|
|
144
|
+
"label": "Just me"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "few",
|
|
148
|
+
"label": "A few teammates"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"id": "most_team",
|
|
152
|
+
"label": "Most of my team"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"id": "other_teams",
|
|
156
|
+
"label": "Other teams too"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"id": "not_sure",
|
|
160
|
+
"label": "I'm not sure"
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"id": "better",
|
|
166
|
+
"kind": "text",
|
|
167
|
+
"title": "What would make Radar better for you?",
|
|
168
|
+
"textPlaceholder": "A missing integration, a slow screen, something you keep going back to kubectl for…",
|
|
169
|
+
"options": []
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"id": "pains",
|
|
173
|
+
"kind": "multi",
|
|
174
|
+
"title": "Which of these happened to you in the past month?",
|
|
175
|
+
"hint": "Pick any.",
|
|
176
|
+
"exclusive": "none",
|
|
177
|
+
"shuffle": true,
|
|
178
|
+
"options": [
|
|
179
|
+
{
|
|
180
|
+
"id": "dig",
|
|
181
|
+
"label": "I dug through pods, events and logs to find why something failed"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"id": "kubectl",
|
|
185
|
+
"label": "I switched to kubectl for something Radar couldn't do"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"id": "slow",
|
|
189
|
+
"label": "Pages loaded slowly on a large cluster"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"id": "found_late",
|
|
193
|
+
"label": "I found out something broke only because someone looked"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"id": "events_gone",
|
|
197
|
+
"label": "The events I needed were gone by the time I looked"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"id": "screenshots",
|
|
201
|
+
"label": "I sent screenshots to show a teammate what I saw"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"id": "kubeconfig",
|
|
205
|
+
"label": "I shared a kubeconfig so someone could take a look"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"id": "one_by_one",
|
|
209
|
+
"label": "I checked clusters one by one to find where something was running"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"id": "none",
|
|
213
|
+
"label": "None of these"
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"id": "discover",
|
|
219
|
+
"kind": "multi",
|
|
220
|
+
"title": "Anything here you didn't know Radar could do?",
|
|
221
|
+
"hint": "Pick any.",
|
|
222
|
+
"exclusive": "knew_all",
|
|
223
|
+
"shuffle": true,
|
|
224
|
+
"options": [
|
|
225
|
+
{
|
|
226
|
+
"id": "mcp",
|
|
227
|
+
"label": "A built-in MCP server to connect your AI agents"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"id": "investigations",
|
|
231
|
+
"label": "AI investigations that find why something broke, run by your local agent CLI (Claude Code, Codex or OpenCode)"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"id": "reachability",
|
|
235
|
+
"label": "Find where traffic to a service breaks"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"id": "upgrade",
|
|
239
|
+
"label": "See what breaks before a Kubernetes upgrade"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"id": "compare",
|
|
243
|
+
"label": "Compare two resources, like staging and prod"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"id": "image_files",
|
|
247
|
+
"label": "Browse files inside a container image"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"id": "audit",
|
|
251
|
+
"label": "Scan the cluster for security and reliability problems"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"id": "rbac",
|
|
255
|
+
"label": "See what a service account can do"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"id": "drain",
|
|
259
|
+
"label": "Preview what a node drain will evict or block"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"id": "gitops_revert",
|
|
263
|
+
"label": "See whether Argo CD or Flux would revert your edit"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"id": "knew_all",
|
|
267
|
+
"label": "I knew all of these"
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"id": "cloud",
|
|
273
|
+
"kind": "single",
|
|
274
|
+
"screen": "cloud",
|
|
275
|
+
"title": "Last one. Have you heard of Radar Cloud, our hosted service for teams?",
|
|
276
|
+
"options": [
|
|
277
|
+
{
|
|
278
|
+
"id": "first_heard",
|
|
279
|
+
"label": "No, this is the first I've heard of it"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"id": "heard",
|
|
283
|
+
"label": "Heard of it, haven't looked"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"id": "looked",
|
|
287
|
+
"label": "Looked into it, haven't tried it"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"id": "tried",
|
|
291
|
+
"label": "Tried it, don't use it now"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"id": "use",
|
|
295
|
+
"label": "We use it"
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"id": "cloud_blocker",
|
|
301
|
+
"kind": "multi",
|
|
302
|
+
"screen": "cloud",
|
|
303
|
+
"title": "What's held you back?",
|
|
304
|
+
"hint": "Pick any.",
|
|
305
|
+
"textOption": "missing",
|
|
306
|
+
"showIf": {
|
|
307
|
+
"question": "cloud",
|
|
308
|
+
"anyOf": [
|
|
309
|
+
"heard",
|
|
310
|
+
"looked",
|
|
311
|
+
"tried"
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
"options": [
|
|
315
|
+
{
|
|
316
|
+
"id": "oss_enough",
|
|
317
|
+
"label": "Open-source Radar covers what I need"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"id": "not_relevant",
|
|
321
|
+
"label": "Didn't seem relevant to me"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"id": "cant_connect",
|
|
325
|
+
"label": "Our clusters can't connect to a hosted service (policy, security or air-gapped)"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"id": "not_comfortable",
|
|
329
|
+
"label": "I'm not comfortable connecting our clusters to a hosted service"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"id": "price",
|
|
333
|
+
"label": "The price"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"id": "no_time",
|
|
337
|
+
"label": "Haven't had time"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"id": "buy_in",
|
|
341
|
+
"label": "Needs buy-in from my team or manager"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"id": "missing",
|
|
345
|
+
"label": "Something's missing (tell us)"
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
}
|
|
@@ -7,6 +7,7 @@ import type { UsageDataStatus } from '../../api/usage-data'
|
|
|
7
7
|
import { USAGE_PROMPT_VISIBILITY_EVENT, updateNoticeVisible, usagePromptOnScreen } from '../usage-data/UsageDataPrompt'
|
|
8
8
|
import { useAnimatedUnmount } from '../../hooks/useAnimatedUnmount'
|
|
9
9
|
import { TRANSITION_MENU } from '../../utils/animation'
|
|
10
|
+
import { useNudgeVisible } from '../nudges/activeNudges'
|
|
10
11
|
import { LAUNCH_NOTICE_REOPEN_EVENT, LAUNCH_RAIL_ITEM_ID, isPhaseDismissed, launchDayLabel, launchPhase, launchShownIn, markPhaseDismissed, resolveLaunch, type LaunchPhase, type ProductHuntLaunch } from './launchWindow'
|
|
11
12
|
|
|
12
13
|
// The same tag for every install: it says the click came from inside Radar,
|
|
@@ -95,6 +96,7 @@ export function ProductHuntNotice({ usageData, usageDataPending }: { usageData:
|
|
|
95
96
|
updateNoticeVisible(versionInfo?.latestVersion, versionInfo?.updateAvailable) || usageDataPending || !!usageData?.firstRunPrompt
|
|
96
97
|
))),
|
|
97
98
|
})
|
|
99
|
+
useNudgeVisible('product-hunt', show)
|
|
98
100
|
const { shouldRender, isOpen } = useAnimatedUnmount(show, EXIT_MS)
|
|
99
101
|
// Beside the sidebar's Product Hunt item, growing out of it; the bottom-right
|
|
100
102
|
// corner when the sidebar isn't there (narrow windows, embedded).
|
|
@@ -22,7 +22,7 @@ vi.mock('../../api/client', () => ({
|
|
|
22
22
|
useImageMetadata: () => state.showMetadata ? ({
|
|
23
23
|
data: { image: state.metadataImage, digest: 'sha256:abc', platform: 'linux/amd64', totalSize: 1024, layerCount: 1, authMethod: 'google', cached: false },
|
|
24
24
|
refetch: state.refetch,
|
|
25
|
-
}) : ({ error: new ApiError('Authentication required',
|
|
25
|
+
}) : ({ error: new ApiError(typeof state.errorData.error === 'string' ? state.errorData.error : 'Authentication required', state.errorStatus), refetch: state.refetch }),
|
|
26
26
|
}))
|
|
27
27
|
|
|
28
28
|
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
|
|
@@ -107,6 +107,26 @@ it.each(['node_only', 'registry_unreachable'])('explains a %s image instead of a
|
|
|
107
107
|
}
|
|
108
108
|
})
|
|
109
109
|
|
|
110
|
+
it('explains pull Secrets Radar may not read, with the server message and no registry sign-in help', async () => {
|
|
111
|
+
// The body writeAuthError sends with --secret-access=none.
|
|
112
|
+
const message = "Authentication required for this image. Radar couldn't use the Pod's image pull Secrets: a cluster admin turned off its access to Secrets (rbac.secretAccess: none)"
|
|
113
|
+
state.errorData = { error: message, registryType: 'google', reason: 'radar_kind_not_collected' }
|
|
114
|
+
const text = await renderModal({ onSwitchToPodFiles: () => {} })
|
|
115
|
+
expect(text).toContain("Secrets aren't collected on this cluster")
|
|
116
|
+
expect(text).toContain(message)
|
|
117
|
+
expect(text).toContain('Browse live files from running pod below')
|
|
118
|
+
expect(text).not.toContain('Authentication Required')
|
|
119
|
+
expect(text).not.toContain('Failed to inspect image')
|
|
120
|
+
expect(text).not.toContain('gcloud')
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
it('keeps registry sign-in help for a 401 without a reason', async () => {
|
|
124
|
+
state.errorData = { error: 'Authentication required for this image', registryType: 'google' }
|
|
125
|
+
const text = await renderModal()
|
|
126
|
+
expect(text).toContain('Authentication Required')
|
|
127
|
+
expect(text).not.toContain("Secrets aren't collected on this cluster")
|
|
128
|
+
})
|
|
129
|
+
|
|
110
130
|
it('keeps the generic error box for an error without a known reason', async () => {
|
|
111
131
|
state.errorStatus = 500
|
|
112
132
|
state.errorData = { error: 'Failed to inspect image' }
|
|
@@ -13,6 +13,7 @@ import { apiUrl, getAuthHeaders, getCredentialsMode } from '../../api/config'
|
|
|
13
13
|
import { readErrorBody } from '../../api/httpErrors'
|
|
14
14
|
import { Input } from '@skyhook-io/k8s-ui'
|
|
15
15
|
import { useIsAuthEnabled } from '../../contexts/CapabilitiesContext'
|
|
16
|
+
import { SECRETS_NOT_COLLECTED_TITLE } from '@skyhook-io/k8s-ui/utils/secret-collection'
|
|
16
17
|
|
|
17
18
|
const radarLoadingIconUrl = assetUrl(radarLoadingIcon)
|
|
18
19
|
|
|
@@ -75,8 +76,13 @@ export function ImageFilesystemModal({
|
|
|
75
76
|
refetch: refetchMetadata,
|
|
76
77
|
} = useImageMetadata(image, namespace, podName, pullSecrets, open)
|
|
77
78
|
|
|
78
|
-
// Detect auth errors from metadata fetch
|
|
79
|
-
|
|
79
|
+
// Detect auth errors from metadata fetch. A 401 because Radar's Secret
|
|
80
|
+
// access is off isn't fixed by registry auth, so it gets its own notice.
|
|
81
|
+
const isUnauthorized = metadataError instanceof ApiError && metadataError.status === 401
|
|
82
|
+
const pullSecretsNotCollectedMessage = isUnauthorized && metadataError.data?.reason === 'radar_kind_not_collected'
|
|
83
|
+
? metadataError.message
|
|
84
|
+
: undefined
|
|
85
|
+
const isAuthError = isUnauthorized && pullSecretsNotCollectedMessage === undefined
|
|
80
86
|
const registryType = isAuthError ? (metadataError.data?.registryType as string) : undefined
|
|
81
87
|
const unavailable = metadataError instanceof ApiError ? registryUnavailable(metadataError.data) : undefined
|
|
82
88
|
|
|
@@ -222,6 +228,13 @@ export function ImageFilesystemModal({
|
|
|
222
228
|
/>
|
|
223
229
|
)}
|
|
224
230
|
|
|
231
|
+
{pullSecretsNotCollectedMessage !== undefined && (
|
|
232
|
+
<PullSecretsNotCollected
|
|
233
|
+
message={pullSecretsNotCollectedMessage}
|
|
234
|
+
liveFilesLinkShown={Boolean(onSwitchToPodFiles)}
|
|
235
|
+
/>
|
|
236
|
+
)}
|
|
237
|
+
|
|
225
238
|
{unavailable && (
|
|
226
239
|
<RegistryUnavailable
|
|
227
240
|
{...unavailable}
|
|
@@ -231,7 +244,7 @@ export function ImageFilesystemModal({
|
|
|
231
244
|
)}
|
|
232
245
|
|
|
233
246
|
{/* Other errors keep the existing red error box */}
|
|
234
|
-
{error && !isAuthError && !unavailable && (
|
|
247
|
+
{error && !isAuthError && pullSecretsNotCollectedMessage === undefined && !unavailable && (
|
|
235
248
|
<div className="p-4 bg-red-500/10 border border-red-500/30 rounded-lg">
|
|
236
249
|
<div className="flex items-start gap-3">
|
|
237
250
|
<AlertTriangle className="w-5 h-5 text-red-400 shrink-0 mt-0.5" />
|
|
@@ -551,6 +564,32 @@ function registryUnavailable(data: Record<string, unknown> | undefined): Registr
|
|
|
551
564
|
return undefined
|
|
552
565
|
}
|
|
553
566
|
|
|
567
|
+
interface PullSecretsNotCollectedProps {
|
|
568
|
+
message: string
|
|
569
|
+
liveFilesLinkShown: boolean
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// The Pod has pull Secrets, but Radar's access to Secrets is turned off, so
|
|
573
|
+
// they were never tried. The server's message names that cause.
|
|
574
|
+
function PullSecretsNotCollected({ message, liveFilesLinkShown }: PullSecretsNotCollectedProps) {
|
|
575
|
+
return (
|
|
576
|
+
<div className="flex flex-col items-center justify-center py-8">
|
|
577
|
+
<Shield className="w-16 h-16 text-amber-400 mb-4" />
|
|
578
|
+
<h4 className="text-lg font-medium text-theme-text-primary mb-2">
|
|
579
|
+
{SECRETS_NOT_COLLECTED_TITLE}
|
|
580
|
+
</h4>
|
|
581
|
+
<p className="text-sm text-theme-text-secondary text-center max-w-md mb-2">
|
|
582
|
+
{message}
|
|
583
|
+
</p>
|
|
584
|
+
{liveFilesLinkShown && (
|
|
585
|
+
<p className="text-xs text-theme-text-tertiary text-center max-w-md mb-2">
|
|
586
|
+
To see the files now, use Browse live files from running pod below.
|
|
587
|
+
</p>
|
|
588
|
+
)}
|
|
589
|
+
</div>
|
|
590
|
+
)
|
|
591
|
+
}
|
|
592
|
+
|
|
554
593
|
interface RegistryUnavailableProps extends RegistryUnavailableInfo {
|
|
555
594
|
liveFilesLinkShown: boolean
|
|
556
595
|
onRetry: () => void
|
|
@@ -247,6 +247,20 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
247
247
|
: null
|
|
248
248
|
|
|
249
249
|
const loadingInterval = useMemo(() => createListRefetchInterval(120000), [])
|
|
250
|
+
const { support: secretLiveReadSupport } = useRadarFeature('secretLiveRead')
|
|
251
|
+
const secretLiveRead = secretLiveReadSupport === 'supported'
|
|
252
|
+
// Read live as the person on each request, with no watch behind it: the
|
|
253
|
+
// list refreshes when they ask, not on a timer.
|
|
254
|
+
const secretsReadLive = secretLiveRead && capabilities?.secretCollection === 'disabled-by-policy'
|
|
255
|
+
const viewingSecrets = selectedKind?.kind === 'Secret' && !selectedKind.group
|
|
256
|
+
const selectedKindReadLive = secretsReadLive && viewingSecrets
|
|
257
|
+
|
|
258
|
+
// Certificate expiry for the Secrets list. Read live, it is only fetched
|
|
259
|
+
// while that list is open, so elsewhere it waits to learn how it is read.
|
|
260
|
+
const certExpiryQuery = useSecretCertExpiry(namespaces, viewingSecrets || (!capabilitiesPending && !secretsReadLive), secretsReadLive)
|
|
261
|
+
const certExpiry = certExpiryQuery.data
|
|
262
|
+
const certExpiryError = certExpiryQuery.isError
|
|
263
|
+
const refetchCertExpiry = certExpiryQuery.refetch
|
|
250
264
|
|
|
251
265
|
const selectedKindListsAsTable = resourceKindListMode(selectedKind, hostFeatures, capabilitiesPending) === 'table'
|
|
252
266
|
|
|
@@ -269,7 +283,7 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
269
283
|
staleTime: 30000,
|
|
270
284
|
// Safety net — SSE k8s_event drives near-real-time invalidation. A list
|
|
271
285
|
// whose namespaces are still loading is re-read until they finish.
|
|
272
|
-
refetchInterval: loadingInterval,
|
|
286
|
+
refetchInterval: selectedKindReadLive ? false : loadingInterval,
|
|
273
287
|
retry: (failureCount: number, error: Error) => {
|
|
274
288
|
if (isForbiddenError(error) || isKindSyncFailed(error) || isUnretryableReadError(error)) return false
|
|
275
289
|
// Cluster still connecting, or this kind's informer still completing
|
|
@@ -283,6 +297,7 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
283
297
|
})
|
|
284
298
|
|
|
285
299
|
// Map to ResourceQueryResult shape
|
|
300
|
+
const refetchSelectedKind = selectedKindQuery.refetch
|
|
286
301
|
const selectedKindQueryResult: ResourceQueryResult | undefined = useMemo(() => {
|
|
287
302
|
if (!selectedKind) return undefined
|
|
288
303
|
return {
|
|
@@ -292,10 +307,12 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
292
307
|
data: selectedKindQueryBlocked ? [] : selectedKindQuery.data?.items,
|
|
293
308
|
isLoading: waitingForGuardCount || selectedKindQuery.isLoading,
|
|
294
309
|
error: selectedKindQueryBlocked ? undefined : selectedKindQuery.error,
|
|
295
|
-
refetch:
|
|
310
|
+
refetch: selectedKindReadLive
|
|
311
|
+
? () => { void refetchSelectedKind(); void refetchCertExpiry() }
|
|
312
|
+
: refetchSelectedKind,
|
|
296
313
|
dataUpdatedAt: selectedKindQuery.dataUpdatedAt,
|
|
297
314
|
}
|
|
298
|
-
}, [selectedKind, selectedKindQueryBlocked, waitingForGuardCount, selectedKindQuery.data?.items, selectedKindQuery.data?.coverage, selectedKindQuery.isLoading, selectedKindQuery.error,
|
|
315
|
+
}, [selectedKind, selectedKindQueryBlocked, waitingForGuardCount, selectedKindQuery.data?.items, selectedKindQuery.data?.coverage, selectedKindQuery.isLoading, selectedKindQuery.error, refetchSelectedKind, selectedKindQuery.dataUpdatedAt, selectedKindReadLive, refetchCertExpiry])
|
|
299
316
|
|
|
300
317
|
// An empty filtered list reads as "there are none" unless it says what the
|
|
301
318
|
// filter hides. Under --namespace-scope the cache holds no other namespace,
|
|
@@ -316,8 +333,6 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
316
333
|
const { data: topPodMetrics } = useTopPodMetrics({ enabled: topPodMetricsEnabled, namespaces })
|
|
317
334
|
const { data: topNodeMetrics } = useTopNodeMetrics({ enabled: topNodeMetricsEnabled })
|
|
318
335
|
|
|
319
|
-
// Certificate expiry
|
|
320
|
-
const { data: certExpiry, isError: certExpiryError } = useSecretCertExpiry(namespaces)
|
|
321
336
|
|
|
322
337
|
// An ExternalSecret names a store; only the store says which backend it reads
|
|
323
338
|
// from. Two list calls per page beat one lookup per row, and the column shows
|
|
@@ -416,6 +431,8 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
416
431
|
emptyScopeHint={emptyHint && selectedKindCanonical
|
|
417
432
|
? <EmptyNamespaceHint hint={emptyHint} namespaces={namespaces} kind={selectedKindCanonical} onShowAll={namespaceScope?.canClearNamespace ? onClearNamespaces : undefined} />
|
|
418
433
|
: undefined}
|
|
434
|
+
secretCollection={capabilities?.secretCollection}
|
|
435
|
+
secretLiveRead={secretLiveRead}
|
|
419
436
|
// Injected data
|
|
420
437
|
apiResources={apiResources}
|
|
421
438
|
// Lightweight counts for sidebar (replaces 233 parallel queries)
|