Skip to content

OCPBUGS-57309: '0 B' is shown on details page when create pvc with 'EiB' unit#16800

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
cajieh:invalid-eib-unit-create-pvc
Jul 23, 2026
Merged

OCPBUGS-57309: '0 B' is shown on details page when create pvc with 'EiB' unit#16800
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
cajieh:invalid-eib-unit-create-pvc

Conversation

@cajieh

@cajieh cajieh commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Analysis / Root cause:
Creating a PVC with size unit EiB stores spec.resources.requests.storage as 1Ei (same as oc get pvc -ojson). On the details page, Requested capacity uses convertToBaseValuehumanizeBinaryBytes.
convertToBaseValue dehumanizes via a reversed unit list where Ei is index 0. The parser treated startingUnitIndex <= 0 as failure, so "1Ei" never converted to bytes and humanizeBinaryBytes fell back to 0 B. Separately, binaryBytes had no EiB unit, so even a correct byte value could not humanize to exbibytes.
Solution description:
In frontend/public/components/utils/units.js:

  1. Treat only startingUnitIndex < 0 as unparseable so the largest unit (Ei, and similarly other type maxima) can be dehumanized.
  2. Add EiB to binaryBytes so values ≥ 1 Ei humanize as N EiB.
  3. Add Ei to validMemUnits so memory validation accepts 1Ei.
    Unit tests in units.spec.js cover humanize/dehumanize/convertToBaseValue/validate.memory for 1Ei.
    Ei remains available in the PVC create dropdown; API/oc quantity stays 1Ei. UI displays the equivalent humanized value 1 EiB (console binary label convention), not the raw k8s string.
    Screenshots / screen recording:

Before:
Screenshot 2026-07-22 at 11 34 40 AM

After
Screenshot 2026-07-22 at 11 34 50 AM

Test setup:
OpenShift cluster with console built from this branch. Ability to create a PVC (any StorageClass that accepts the request, or create via YAML if provisioner rejects Ei).
Test cases:

  1. Create PVC from console with size 1 and unit EiB; confirm YAML/oc shows storage: 1Ei.
  2. Open PVC details → Requested capacity shows 1 EiB (not 0 B).
  3. Create or apply a PVC via YAML with requests.storage: 1Ei; details page still shows 1 EiB.
  4. Regression: PVC with 1Gi / 1Pi still shows 1 GiB / 1 PiB.
  5. yarn test public/components/__tests__/units.spec.js
    Browser conformance:
  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)
    Additional info:
  • Jira: https://redhat.atlassian.net/browse/OCPBUGS-57309
  • Admission webhook warnings such as fractional byte value "1Ei" is invalid are API/cluster policy behavior and are out of scope for this UI fix.
  • Display uses humanized 1 EiB; it is intentionally not a raw mirror of the oc string 1Ei.
  • Note: The apiserver may incorrectly warn on 1Ei (fractional byte value "1Ei" is invalid) and the console may show that as an Admission Webhook toast. This is a known Kubernetes Quantity/MilliValue overflow quirk (kubernetes#128684); the same warning appears with oc.

Summary by CodeRabbit

  • New Features
    • Added support for exbibytes in binary-byte and memory value handling, including correct formatting for the largest binary units (EiB and Ei).
    • Improved unit parsing and validation so these units are accepted and converted reliably.
  • Tests
    • Expanded coverage for humanizing/dehumanizing and base conversion, including 1 EiB / 1 Ei.
    • Extended memory validation “valid values” and conversion test matrices to include 1 Ei.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@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 Jul 22, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

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

  • expected the bug to target the "5.0.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:

Analysis / Root cause:
Creating a PVC with size unit EiB stores spec.resources.requests.storage as 1Ei (same as oc get pvc -ojson). On the details page, Requested capacity uses convertToBaseValuehumanizeBinaryBytes.
convertToBaseValue dehumanizes via a reversed unit list where Ei is index 0. The parser treated startingUnitIndex <= 0 as failure, so "1Ei" never converted to bytes and humanizeBinaryBytes fell back to 0 B. Separately, binaryBytes had no EiB unit, so even a correct byte value could not humanize to exbibytes.
Solution description:
In frontend/public/components/utils/units.js:

  1. Treat only startingUnitIndex < 0 as unparseable so the largest unit (Ei, and similarly other type maxima) can be dehumanized.
  2. Add EiB to binaryBytes so values ≥ 1 Ei humanize as N EiB.
  3. Add Ei to validMemUnits so memory validation accepts 1Ei.
    Unit tests in units.spec.js cover humanize/dehumanize/convertToBaseValue/validate.memory for 1Ei.
    Ei remains available in the PVC create dropdown; API/oc quantity stays 1Ei. UI displays the equivalent humanized value 1 EiB (console binary label convention), not the raw k8s string.
    Screenshots / screen recording:

Before:
Screenshot 2026-07-22 at 11 34 40 AM

After
Screenshot 2026-07-22 at 11 34 50 AM

Test setup:
OpenShift cluster with console built from this branch. Ability to create a PVC (any StorageClass that accepts the request, or create via YAML if provisioner rejects Ei).
Test cases:

  1. Create PVC from console with size 1 and unit EiB; confirm YAML/oc shows storage: 1Ei.
  2. Open PVC details → Requested capacity shows 1 EiB (not 0 B).
  3. Create or apply a PVC via YAML with requests.storage: 1Ei; details page still shows 1 EiB.
  4. Regression: PVC with 1Gi / 1Pi still shows 1 GiB / 1 PiB.
  5. yarn test public/components/__tests__/units.spec.js
    Browser conformance:
  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)
    Additional info:
  • Jira: https://redhat.atlassian.net/browse/OCPBUGS-57309
  • Admission webhook warnings such as fractional byte value "1Ei" is invalid are API/cluster policy behavior and are out of scope for this UI fix.
  • Display uses humanized 1 EiB; it is intentionally not a raw mirror of the oc string 1Ei.
    Reviewers and assignees:

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

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds support for the largest binary memory unit, exbibyte (Ei/EiB), across conversion, humanization, dehumanization, validation, and unit tests.

