@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.
Files changed (38) hide show
  1. package/package.json +1 -1
  2. package/src/App.tsx +14 -3
  3. package/src/api/client.ts +29 -3
  4. package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
  5. package/src/api/poll.ts +78 -0
  6. package/src/api/radarFeatures.ts +3 -0
  7. package/src/components/CloudFunnelButton.tsx +1 -0
  8. package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
  9. package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
  10. package/src/components/helm/HelmView.tsx +4 -3
  11. package/src/components/helm/ObservedHelmNotice.tsx +39 -17
  12. package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
  13. package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
  14. package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
  15. package/src/components/issues/uncheckedSources.test.ts +8 -0
  16. package/src/components/issues/uncheckedSources.ts +3 -0
  17. package/src/components/nudges/activeNudges.test.ts +39 -0
  18. package/src/components/nudges/activeNudges.ts +76 -0
  19. package/src/components/poll/OssPoll.tsx +871 -0
  20. package/src/components/poll/mount.test.ts +12 -0
  21. package/src/components/poll/pollCloud.test.ts +23 -0
  22. package/src/components/poll/pollCloud.ts +6 -0
  23. package/src/components/poll/pollDefinition.ts +93 -0
  24. package/src/components/poll/pollFlow.test.ts +140 -0
  25. package/src/components/poll/pollFlow.ts +137 -0
  26. package/src/components/poll/pollSender.test.ts +137 -0
  27. package/src/components/poll/pollSender.ts +76 -0
  28. package/src/components/poll/pollStorage.test.ts +53 -0
  29. package/src/components/poll/pollStorage.ts +77 -0
  30. package/src/components/poll/round.json +350 -0
  31. package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
  32. package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
  33. package/src/components/resources/ImageFilesystemModal.tsx +42 -3
  34. package/src/components/resources/ResourcesView.tsx +22 -5
  35. package/src/components/ui/UpdateNotification.tsx +2 -0
  36. package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
  37. package/src/components/whats-new/WhatsNew.tsx +2 -0
  38. package/src/components/whats-new/releaseNotes.ts +75 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyhook-io/radar-app",
3
- "version": "1.23.0",
3
+ "version": "1.23.1",
4
4
  "description": "Radar's full web UI as a reusable React component. Used by Radar's own binary and by external consumers like Radar Cloud.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/App.tsx CHANGED
@@ -72,6 +72,8 @@ import { useUsageData, useUsageRecording } from './api/usage-data'
72
72
  import { UsageDataPrompt } from './components/usage-data/UsageDataPrompt'
73
73
  import { ProductHuntNotice } from './components/product-hunt/ProductHuntNotice'
74
74
  import { useProductHuntRailEntry } from './components/product-hunt/useProductHuntRailEntry'
75
+ import { OssPoll } from './components/poll/OssPoll'
76
+ import { useNudgeVisible } from './components/nudges/activeNudges'
75
77
  import { ShortcutHelpOverlay } from './components/ui/ShortcutHelpOverlay'
76
78
  import { DiagnosticsOverlay, type DiagnosticsFocus } from './components/ui/DiagnosticsOverlay'
77
79
  import { useEventSource } from './hooks/useEventSource'
@@ -889,7 +891,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
889
891
  navigate({ pathname: `/resources/${pluralKind}`, search: newParams.toString() })
890
892
  }, [searchParams, navigate])
891
893
 
892
- const navigateToHelmRelease = useCallback((namespace: string, name: string, storageNamespace?: string, investigationRunID?: string | null, observed?: boolean) => {
894
+ const navigateToHelmRelease = useCallback((namespace: string, name: string, storageNamespace?: string, investigationRunID?: string | null, observed?: boolean, storageNotCollected?: boolean) => {
893
895
  const newParams = new URLSearchParams()
894
896
  const globalNamespaces = searchParams.get('namespaces')
895
897
  if (globalNamespaces) {
@@ -900,7 +902,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
900
902
  newParams.set('releaseStorage', storageNamespace)
901
903
  }
902
904
  if (investigationRunID) newParams.set('ai-run', investigationRunID)
903
- setSelectedHelmRelease({ namespace, name, storageNamespace, observed })
905
+ setSelectedHelmRelease({ namespace, name, storageNamespace, observed, storageNotCollected })
904
906
  if (mainView === 'helm') {
905
907
  setSearchParams(newParams, { replace: true })
906
908
  return
@@ -2555,7 +2557,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
2555
2557
  <HelmView
2556
2558
  namespaces={namespaces}
2557
2559
  selectedRelease={selectedHelmRelease}
2558
- onReleaseClick={(namespace, name, storageNamespace, observed) => navigateToHelmRelease(namespace, name, storageNamespace, undefined, observed)}
2560
+ onReleaseClick={(namespace, name, storageNamespace, observed, storageNotCollected) => navigateToHelmRelease(namespace, name, storageNamespace, undefined, observed, storageNotCollected)}
2559
2561
  />
2560
2562
  )}
2561
2563
 
@@ -2815,6 +2817,8 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
2815
2817
  {!navCustomization.embedded && <WhatsNew onNavigate={navigateToPath} usageData={usageData.data} />}
2816
2818
  {!navCustomization.embedded && <UsageDataPrompt status={usageData.data} />}
2817
2819
  {!navCustomization.embedded && <ProductHuntNotice usageData={usageData.data} usageDataPending={usageData.isPending} />}
2820
+ {/* The OSS poll is a nudge to standalone users only; never inside a host app. */}
2821
+ {!navCustomization.embedded && <OssPoll />}
2818
2822
 
2819
2823
  {/* Bottom Dock for Terminal/Logs */}
2820
2824
  <BottomDock viewNamespaces={namespaces} />
@@ -2907,6 +2911,13 @@ function GitHubStarButton() {
2907
2911
  const [showCallout, setShowCallout] = useState(false)
2908
2912
  const calloutRef = useRef<HTMLDivElement>(null)
2909
2913
  const buttonRef = useRef<HTMLAnchorElement>(null)
2914
+ // The button is hidden in narrow windows; a callout nobody can see is not a
2915
+ // nudge, and must not hold the others back.
2916
+ const [calloutOnScreen, setCalloutOnScreen] = useState(false)
2917
+ useEffect(() => {
2918
+ setCalloutOnScreen(showCallout && (buttonRef.current?.getClientRects().length ?? 0) > 0)
2919
+ }, [showCallout])
2920
+ useNudgeVisible('github-star', calloutOnScreen)
2910
2921
 
2911
2922
  useEffect(() => {
2912
2923
  // Fetch star count from GitHub public API
package/src/api/client.ts CHANGED
@@ -1317,7 +1317,9 @@ export interface CertExpiry {
1317
1317
  expired?: boolean;
1318
1318
  }
1319
1319
 
1320
- export function useSecretCertExpiry(namespaces: string[] = [], enabled = true) {
1320
+ // With readLive the expiry is read live from the person's Secrets, like the
1321
+ // Secrets list it sits in, so it refreshes with that list rather than on a timer.
1322
+ export function useSecretCertExpiry(namespaces: string[] = [], enabled = true, readLive = false) {
1321
1323
  const params =
1322
1324
  namespaces.length > 0 ? `?namespaces=${namespaces.join(",")}` : "";
1323
1325
  return useQuery<Record<string, CertExpiry>>({
@@ -1325,7 +1327,7 @@ export function useSecretCertExpiry(namespaces: string[] = [], enabled = true) {
1325
1327
  queryFn: () => fetchJSON(`/secrets/certificate-expiry${params}`),
1326
1328
  enabled,
1327
1329
  staleTime: 30000,
1328
- refetchInterval: 60000,
1330
+ refetchInterval: readLive ? false : 60000,
1329
1331
  });
1330
1332
  }
1331
1333
 
@@ -5036,6 +5038,10 @@ export function useAvailablePorts(
5036
5038
  export function useUpdateResource() {
5037
5039
  const queryClient = useQueryClient();
5038
5040
  const { segment: emptyNamespaceSegment } = useEmptyNamespaceSegment();
5041
+ const { data: capabilities } = useCapabilities();
5042
+ const secretsReadLive =
5043
+ radarFeatureSupport("secretLiveRead", capabilities, undefined) === "supported" &&
5044
+ capabilities?.secretCollection === "disabled-by-policy";
5039
5045
 
5040
5046
  return useMutation({
5041
5047
  mutationFn: async ({
@@ -5121,6 +5127,16 @@ export function useUpdateResource() {
5121
5127
  ],
5122
5128
  });
5123
5129
  }
5130
+ if (secretsReadLive && ["secret", "secrets"].includes(variables.kind.toLowerCase())) {
5131
+ // Radar doesn't collect Secrets here, so no watch lags behind the
5132
+ // write: the page reads the API server as this person. Read the
5133
+ // saved Secret back rather than trusting the seed alone, and the
5134
+ // certificate expiry, which no longer polls.
5135
+ queryClient.invalidateQueries({
5136
+ queryKey: ["resource", variables.kind, variables.namespace, variables.name],
5137
+ });
5138
+ queryClient.invalidateQueries({ queryKey: ["secret-cert-expiry"] });
5139
+ }
5124
5140
  queryClient.invalidateQueries({
5125
5141
  queryKey: ["resources", variables.kind],
5126
5142
  });
@@ -6930,6 +6946,13 @@ export function isHelmReleaseReadDenied(error: unknown): boolean {
6930
6946
  return isForbiddenError(error) && (error as ApiError).data?.error_code === "release_read_denied";
6931
6947
  }
6932
6948
 
6949
+ // Radar didn't read Helm's storage because its Secret collection is turned off
6950
+ // (rbac.secretAccess: none). Granting the caller more access won't change this,
6951
+ // and an older Radar never sends it.
6952
+ export function isHelmReleaseNotCollected(error: unknown): boolean {
6953
+ return error instanceof ApiError && error.status === 503 && error.data?.error_code === "radar_kind_not_collected";
6954
+ }
6955
+
6933
6956
  // Each observed read walks every object the caller can see, so an open drawer
6934
6957
  // follows the list's schedule while objects settle and otherwise refreshes
6935
6958
  // once a minute. A retryable error retries sooner.
@@ -6960,9 +6983,12 @@ export function useHelmRelease(
6960
6983
  queryFn: () => fetchJSON(`/helm/releases/${namespace}/${name}`),
6961
6984
  enabled: Boolean(namespace && name) && (options?.enabled ?? true),
6962
6985
  staleTime: 5000,
6986
+ // A release Radar doesn't collect stays uncollected until an admin changes
6987
+ // the chart, so neither a retry nor a poll would change the answer.
6988
+ retry: (failureCount, error) => !isHelmReleaseNotCollected(error) && shouldRetryRadarQuery(failureCount, error),
6963
6989
  // Poll for live resource status updates (post-upgrade/rollback); a refusal
6964
6990
  // would only repeat.
6965
- refetchInterval: (query) => (isForbiddenError(query.state.error) ? false : 10000),
6991
+ refetchInterval: (query) => (isForbiddenError(query.state.error) || isHelmReleaseNotCollected(query.state.error) ? false : 10000),
6966
6992
  });
6967
6993
  }
6968
6994
 
@@ -0,0 +1,47 @@
1
+ // @vitest-environment jsdom
2
+ //
3
+ // With Secrets read live, nothing watches them, so saving a Secret must
4
+ // re-read what was derived from it: the Secrets list's Expires column.
5
+ import { act } from 'react'
6
+ import { createRoot } from 'react-dom/client'
7
+ import { QueryClientProvider } from '@tanstack/react-query'
8
+ import { afterEach, expect, it, vi } from 'vitest'
9
+
10
+ const { makeDefaultQueryClient } = await import('../RadarApp')
11
+ const { useUpdateResource } = await import('./client')
12
+
13
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
14
+ afterEach(() => {
15
+ vi.unstubAllGlobals()
16
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
17
+ })
18
+
19
+ async function saveSecret(secretCollection: 'enabled' | 'disabled-by-policy') {
20
+ const saved = { apiVersion: 'v1', kind: 'Secret', metadata: { name: 'web-tls', namespace: 'shop', resourceVersion: '2' }, type: 'kubernetes.io/tls' }
21
+ vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify(saved), { status: 200, headers: { 'Content-Type': 'application/json' } })))
22
+ const client = makeDefaultQueryClient()
23
+ client.setQueryData(['capabilities'], { features: { secretLiveRead: true }, secretCollection })
24
+ client.setQueryData(['secret-cert-expiry', []], { 'shop/web-tls': { daysLeft: 3 } })
25
+ let mutate: ReturnType<typeof useUpdateResource>['mutateAsync'] | undefined
26
+ function Probe() {
27
+ mutate = useUpdateResource().mutateAsync
28
+ return null
29
+ }
30
+ const root = createRoot(document.createElement('div'))
31
+ await act(async () => {
32
+ root.render(<QueryClientProvider client={client}><Probe /></QueryClientProvider>)
33
+ })
34
+ await act(async () => {
35
+ await mutate!({ kind: 'secrets', namespace: 'shop', name: 'web-tls', yaml: 'kind: Secret' })
36
+ })
37
+ act(() => root.unmount())
38
+ return client.getQueryState(['secret-cert-expiry', []])?.isInvalidated
39
+ }
40
+
41
+ it('re-reads certificate expiry after saving a Secret read live', async () => {
42
+ expect(await saveSecret('disabled-by-policy')).toBe(true)
43
+ })
44
+
45
+ it('leaves certificate expiry to its poll when Radar collects Secrets', async () => {
46
+ expect(await saveSecret('enabled')).toBe(false)
47
+ })
@@ -0,0 +1,78 @@
1
+ import { useQuery } from '@tanstack/react-query'
2
+ import { apiUrl, getAuthHeaders, getCredentialsMode } from './config'
3
+ import { CURRENT_ROUND, type PollAnswers } from '../components/poll/pollDefinition'
4
+
5
+ export interface PollStatus {
6
+ eligible: boolean
7
+ reason?: string
8
+ round: string
9
+ mode: 'local' | 'in-cluster' | 'cloud'
10
+ /** Whether the poll may offer a call. A shared Radar without sign-in never passes on an email. */
11
+ contactAllowed?: boolean
12
+ }
13
+
14
+ export interface PollSubmitResult {
15
+ answers: 'ok' | 'skipped'
16
+ contact: 'ok' | 'failed' | 'none'
17
+ }
18
+
19
+ export class PollSubmitError extends Error {
20
+ constructor(message: string, readonly status: number) {
21
+ super(message)
22
+ }
23
+ }
24
+
25
+ export function usePollStatus(enabled: boolean) {
26
+ return useQuery<PollStatus>({
27
+ queryKey: ['poll-status'],
28
+ queryFn: async () => {
29
+ const res = await fetch(apiUrl('/poll'), { credentials: getCredentialsMode(), headers: getAuthHeaders() })
30
+ if (!res.ok) throw new Error(`HTTP ${res.status}`)
31
+ return res.json()
32
+ },
33
+ enabled,
34
+ staleTime: Infinity,
35
+ retry: false,
36
+ })
37
+ }
38
+
39
+ async function post(path: string, body: unknown): Promise<Response> {
40
+ return fetch(apiUrl(path), {
41
+ method: 'POST',
42
+ credentials: getCredentialsMode(),
43
+ headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' },
44
+ body: JSON.stringify(body),
45
+ })
46
+ }
47
+
48
+ export function recordPollShown(): void {
49
+ void post('/poll/shown', {}).catch(() => {})
50
+ }
51
+
52
+ export function dismissPoll(kind: 'snooze' | 'never'): void {
53
+ void post('/poll/dismiss', { kind }).catch(() => {})
54
+ }
55
+
56
+ export async function submitPoll(body: {
57
+ submissionId: string
58
+ seq?: number
59
+ complete?: boolean
60
+ answers: PollAnswers
61
+ email?: string
62
+ wantsCall?: boolean
63
+ contactOnly?: boolean
64
+ }): Promise<PollSubmitResult> {
65
+ let res: Response
66
+ try {
67
+ // The round this tab is showing, so a tab left open across an upgrade can't
68
+ // file its answers under a different round.
69
+ res = await post('/poll/submit', { round: CURRENT_ROUND.id, ...body })
70
+ } catch {
71
+ throw new PollSubmitError('network', 0)
72
+ }
73
+ if (!res.ok) {
74
+ const data = await res.json().catch(() => ({}))
75
+ throw new PollSubmitError(typeof data.error === 'string' ? data.error : `HTTP ${res.status}`, res.status)
76
+ }
77
+ return res.json()
78
+ }
@@ -108,6 +108,9 @@ export const RADAR_FEATURES = {
108
108
  helmSourceIdentity: { label: 'Helm source selection', flag: 'helmSourceIdentity', flagShippedWithEndpoint: true },
109
109
  // Never blocks a control: on an older Radar the Helm view reads /helm/releases.
110
110
  helmInventory: { label: 'Helm releases without Secret access', flag: 'helmInventory', flagShippedWithEndpoint: true },
111
+ // Never blocks a control: an older Radar answers a Secrets list with Secret
112
+ // collection off by saying it doesn't collect them, and the list keeps that notice.
113
+ secretLiveRead: { label: 'Secrets read as you when Radar does not collect them', flag: 'secretLiveRead', flagShippedWithEndpoint: true },
111
114
  agentSigninCheck: { label: 'Agent sign-in checks', flag: 'agentSigninCheck', flagShippedWithEndpoint: true },
112
115
  podFileUpload: { label: 'Pod file uploads', flag: 'podFileUpload', flagShippedWithEndpoint: true },
113
116
  vulnerabilities: { label: 'Vulnerability views', flag: 'vulnerabilities', flagShippedWithEndpoint: true },
@@ -376,6 +376,7 @@ export function CloudFunnelButton() {
376
376
  onClick={() => openModal()}
377
377
  aria-label="Radar Cloud"
378
378
  aria-haspopup="dialog"
379
+ data-radar-cloud-button
379
380
  className="relative p-1.5 rounded-md bg-theme-elevated hover:bg-theme-hover text-theme-text-secondary hover:text-theme-text-primary transition-colors"
380
381
  >
381
382
  <Cloud className="w-4 h-4" />
@@ -19,7 +19,9 @@ vi.mock('../../api/client', async (importOriginal) => ({
19
19
  useRadarFeature: () => ({ support: state.support }),
20
20
  }))
21
21
  vi.mock('./HelmDrawerFrame', () => ({ HelmDrawerFrame: ({ children }: { children: unknown }) => children }))
22
- vi.mock('./ObservedHelmReleaseDrawer', () => ({ ObservedHelmReleaseDrawer: () => 'observed drawer' }))
22
+ vi.mock('./ObservedHelmReleaseDrawer', () => ({
23
+ ObservedHelmReleaseDrawer: ({ notCollected }: { notCollected?: boolean }) => (notCollected ? 'observed drawer, not collected' : 'observed drawer'),
24
+ }))
23
25
 
24
26
  ;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
25
27
 
@@ -58,6 +60,17 @@ const denied = async () => {
58
60
  return { ApiError, read: new ApiError('no', 403, { error_code: 'release_read_denied' }), other: new ApiError('no', 403) }
59
61
  }
60
62
 
63
+ // The body Radar sends for a release read made as itself with
64
+ // --secret-access=none, as fetchJSON turns it into an error.
65
+ const notCollected = async () => {
66
+ const { ApiError } = await vi.importActual<typeof import('../../api/client')>('../../api/client')
67
+ const body = {
68
+ error: "failed to get release: Radar doesn't collect Secrets on this cluster: a cluster admin turned off its access to Secrets (rbac.secretAccess: none)",
69
+ error_code: 'radar_kind_not_collected',
70
+ }
71
+ return { policy: new ApiError(body.error, 503, body), outage: new ApiError('cluster unreachable', 503, { error: 'cluster unreachable' }) }
72
+ }
73
+
61
74
  describe('HelmReleaseDrawer', () => {
62
75
  it('opens an observed row without asking for the release', () => {
63
76
  expect(render({ namespace: 'apps', name: 'api', observed: true })).toBe('observed drawer')
@@ -80,6 +93,26 @@ describe('HelmReleaseDrawer', () => {
80
93
  expect(render({ namespace: 'apps', name: 'api' })).toBe('full drawer')
81
94
  })
82
95
 
96
+ it('follows a shared link to the observed view, marked not collected, when Radar does not collect Secrets', async () => {
97
+ state.error = (await notCollected()).policy
98
+ expect(render({ namespace: 'apps', name: 'api' })).toBe('observed drawer, not collected')
99
+ })
100
+
101
+ it('opens a row from a list Radar did not collect as not collected, without asking for the release', () => {
102
+ expect(render({ namespace: 'apps', name: 'api', observed: true, storageNotCollected: true })).toBe('observed drawer, not collected')
103
+ expect(state.detailEnabled.every((enabled) => enabled === false)).toBe(true)
104
+ })
105
+
106
+ it('keeps a denied caller on the denied view', async () => {
107
+ state.error = (await denied()).read
108
+ expect(render({ namespace: 'apps', name: 'api' })).not.toContain('not collected')
109
+ })
110
+
111
+ it('leaves any other 503 to the full drawer, which reports it', async () => {
112
+ state.error = (await notCollected()).outage
113
+ expect(render({ namespace: 'apps', name: 'api' })).toBe('full drawer')
114
+ })
115
+
83
116
  it('shows the full drawer to someone who can read the release', () => {
84
117
  expect(render({ namespace: 'apps', name: 'api' })).toBe('full drawer')
85
118
  })
@@ -8,7 +8,7 @@ import { X, Copy, Check, RefreshCw, Package, Code, History, Settings, Link2, Anc
8
8
  import yaml from 'yaml'
9
9
  import { useNavigate } from 'react-router-dom'
10
10
  import { clsx } from 'clsx'
11
- import { useHelmRelease, useHelmManifest, useHelmValues, useHelmUpgradeInfo, useHelmReleaseVersions, useHelmUninstall, upgradeWithProgress, rollbackWithProgress, useHelmPreviewValues, useHelmSourceVersions, useRadarFeature, HelmSourceSelectionError, isHelmReleaseReadDenied } from '../../api/client'
11
+ import { useHelmRelease, useHelmManifest, useHelmValues, useHelmUpgradeInfo, useHelmReleaseVersions, useHelmUninstall, upgradeWithProgress, rollbackWithProgress, useHelmPreviewValues, useHelmSourceVersions, useRadarFeature, HelmSourceSelectionError, isHelmReleaseReadDenied, isHelmReleaseNotCollected } from '../../api/client'
12
12
  import { ValuesDiffPreview } from './ValuesDiffPreview'
13
13
  import { useQueryClient } from '@tanstack/react-query'
14
14
  import { ConfirmDialog } from '../ui/ConfirmDialog'
@@ -149,14 +149,16 @@ export const DEFAULT_SHOW_EFFECTIVE_VALUES = false
149
149
 
150
150
  export function HelmReleaseDrawer({ release, onClose, onNavigateToResource, isOpen = true, rightInset = 0 }: HelmReleaseDrawerProps) {
151
151
  // A row built without Helm's storage says so, which spares a read that would
152
- // only be refused. A shared link doesn't, so it learns from the refusal.
152
+ // only be refused. A shared link doesn't, so it learns from the refusal:
153
+ // the caller's own denial, or Radar not collecting Secrets at all.
153
154
  const { error } = useHelmRelease(effectiveHelmStorageNamespace(release), release.name, { enabled: !release.observed })
154
155
  const { support } = useRadarFeature('helmInventory')
155
- const observed = release.observed || (support === 'supported' && isHelmReleaseReadDenied(error))
156
+ const notCollected = Boolean(release.storageNotCollected) || (support === 'supported' && isHelmReleaseNotCollected(error))
157
+ const observed = release.observed || notCollected || (support === 'supported' && isHelmReleaseReadDenied(error))
156
158
  return (
157
159
  <HelmDrawerFrame onClose={onClose} isOpen={isOpen} rightInset={rightInset}>
158
160
  {observed ? (
159
- <ObservedHelmReleaseDrawer release={release} onClose={onClose} onNavigateToResource={onNavigateToResource} />
161
+ <ObservedHelmReleaseDrawer release={release} notCollected={notCollected} onClose={onClose} onNavigateToResource={onNavigateToResource} />
160
162
  ) : (
161
163
  <FullHelmRelease release={release} onClose={onClose} onNavigateToResource={onNavigateToResource} />
162
164
  )}
@@ -25,7 +25,7 @@ type ViewTab = 'releases' | 'charts'
25
25
  interface HelmViewProps {
26
26
  namespaces: string[]
27
27
  selectedRelease?: SelectedHelmRelease | null
28
- onReleaseClick?: (namespace: string, name: string, storageNamespace?: string, observed?: boolean) => void
28
+ onReleaseClick?: (namespace: string, name: string, storageNamespace?: string, observed?: boolean, storageNotCollected?: boolean) => void
29
29
  }
30
30
 
31
31
  export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmViewProps) {
@@ -37,6 +37,7 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
37
37
  const releases = inventory?.releases
38
38
  const observed = inventory?.observed
39
39
  const degraded = Boolean(inventory?.storageDenied)
40
+ const storageNotCollected = Boolean(inventory?.storageNotCollected)
40
41
  // Revision and update time exist only on rows from Helm's storage.
41
42
  const showHelmColumns = !degraded || Boolean(releases?.length)
42
43
  const rowCount = inventory ? inventory.releases.length + inventory.observed.length : undefined
@@ -173,7 +174,7 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
173
174
  scope: 'helm',
174
175
  handler: () => {
175
176
  const row = getHighlightedRelease()
176
- if (row) onReleaseClick?.(row.release.namespace, row.release.name, row.release.storageNamespace, row.observed)
177
+ if (row) onReleaseClick?.(row.release.namespace, row.release.name, row.release.storageNamespace, row.observed, row.observed && storageNotCollected)
177
178
  },
178
179
  enabled: highlightedIndex >= 0,
179
180
  },
@@ -356,7 +357,7 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
356
357
  selectedRelease?.name === release.name &&
357
358
  (selectedRelease?.storageNamespace || selectedRelease?.namespace) === (release.storageNamespace || release.namespace),
358
359
  isHighlighted: index === highlightedIndex,
359
- onClick: () => onReleaseClick?.(release.namespace, release.name, release.storageNamespace, row.observed),
360
+ onClick: () => onReleaseClick?.(release.namespace, release.name, release.storageNamespace, row.observed, row.observed && storageNotCollected),
360
361
  onMouseEnter: () => setHighlightedIndex(-1),
361
362
  }
362
363
  return row.observed ? (
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react'
2
2
  import { Info } from 'lucide-react'
3
3
  import { Disclosure } from '@skyhook-io/k8s-ui/components/ui/Disclosure'
4
4
  import { gapReasonText } from '@skyhook-io/k8s-ui/utils/read-actions'
5
+ import { SECRETS_NOT_COLLECTED_BODY, SECRETS_NOT_COLLECTED_TITLE } from '@skyhook-io/k8s-ui/utils/secret-collection'
5
6
  import type { HelmInventory, ObservedHelmReleaseDetail } from '../../types'
6
7
 
7
8
  const TITLE = 'Built from labels and annotations, not Helm’s own records'
@@ -82,13 +83,13 @@ function coverageSentence(coverage: HelmInventory['objectCoverage'], subject: st
82
83
  return `Some objects weren’t read (${reasons.join(', ')}), so ${subject} may be missing more than usual.`
83
84
  }
84
85
 
85
- function NoticeCard({ children }: { children: ReactNode }) {
86
+ function NoticeCard({ title = TITLE, children }: { title?: string; children: ReactNode }) {
86
87
  return (
87
- <section aria-label={TITLE} className="mx-4 mt-4 rounded-xl border border-theme-border bg-theme-surface p-4 shadow-theme-sm [contain:inline-size]">
88
+ <section aria-label={title} className="mx-4 mt-4 rounded-xl border border-theme-border bg-theme-surface p-4 shadow-theme-sm [contain:inline-size]">
88
89
  <div className="flex items-start gap-3">
89
90
  <Info className="mt-0.5 h-4 w-4 shrink-0 text-accent" aria-hidden />
90
91
  <div className="min-w-0 flex-1">
91
- <h2 className="text-sm font-semibold text-theme-text-primary">{TITLE}</h2>
92
+ <h2 className="text-sm font-semibold text-theme-text-primary">{title}</h2>
92
93
  <div className="mt-1 text-sm text-theme-text-secondary">{children}</div>
93
94
  </div>
94
95
  </div>
@@ -97,21 +98,33 @@ function NoticeCard({ children }: { children: ReactNode }) {
97
98
  }
98
99
 
99
100
  /** The callout above a Helm list that isn't entirely from Helm's storage. */
101
+ // Radar not collecting Secrets is an admin's chart setting, so more access for
102
+ // the reader wouldn't help: the notice says so instead of how to get access.
100
103
  export function ObservedHelmNotice({ inventory }: { inventory: HelmInventory }) {
101
104
  const coverage = coverageSentence(inventory.objectCoverage, 'this list')
102
105
  const mixed = inventory.releases.length > 0
106
+ const notCollected = Boolean(inventory.storageNotCollected)
103
107
  return (
104
- <NoticeCard>
105
- <p>
106
- {deniedScope(inventory)}, so {mixed ? 'releases there come' : 'this list comes'} from labels and annotations on deployed
107
- objects. Those Secrets are the source of truth Helm itself uses, so this view can miss things, and a failed release can look fine.
108
- </p>
108
+ <NoticeCard title={notCollected ? SECRETS_NOT_COLLECTED_TITLE : TITLE}>
109
+ {notCollected ? (
110
+ <p>
111
+ {SECRETS_NOT_COLLECTED_BODY} Helm keeps its releases in Secrets, so this list comes from labels and annotations on deployed
112
+ objects. It can miss releases, and a failed release can look fine.
113
+ </p>
114
+ ) : (
115
+ <p>
116
+ {deniedScope(inventory)}, so {mixed ? 'releases there come' : 'this list comes'} from labels and annotations on deployed
117
+ objects. Those Secrets are the source of truth Helm itself uses, so this view can miss things, and a failed release can look fine.
118
+ </p>
119
+ )}
109
120
  {coverage && <p className="mt-1">{coverage}</p>}
110
- <p className="mt-2">
111
- <span className="font-medium text-theme-text-primary">How to get the full view:</span> get and list access to Secrets in the
112
- namespace where Helm stores a release, usually the release’s namespace. That opens every Secret there to whoever holds it. Without
113
- sign-in, Radar’s own identity holds it, so it reaches everyone who can open Radar.
114
- </p>
121
+ {!notCollected && (
122
+ <p className="mt-2">
123
+ <span className="font-medium text-theme-text-primary">How to get the full view:</span> get and list access to Secrets in the
124
+ namespace where Helm stores a release, usually the release’s namespace. That opens every Secret there to whoever holds it. Without
125
+ sign-in, Radar’s own identity holds it, so it reaches everyone who can open Radar.
126
+ </p>
127
+ )}
115
128
  <Disclosure summary="What’s affected" className="mt-3" summaryClassName="font-medium text-accent-text">
116
129
  <div className="mt-3 grid grid-cols-[repeat(auto-fit,minmax(15rem,1fr))] gap-x-8 gap-y-5 border-t border-theme-border pt-3">
117
130
  {AFFECTED.map(({ heading, items }) => (
@@ -133,12 +146,21 @@ export function ObservedHelmNotice({ inventory }: { inventory: HelmInventory })
133
146
  }
134
147
 
135
148
  /** The drawer's short form: the list carries the detail. */
136
- export function ObservedHelmDrawerNote({ coverage, refreshFailed }: { coverage?: ObservedHelmReleaseDetail['objectCoverage']; refreshFailed?: boolean }) {
149
+ export function ObservedHelmDrawerNote({ coverage, notCollected, refreshFailed }: { coverage?: ObservedHelmReleaseDetail['objectCoverage']; notCollected?: boolean; refreshFailed?: boolean }) {
137
150
  const gaps = coverageSentence(coverage, 'this release')
138
151
  return (
139
- <NoticeCard>
140
- Radar can’t read Helm’s release Secrets here, Helm’s source of truth, so this view can miss things, and a failed release can look
141
- fine. Helm’s history, manifest, values and hooks aren’t available.
152
+ <NoticeCard title={notCollected ? SECRETS_NOT_COLLECTED_TITLE : TITLE}>
153
+ {notCollected ? (
154
+ <>
155
+ {SECRETS_NOT_COLLECTED_BODY} Helm keeps this release in a Secret, so it comes from labels and annotations on its objects, and a
156
+ failed release can look fine. Helm’s history, manifest, values and hooks aren’t available.
157
+ </>
158
+ ) : (
159
+ <>
160
+ Radar can’t read Helm’s release Secrets here, Helm’s source of truth, so this view can miss things, and a failed release can look
161
+ fine. Helm’s history, manifest, values and hooks aren’t available.
162
+ </>
163
+ )}
142
164
  {gaps && <p className="mt-1">{gaps}</p>}
143
165
  {refreshFailed && <p className="mt-1">Radar couldn’t refresh this, so it shows the last read.</p>}
144
166
  </NoticeCard>
@@ -5,7 +5,8 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
5
5
  import { MemoryRouter } from 'react-router-dom'
6
6
  import { afterEach, describe, expect, it, vi } from 'vitest'
7
7
  import type { HelmInventory, ObservedHelmRelease } from '../../types'
8
- import { ApiError, isHelmReleaseReadDenied } from '../../api/client'
8
+ import { ApiError, fetchJSON, isHelmReleaseNotCollected, isHelmReleaseReadDenied } from '../../api/client'
9
+ import { SECRETS_NOT_COLLECTED_BODY, SECRETS_NOT_COLLECTED_TITLE } from '@skyhook-io/k8s-ui/utils/secret-collection'
9
10
  import { compareRows, HelmView } from './HelmView'
10
11
  import { ObservedHelmNotice } from './ObservedHelmNotice'
11
12
 
@@ -52,12 +53,18 @@ function denied(rows: ObservedHelmRelease[]): HelmInventory {
52
53
  return { releases: [], observed: rows, storageDenied: { count: 2, names: ['team-a', 'team-b'] }, objectCoverage: { status: 'complete', gaps: [] } }
53
54
  }
54
55
 
55
- function renderView(state: Partial<typeof inventoryState.current>) {
56
+ // /api/helm/inventory when Radar runs with --secret-access=none and reads as
57
+ // itself: no rows from Helm, every namespace unread, and the reason.
58
+ function notCollected(rows: ObservedHelmRelease[]): HelmInventory {
59
+ return { releases: [], observed: rows, storageDenied: { extent: 'all' }, storageNotCollected: true, objectCoverage: { status: 'complete', gaps: [] } }
60
+ }
61
+
62
+ function renderView(state: Partial<typeof inventoryState.current>, onReleaseClick?: Parameters<typeof HelmView>[0]['onReleaseClick']) {
56
63
  inventoryState.current = { data: undefined, isPending: false, error: null, ...state }
57
64
  return mount(
58
65
  <QueryClientProvider client={new QueryClient()}>
59
66
  <MemoryRouter>
60
- <HelmView namespaces={[]} />
67
+ <HelmView namespaces={[]} onReleaseClick={onReleaseClick} />
61
68
  </MemoryRouter>
62
69
  </QueryClientProvider>,
63
70
  )
@@ -229,6 +236,58 @@ describe('ObservedHelmNotice', () => {
229
236
  })
230
237
  })
231
238
 
239
+ describe('Helm list when Radar does not collect Secrets', () => {
240
+ it('says Secrets are not collected instead of how to get access', () => {
241
+ const container = renderView({ data: notCollected([observed]) })
242
+ const callout = container.querySelector(`section[aria-label="${SECRETS_NOT_COLLECTED_TITLE}"]`)
243
+ expect(callout).not.toBeNull()
244
+ expect(callout!.textContent).toContain(SECRETS_NOT_COLLECTED_BODY)
245
+ expect(callout!.textContent).toContain('this list comes from labels and annotations on deployed objects')
246
+ expect(callout!.textContent).not.toContain('How to get the full view')
247
+ expect(callout!.textContent).not.toContain('Radar can’t read Helm’s release Secrets')
248
+ expect(row(container, 'api')).toContain('api-1.2.3')
249
+ })
250
+
251
+ it('opens a row as not collected', () => {
252
+ const onReleaseClick = vi.fn()
253
+ const container = renderView({ data: notCollected([observed]) }, onReleaseClick)
254
+ act(() => (container.querySelector('tbody tr') as HTMLElement).click())
255
+ expect(onReleaseClick).toHaveBeenCalledWith('team-b', 'api', undefined, true, true)
256
+ })
257
+
258
+ it('keeps the access wording for a denied caller', () => {
259
+ const onReleaseClick = vi.fn()
260
+ const container = renderView({ data: denied([observed]) }, onReleaseClick)
261
+ expect(container.textContent).toContain('How to get the full view')
262
+ expect(container.textContent).not.toContain(SECRETS_NOT_COLLECTED_TITLE)
263
+ act(() => (container.querySelector('tbody tr') as HTMLElement).click())
264
+ expect(onReleaseClick).toHaveBeenCalledWith('team-b', 'api', undefined, true, false)
265
+ })
266
+ })
267
+
268
+ describe('isHelmReleaseNotCollected', () => {
269
+ afterEach(() => vi.unstubAllGlobals())
270
+
271
+ const respond = (status: number, body: unknown) =>
272
+ vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json' } })))
273
+ const readError = () => fetchJSON('/helm/releases/apps/api').then(() => undefined, (error: unknown) => error)
274
+
275
+ it('matches the answer Radar sends when it does not collect Secrets', async () => {
276
+ respond(503, {
277
+ error: "failed to get release: Radar doesn't collect Secrets on this cluster: a cluster admin turned off its access to Secrets (rbac.secretAccess: none)",
278
+ error_code: 'radar_kind_not_collected',
279
+ })
280
+ expect(isHelmReleaseNotCollected(await readError())).toBe(true)
281
+ })
282
+
283
+ it('leaves other failures alone', async () => {
284
+ respond(503, { error: 'cluster unreachable' })
285
+ expect(isHelmReleaseNotCollected(await readError())).toBe(false)
286
+ respond(403, { error: 'no', error_code: 'release_read_denied' })
287
+ expect(isHelmReleaseNotCollected(await readError())).toBe(false)
288
+ })
289
+ })
290
+
232
291
  describe('compareRows', () => {
233
292
  const full = (name: string, status: string, revision: number) => ({
234
293
  observed: false as const,
@@ -6,6 +6,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
6
6
  import { ApiError } from '../../api/client'
7
7
  import type { ObservedHelmReleaseDetail, SelectedHelmRelease } from '../../types'
8
8
  import { ObservedHelmReleaseDrawer } from './ObservedHelmReleaseDrawer'
9
+ import { SECRETS_NOT_COLLECTED_BODY, SECRETS_NOT_COLLECTED_TITLE } from '@skyhook-io/k8s-ui/utils/secret-collection'
9
10
 
10
11
  const detail = vi.hoisted(() => ({ current: {} as { data?: unknown; error?: unknown } }))
11
12
 
@@ -33,6 +34,23 @@ afterEach(() => {
33
34
  document.body.innerHTML = ''
34
35
  })
35
36
 
37
+ describe('the note above an observed release', () => {
38
+ it('says Secrets are not collected when Radar does not collect them, without blaming access', () => {
39
+ detail.current = { data: seen }
40
+ const text = mount(<ObservedHelmReleaseDrawer release={release} notCollected onClose={vi.fn()} />).textContent
41
+ expect(text).toContain(SECRETS_NOT_COLLECTED_TITLE)
42
+ expect(text).toContain(SECRETS_NOT_COLLECTED_BODY)
43
+ expect(text).not.toContain('Radar can’t read Helm’s release Secrets here')
44
+ })
45
+
46
+ it('keeps the denied wording otherwise', () => {
47
+ detail.current = { data: seen }
48
+ const text = mount(<ObservedHelmReleaseDrawer release={release} onClose={vi.fn()} />).textContent
49
+ expect(text).toContain('Radar can’t read Helm’s release Secrets here')
50
+ expect(text).not.toContain(SECRETS_NOT_COLLECTED_TITLE)
51
+ })
52
+ })
53
+
36
54
  describe('a refresh that fails while the drawer shows a release', () => {
37
55
  it('stops showing a release that is gone', () => {
38
56
  detail.current = { data: seen, error: new ApiError('not found', 404) }