CONSOLE-5451: Display projected volume sources with navigable links in Volumes table - #16924
CONSOLE-5451: Display projected volume sources with navigable links in Volumes table#16924swshende-cmd wants to merge 4 commits into
Conversation
…n Volumes table Projected volumes previously showed a blank or plain-text "Projected" label in the Type column, preventing users from clicking through to constituent ConfigMaps and Secrets. This enhances the VolumeType component to iterate projected sources and render ResourceLinks for ConfigMap/Secret entries, while displaying text labels for non-navigable sources (ServiceAccountToken, DownwardAPI, ClusterTrustBundle). Also adds missing volume types (downwardAPI, CSI, ephemeral) to the VolumeSource map so they display proper labels. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@swshende-cmd: This pull request references CONSOLE-5451 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughProjected volumes now render ConfigMap and Secret sources as links. Supported non-resource sources render with labels. Unsupported or absent sources use a translated fallback. Additional volume metadata excludes selected types from generic location formatting. ChangesProjected volume display
Estimated code review effort: 2 (Simple) | ~15 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: swshende-cmd The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @swshende-cmd. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/public/components/utils/volume-type.tsx`:
- Around line 19-63: Update the sources.forEach callback in the projected-volume
rendering logic to include each entry’s index and incorporate it into every
generated React key, including ConfigMap, Secret, ServiceAccountToken,
DownwardAPI, and ClusterTrustBundle entries. Add or update a test covering
repeated projected source entries and asserting they render with unique keys.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9eb65d57-4269-4038-ac8d-1b702b43a046
📒 Files selected for processing (2)
frontend/public/components/utils/volume-type.tsxfrontend/public/module/k8s/pods.ts
|
tested and /verified by @swshende-cmd |
Use a deduplicated key generation approach to guarantee unique keys even when the same ConfigMap or Secret appears multiple times in a projected volume's sources, while satisfying the no-array-index-key ESLint rule. Co-authored-by: Cursor <cursoragent@cursor.com>
|
/ok-to-test |
| const getUniqueKey = (base: string): string => { | ||
| let key = base; | ||
| let counter = 1; | ||
| while (usedKeys.has(key)) { | ||
| key = `${base}-${counter}`; | ||
| counter++; | ||
| } | ||
| usedKeys.add(key); | ||
| return key; | ||
| }; |
| const { t } = useTranslation('public'); | ||
| const sources = volume.projected?.sources; | ||
| if (!Array.isArray(sources) || sources.length === 0) { | ||
| return <>{t('Projected')}</>; |
There was a problem hiding this comment.
You probably don't need the react fragment if you are just returning a string
| downwardAPI: { | ||
| id: 'downwardAPI', | ||
| label: i18next.t('public~DownwardAPI'), | ||
| description: i18next.t( | ||
| 'public~Exposes pod and container fields to a running container as files.', | ||
| ), | ||
| }, | ||
| csi: { | ||
| id: 'csi', | ||
| label: i18next.t('public~CSI'), | ||
| description: i18next.t( | ||
| 'public~Volume provided by an external Container Storage Interface driver.', | ||
| ), | ||
| }, | ||
| ephemeral: { | ||
| id: 'ephemeral', | ||
| label: i18next.t('public~Ephemeral'), | ||
| description: i18next.t( | ||
| 'public~Volume that is handled by a cluster storage driver and follows the lifecycle of the pod.', | ||
| ), | ||
| }, |
There was a problem hiding this comment.
needs yarn i18n to update strings
Run yarn i18n to register translation keys for newly added volume type labels (ServiceAccountToken, DownwardAPI, ClusterTrustBundle) and descriptions (CSI, Ephemeral, DownwardAPI). Co-authored-by: Cursor <cursoragent@cursor.com>
|
/retest |
…ve unnecessary fragments Use lodash uniqueId for React key generation as suggested by reviewer. Remove unnecessary React fragments when returning plain strings from the component. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@swshende-cmd: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |


Analysis / Root cause:
In the OpenShift Console Volumes table (Pod/Deployment/StatefulSet details page), projected volumes displayed a blank or plain-text "Projected" label in the Type column. This prevented users from clicking through to constituent ConfigMaps and Secrets within projected volume mounts. The root cause was that
VolumeTypecomponent only checked top-level volume keys (volume.secret,volume.configMap,volume.persistentVolumeClaim) for ResourceLink rendering, but never inspectedvolume.projected.sourcesfor nested resources. Additionally, several volume types (downwardAPI, CSI, ephemeral) were missing from theVolumeSourcemap, causing a completely empty Type column.Jira: https://redhat.atlassian.net/browse/CONSOLE-5451
Solution description:
frontend/public/components/utils/volume-type.tsx— Added a newProjectedVolumeSourcescomponent that:volume.projected.sourcesarrayResourceLinkhyperlinks for ConfigMap and Secret sources (enabling direct navigation to those resources)if (volume.projected)branch inVolumeTypeto route projected volumes to this componentfrontend/public/module/k8s/pods.ts— Added three missing volume types to theVolumeSourcemap:downwardAPI— renders "DownwardAPI" labelcsi— renders "CSI" labelephemeral— renders "Ephemeral" labelgetVolumeLocationswitch to returnnullfor these new typesScreenshots / screen recording:
Test setup:
kube-api-access-*volumes)Test cases:
yarn test --testPathPatterns='public/components/'andyarn test --testPathPatterns='public/module/k8s/')yarn dev-once)quay.io/rhn-support-swshende/console:projected-volume-fix), verified:kube-api-access-9mncxinopenshift-marketplacenamespace correctly displays ConfigMap links (kube-root-ca.crt,openshift-service-ca.crt), ServiceAccountToken, and DownwardAPI in the Type columnBrowser conformance:
Additional info:
co-resource-itemstylesResourceLinkcomponentprojected.sourcesis missing or empty, falls back to "Projected" labelReviewers and assignees:
/assign @swshende-cmd
Made with Cursor
Summary by CodeRabbit
New Features
Bug Fixes