Changes

Exbibyte unit support

Layer / File(s) Summary
Extend exbibyte conversion and validation
frontend/public/components/utils/units.js
Adds EiB and Ei support and permits conversion matching at the largest unit index.
Cover exbibyte behavior
frontend/public/components/__tests__/units.spec.js
Tests exbibyte humanization, dehumanization, memory validation, and base-value conversion.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: sg00dwin, fsgreco

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The touched Ginkgo/Jest titles are static data-driven strings from fixed literals; no timestamps, UUIDs, names, or run-specific values appear.
Test Structure And Quality ✅ Passed PASS — The PR only changes JS unit tests and a utility module; no Ginkgo/Gomega tests, cluster setup/cleanup, or Eventually timeouts are involved.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the diff only touches a Jest unit test and a JS utility, with no MicroShift-unsupported APIs or namespaces.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; only frontend Jest unit tests and a utility change were modified, so SNO compatibility is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed Only units formatting/validation files changed; no workload, affinity, nodeSelector, PDB, or topology-aware scheduling code was introduced.
Ote Binary Stdout Contract ✅ Passed Touched files only add Ei unit handling/tests; no main/init/suite-level stdout writes or logging calls were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR only changes frontend unit tests and unit-parsing utilities; no new Ginkgo e2e tests, IPv4 literals, or external connectivity were added.
No-Weak-Crypto ✅ Passed Touched files only change unit parsing/formatting and tests for EiB; no weak crypto, custom crypto, or secret comparisons appear in the diff.
Container-Privileges ✅ Passed Diff only touches JS unit logic/tests; no container/K8s manifests or privileged settings were added.
No-Sensitive-Data-In-Logs ✅ Passed No logging calls or sensitive literals were added in the touched files; changes are limited to unit conversion/tests for Ei/EiB.
Title check ✅ Passed The title is specific and accurately summarizes the EiB PVC display fix.
Description check ✅ Passed The description includes the required root cause, solution, screenshots, testing, and validation sections, with only minor omissions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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 Jul 22, 2026
@openshift-ci
openshift-ci Bot requested review from fsgreco and sg00dwin July 22, 2026 15:44
@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 Jul 22, 2026
@cajieh
cajieh force-pushed the invalid-eib-unit-create-pvc branch from 1301dbd to 47c45aa Compare July 22, 2026 16:51
});
if (startingUnitIndex <= 0) {
// 0 is valid: reversed unit list puts the largest suffix first (e.g. "1Ei" → Ei at index 0); -1 means no match.
if (startingUnitIndex < 0) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The index 0 is a successful match at the first position—not a failure. Unit parsing searches a reversed copy of the unit list (largest suffix first), so values like "1Ei" match Ei at index 0.

@cajieh
cajieh force-pushed the invalid-eib-unit-create-pvc branch from 47c45aa to 9d57418 Compare July 22, 2026 17:05
@cajieh cajieh changed the title [WIP] OCPBUGS-57309: '0 B' is shown on details page when create pvc with 'EiB' unit OCPBUGS-57309: '0 B' is shown on details page when create pvc with 'EiB' unit Jul 22, 2026
@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 Jul 22, 2026
@cajieh

cajieh commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

/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 Jul 22, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-57309, 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 (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira (yapei@redhat.com), skipping review request.

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.

@rhamilto

Copy link
Copy Markdown
Member

/approve
/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-gcp-console
/test e2e-playwright

@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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

cajieh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-playwright

1 similar comment
@cajieh

cajieh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-playwright

@cajieh

cajieh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

verified by CI

@cajieh

cajieh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/verified by CI

@cajieh

cajieh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 23, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cajieh: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

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-merge-bot
openshift-merge-bot Bot merged commit 38882a3 into openshift:main Jul 23, 2026
10 of 11 checks passed
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cajieh: Jira Issue Verification Checks: Jira Issue OCPBUGS-57309
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-57309 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

Analysis / Root cause:
Creating a PVC with size unit EiB stores spec.resources.requests.storage as 1Ei (same as oc get pvc -ojson). On the details page, Requested capacity uses convertToBaseValuehumanizeBinaryBytes.
convertToBaseValue dehumanizes via a reversed unit list where Ei is index 0. The parser treated startingUnitIndex <= 0 as failure, so "1Ei" never converted to bytes and humanizeBinaryBytes fell back to 0 B. Separately, binaryBytes had no EiB unit, so even a correct byte value could not humanize to exbibytes.
Solution description:
In frontend/public/components/utils/units.js:

  1. Treat only startingUnitIndex < 0 as unparseable so the largest unit (Ei, and similarly other type maxima) can be dehumanized.
  2. Add EiB to binaryBytes so values ≥ 1 Ei humanize as N EiB.
  3. Add Ei to validMemUnits so memory validation accepts 1Ei.
    Unit tests in units.spec.js cover humanize/dehumanize/convertToBaseValue/validate.memory for 1Ei.
    Ei remains available in the PVC create dropdown; API/oc quantity stays 1Ei. UI displays the equivalent humanized value 1 EiB (console binary label convention), not the raw k8s string.
    Screenshots / screen recording:

Before:
Screenshot 2026-07-22 at 11 34 40 AM

After
Screenshot 2026-07-22 at 11 34 50 AM

Test setup:
OpenShift cluster with console built from this branch. Ability to create a PVC (any StorageClass that accepts the request, or create via YAML if provisioner rejects Ei).
Test cases:

  1. Create PVC from console with size 1 and unit EiB; confirm YAML/oc shows storage: 1Ei.
  2. Open PVC details → Requested capacity shows 1 EiB (not 0 B).
  3. Create or apply a PVC via YAML with requests.storage: 1Ei; details page still shows 1 EiB.
  4. Regression: PVC with 1Gi / 1Pi still shows 1 GiB / 1 PiB.
  5. yarn test public/components/__tests__/units.spec.js
    Browser conformance:
  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)
    Additional info:
  • Jira: https://redhat.atlassian.net/browse/OCPBUGS-57309
  • Admission webhook warnings such as fractional byte value "1Ei" is invalid are API/cluster policy behavior and are out of scope for this UI fix.
  • Display uses humanized 1 EiB; it is intentionally not a raw mirror of the oc string 1Ei.
  • Note: The apiserver may incorrectly warn on 1Ei (fractional byte value "1Ei" is invalid) and the console may show that as an Admission Webhook toast. This is a known Kubernetes Quantity/MilliValue overflow quirk (kubernetes#128684); the same warning appears with oc.

Summary by CodeRabbit

  • New Features
  • Added support for exbibytes in binary-byte and memory value handling, including correct formatting for the largest binary units (EiB and Ei).
  • Improved unit parsing and validation so these units are accepted and converted reliably.
  • Tests
  • Expanded coverage for humanizing/dehumanizing and base conversion, including 1 EiB / 1 Ei.
  • Extended memory validation “valid values” and conversion test matrices to include 1 Ei.

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.

@cajieh

cajieh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/cherry-pick release-4.22
/cherry-pick release-4.21

@openshift-cherrypick-robot

Copy link
Copy Markdown

@cajieh: new pull request created: #16806

Details

In response to this:

/cherry-pick release-4.22
/cherry-pick release-4.21

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.

@openshift-cherrypick-robot

Copy link
Copy Markdown

@cajieh: new pull request created: #16807

Details

In response to this:

/cherry-pick release-4.22
/cherry-pick release-4.21

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.

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 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. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants