Skip to content

Conversation

@cajieh
Copy link
Contributor

@cajieh cajieh commented Dec 15, 2025

No VAC

Screenshot 2025-12-17 at 11 40 56 AM

VAC modification pending

Screenshot 2025-12-17 at 11 41 15 AM

VAC modification error

1.

Screenshot 2025-12-17 at 11 43 03 AM Screenshot 2025-12-17 at 11 43 14 AM

2.

Screenshot 2025-12-17 at 11 46 22 AM Screenshot 2025-12-17 at 11 46 37 AM Screenshot 2025-12-17 at 11 46 46 AM Screenshot 2025-12-17 at 11 46 59 AM Screenshot 2025-12-17 at 11 47 06 AM

VAC modification succeed

Screenshot 2025-12-18 at 5 42 02 PM

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 15, 2025
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 15, 2025
@openshift-ci-robot
Copy link
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-68332, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

VAC not applied

Screenshot 2025-12-15 at 2 05 58 PM

VAC modification pending

Screenshot 2025-12-15 at 2 06 26 PM

VAC modification error

Screenshot 2025-12-15 at 2 06 57 PM

VAC modification succeed

Screenshot 2025-12-15 at 2 04 08 PM Screenshot 2025-12-15 at 2 05 00 PM Screenshot 2025-12-15 at 2 05 19 PM Screenshot 2025-12-15 at 2 05 42 PM

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.

@coderabbitai
Copy link

coderabbitai bot commented Dec 15, 2025

Walkthrough

Adds VolumeAttributesClass (VAC) handling to PVC details: derives VAC error/pending state, shows dismissible danger/info alerts, resets dismissals when the PVC changes, and renders separate "Requested VolumeAttributesClass" and "VolumeAttributesClass" fields. Also adds English localization keys for VAC messages.

Changes

Cohort / File(s) Summary
VAC alert state and UI logic
frontend/public/components/persistent-volume-claim.tsx
Added getVACAlertState() to derive vacErrorCondition and isVacPending from PVC spec/status; injected dismissible danger and info Alerts into PVC details with truncated messages and close buttons; added local dismissal state (isErrorAlertDismissed, isInfoAlertDismissed) and a useEffect to reset them on PVC change; rendered "Requested VolumeAttributesClass" and "VolumeAttributesClass" rows (conditional ResourceLink); updated imports to include Alert, AlertActionCloseButton, and truncateMiddle.
VAC localization strings
frontend/public/locales/en/public.json
Added translation keys for VAC lifecycle and UI: modification failed title and detail, modification pending title and in-progress message, pending application and modifying-from-to templates, and the "Requested VolumeAttributesClass" label.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review getVACAlertState() for correct condition detection and attribute-name comparison.
  • Verify alert content, truncation behavior, and dismissal persistence/reset on PVC change.
  • Confirm conditional rendering and correct ResourceLink targets for requested vs current VAC.
  • Validate new i18n keys and interpolation placeholders ({{target}}, {{current}}).
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 922d71e and eacb9a5.

📒 Files selected for processing (2)
  • frontend/public/components/persistent-volume-claim.tsx (6 hunks)
  • frontend/public/locales/en/public.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/public/locales/en/public.json
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/public/components/persistent-volume-claim.tsx
🧬 Code graph analysis (1)
frontend/public/components/persistent-volume-claim.tsx (3)
frontend/public/module/k8s/types.ts (1)
  • PersistentVolumeClaimKind (1131-1159)
frontend/public/module/k8s/k8s.ts (1)
  • referenceFor (50-65)
frontend/public/models/index.ts (1)
  • VolumeAttributesClassModel (810-824)
🔇 Additional comments (3)
frontend/public/components/persistent-volume-claim.tsx (3)

82-104: LGTM! VAC state detection logic is correct.

The helper function correctly identifies VAC modification errors and pending states. The logic properly checks for the ModifyVolumeError condition and determines pending state when the requested VAC differs from the current VAC.

Minor question: Should the pending detection (line 100) also handle the removal case where volumeAttributesClassName is undefined but currentVolumeAttributesClassName exists? If VAC removal is supported, consider adjusting the logic to:

const isVacPending =
  !vacErrorCondition &&
  (volumeAttributesClassName || currentVolumeAttributesClassName) &&
  volumeAttributesClassName !== currentVolumeAttributesClassName;

This would detect pending state for both modification and removal operations.


279-287: LGTM! Alert dismissal state management is correct.

The implementation properly tracks dismissed alerts using local state and resets dismissals when the PVC changes (detected via UID). This ensures alerts reappear when navigating to a different PVC, which is the expected behavior.


328-374: LGTM! VAC alert implementation is well-structured.

The alert rendering logic appropriately handles both error and pending states:

  • Error alert displays the condition message (truncated to 200 chars) with fallback text
  • Info alert shows context-appropriate messages for initial application vs. modification
  • Both alerts are dismissible and properly scoped to VAC-supported environments

The truncation strategy prevents overly long error messages from disrupting the UI layout.


Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot requested review from jhadvig and sg00dwin December 15, 2025 19:10
@openshift-ci openshift-ci bot added component/core Related to console core functionality approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 15, 2025
@cajieh cajieh force-pushed the improve-vac-field-pvc-details-page branch 5 times, most recently from e2c8423 to 6e1d9bd Compare December 17, 2025 13:22
@openshift-ci openshift-ci bot added the kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated label Dec 17, 2025
@cajieh cajieh force-pushed the improve-vac-field-pvc-details-page branch 4 times, most recently from 30f2e99 to 634117b Compare December 17, 2025 21:28
@cajieh cajieh changed the title [WIP] OCPBUGS-68332: Improve VAC field on PVC details page OCPBUGS-68332: Improve VAC field on PVC details page Dec 18, 2025
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 18, 2025
@cajieh cajieh force-pushed the improve-vac-field-pvc-details-page branch from 634117b to 34a8cdd Compare December 18, 2025 12:26
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/public/components/persistent-volume-claim.tsx (1)

345-349: Minor: Confusing function naming.

Using truncateMiddle with truncateEnd: true is functionally correct but semantically confusing—the name implies middle truncation while the parameter specifies end truncation.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9ac9e36 and 34a8cdd.

📒 Files selected for processing (2)
  • frontend/public/components/persistent-volume-claim.tsx (6 hunks)
  • frontend/public/locales/en/public.json (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/public/locales/en/public.json
  • frontend/public/components/persistent-volume-claim.tsx
🧬 Code graph analysis (1)
frontend/public/components/persistent-volume-claim.tsx (3)
frontend/public/module/k8s/types.ts (1)
  • PersistentVolumeClaimKind (1131-1159)
frontend/public/module/k8s/k8s.ts (1)
  • referenceFor (50-65)
frontend/public/models/index.ts (1)
  • VolumeAttributesClassModel (810-824)
🔇 Additional comments (4)
frontend/public/components/persistent-volume-claim.tsx (3)

82-105: LGTM! VAC state logic is correct.

The helper function correctly identifies VAC modification states by checking for ModifyVolumeError conditions and determining pending status based on attribute name mismatches. The logic appropriately handles all scenarios: initial application, modification, and removal.


280-289: LGTM! Alert dismissal state management is well-implemented.

The useEffect dependency on pvcUid correctly resets dismissed alerts when the PVC resource changes, while maintaining the dismissed state across status-only updates to the same PVC object.


337-380: Alert rendering logic is well-structured.

The VAC alerts correctly handle error and pending states with appropriate titles and messages. The conditional rendering ensures alerts are only shown when VAC is supported and the conditions are met.

frontend/public/locales/en/public.json (1)

1131-1137: LGTM! Translation keys are well-defined.

The new VAC-related translation keys comprehensively cover all lifecycle states with clear, user-friendly messages. The i18next interpolation syntax ({{target}}, {{current}}) is correctly used for dynamic values.

Also applies to: 1146-1146

Comment on lines 472 to 493
{isVACSupported && (
<DescriptionListGroup>
<DescriptionListTerm>
{t('public~Requested VolumeAttributesClass')}
</DescriptionListTerm>
<DescriptionListDescription data-test-id="pvc-requested-vac">
{volumeAttributesClassName ? (
<ResourceLink
kind={referenceFor(VolumeAttributesClassModel)}
name={volumeAttributesClassName}
/>
</DescriptionListDescription>
</DescriptionListGroup>
)}
) : (
DASH
)}
</DescriptionListDescription>
</DescriptionListGroup>
)}
{isVACSupported && !!currentVolumeAttributesClassName && (
<DescriptionListGroup>
<DescriptionListTerm>{t('public~VolumeAttributesClass')}</DescriptionListTerm>
<DescriptionListDescription data-test-id="pvc-current-vac">
<ResourceLink
kind={referenceFor(VolumeAttributesClassModel)}
name={currentVolumeAttributesClassName}
/>
</DescriptionListDescription>
</DescriptionListGroup>
)}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Incorrect API reference construction for VolumeAttributesClass.

The usage of referenceFor(VolumeAttributesClassModel) on lines 480 and 494 is problematic:

  • VolumeAttributesClassModel is a K8sKind with apiVersion: 'v1' and apiGroup: 'storage.k8s.io' as separate fields
  • referenceFor expects a K8sResourceCommon and uses only the apiVersion field
  • This will construct an incorrect reference pointing to core/v1 instead of storage.k8s.io/v1
  • The ResourceLink will fail to resolve the correct API endpoint
🔎 Verify and fix the API reference construction:
#!/bin/bash
# Verify if referenceForModel exists and check for correct usage patterns

echo "=== Searching for referenceForModel usage ==="
rg -n 'referenceForModel' --type ts --type tsx

echo "=== Searching for similar ResourceLink patterns with models ==="
rg -n 'ResourceLink.*kind=\{referenceFor' --type ts --type tsx -A2 -B2

echo "=== Checking VolumeAttributesClassModel definition ==="
rg -n 'VolumeAttributesClassModel.*K8sKind' --type ts --type tsx -A15

Consider one of these fixes:

Option 1: Use referenceForModel if available

import { referenceForModel } from '@console/internal/module/k8s';
// Then use:
kind={referenceForModel(VolumeAttributesClassModel)}

Option 2: Construct the reference manually

kind="storage.k8s.io~v1~VolumeAttributesClass"

Option 3: Check if the model has a reference property

kind={VolumeAttributesClassModel.reference}
🤖 Prompt for AI Agents
In frontend/public/components/persistent-volume-claim.tsx around lines 472 to
499, the code uses referenceFor(VolumeAttributesClassModel) which builds an
incorrect core/v1 reference; replace it with
referenceForModel(VolumeAttributesClassModel) (or alternatively use
VolumeAttributesClassModel.reference) and add the corresponding import from
'@console/internal/module/k8s' so the ResourceLink resolves to
storage.k8s.io/v1/VolumeAttributesClass.

@cajieh cajieh force-pushed the improve-vac-field-pvc-details-page branch 2 times, most recently from 203343e to 922d71e Compare December 18, 2025 18:01
@cajieh cajieh force-pushed the improve-vac-field-pvc-details-page branch from 922d71e to eacb9a5 Compare December 18, 2025 22:47
@gnufied
Copy link
Member

gnufied commented Dec 18, 2025

lgtm flow wise.

Copy link
Member

@jhadvig jhadvig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 19, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 19, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cajieh, jhadvig

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cajieh
Copy link
Contributor Author

cajieh commented Dec 19, 2025

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 19, 2025
@openshift-ci-robot
Copy link
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-68332, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @yapei

Details

In response to this:

/jira refresh

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.

@openshift-ci openshift-ci bot requested a review from yapei December 19, 2025 15:26
@cajieh
Copy link
Contributor Author

cajieh commented Dec 19, 2025

/test images

@cajieh
Copy link
Contributor Author

cajieh commented Dec 19, 2025

/verified later @yapei

@cajieh
Copy link
Contributor Author

cajieh commented Dec 19, 2025

/retest

@openshift-ci-robot openshift-ci-robot added verified-later verified Signifies that the PR passed pre-merge verification criteria labels Dec 19, 2025
@openshift-ci-robot
Copy link
Contributor

@cajieh: This PR has been marked to be verified later by @yapei.

Details

In response to this:

/verified later @yapei

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.

"StorageClass": "StorageClass",
"Total": "Total",
"VolumeAttributesClass modification failed": "VolumeAttributesClass modification failed",
"Failed to modify VolumeAttributesClass for this PersistentVolumeClaim.": "Failed to modify VolumeAttributesClass for this PersistentVolumeClaim.",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the failed alert:
"VolumeAttributesClass modification failed
Your volume settings could not be updated. Check for typos, ensure the parameters are supported by your StorageClass, and try again."

What do you think of this? Wanted to give the user a next step and make it a little more user-friendly @kevinhatchoua @cajieh

Copy link
Member

@logonoff logonoff Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holding due to review comments

/hold

"Failed to modify VolumeAttributesClass for this PersistentVolumeClaim.": "Failed to modify VolumeAttributesClass for this PersistentVolumeClaim.",
"VolumeAttributesClass application pending": "VolumeAttributesClass application pending",
"VolumeAttributesClass modification in progress": "VolumeAttributesClass modification in progress",
"VolumeAttributesClass \"{{target}}\" is pending application.": "VolumeAttributesClass \"{{target}}\" is pending application.",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the application pending alert:
"VolumeAttributesClass application in progress
{{target}} is being applied to replace {{current}}. Your volume remains available during this update." WYDT @kevinhatchoua @cajieh ?

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD df5acf5 and 2 for PR HEAD eacb9a5 in total

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 20, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 20, 2025

@cajieh: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-scos-images eacb9a5 link true /test okd-scos-images

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria verified-later

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants