Skip to content

test(e2e): bump sandbox tenant storage quota 100Gi -> 200Gi - #3206

Merged
IvanHunters merged 1 commit into
mainfrom
fix/e2e-tenant-quota-storage
Jul 5, 2026
Merged

test(e2e): bump sandbox tenant storage quota 100Gi -> 200Gi#3206
IvanHunters merged 1 commit into
mainfrom
fix/e2e-tenant-quota-storage

Conversation

@IvanHunters

@IvanHunters IvanHunters commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

Raises the E2E sandbox tenant's resourceQuotas.storage from 100Gi to 200Gi so back-to-back tenant Kubernetes tests (kubernetes-latest.bats -> kubernetes-previous.bats) do not collide with tenant quota during the second cluster's CDI import.

The 100Gi default in packages/apps/tenant is unchanged — this touches only the E2E test tenant CR in hack/e2e-install-cozystack.bats.

Root cause

Both kubernetes-*.bats tests provision a 2-worker tenant control plane whose worker root disks are populated by CDI. CDI's second-phase importer allocates a scratch PVC of the same 20Gi as the target disk before the qcow2 unpack, so per-tenant peak footprint is:

2 × 20Gi target + 2 × 21Gi scratch = ~82Gi during import

collapsing to 40Gi at rest.

kubernetes-latest's cozy_cleanup deletes the Kubernetes CR and blocks in cozy_wait_tenant_drained (300s) waiting for KubeVirt VMs / VMIs / namespace PVCs to disappear. The API-level PVC delete returns quickly, but the LINSTOR CSI detach + DRBD resource release on the underlying nodes lags past that budget. During the overlap window the deleted PVCs still count against ResourceQuota.status.used.requests.storage because the storage provisioner has not finished releasing the volume. kubernetes-previous then starts its own CDI import with 40Gi of stale kubernetes-latest quota still charged, and CDI's scratch PVC create for the second worker (used 80Gi + scratch 21Gi = 101Gi) is rejected by the tenant-quota admission check at 100Gi. The second worker's DataVolume stalls in ImportInProgress, the tenant node never joins, and the 12-minute node-join deadline in run-kubernetes.sh fails kubernetes-previous.bats.

Evidence

cozyreport.tgz from the failing E2E run of PR #3044 (run 28730757213):

cdi-deployment log:
  scratch PVC API create errored:
    persistentvolumeclaims "…-qxl8r-disk-system-scratch" is forbidden:
    exceeded quota: tenant-quota,
    requested: requests.storage=22763536384 (21Gi),
    used: requests.storage=85899345920 (80Gi),
    limited: requests.storage=100Gi

The tenant-quota status.used.requests.storage in the snapshot decays back to 40Gi by end-of-run — confirming the leak is a transient window during the second test's start-up, not a permanent leak.

Relation to prior work

Overlaps in scope with #2947 (ci(e2e): bump tenant storage quota 100Gi -> 200Gi), which bundles this same bump alongside three other e2e stabilization changes (crust-gather tag, harbor BucketClaim timeout, cilium IP-conflict healer). #2947 has been stale since 2026-06-17 with the maintainer suggesting it be closed. This PR isolates just the quota-bump so it can land on its own scope; the other three changes are orthogonal and can ship separately if #2947 stays dormant.

Release note

NONE

Summary by CodeRabbit

  • Tests
    • Updated end-to-end coverage for tenant creation with isolated mode to reflect higher storage quota expectations.
    • Improved quota validation in test scenarios to better match supported storage behavior.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 39c299de-71c5-4903-a0c8-83615312d221

📥 Commits

Reviewing files that changed from the base of the PR and between a44d11d and 3ab9f95.

📒 Files selected for processing (1)
  • hack/e2e-install-cozystack.bats

📝 Walkthrough

Walkthrough

This PR updates an e2e bats test for tenant creation in isolated mode, increasing the tenant's requested storage quota from 100Gi to 200Gi and updating the corresponding ResourceQuota assertion, with added comments explaining the rationale.

Changes

Tenant Storage Quota Test Update

Layer / File(s) Summary
Update storage quota value and assertion
hack/e2e-install-cozystack.bats
Tenant spec's resourceQuotas.storage is increased from 100Gi to 200Gi with explanatory comments, and the ResourceQuota .spec.hard.requests.storage assertion is updated to match.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

  • cozystack/cozystack#1107: Modifies the same isolated-mode tenant test's storage quota configuration in hack/e2e-install-cozystack.bats.
  • cozystack/cozystack#1382: Modifies the same tenant resourceQuotas.storage value and ResourceQuota assertions in the same test file.
  • cozystack/cozystack#1389: Modifies the same Tenant resourceQuotas.storage setup and ResourceQuota expectations in the same test file.

Suggested labels: `kind/bug`

Suggested reviewers: `kvaps`, `lllamnyp`

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: increasing the sandbox tenant storage quota in the E2E test from 100Gi to 200Gi.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/e2e-tenant-quota-storage

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.

❤️ Share

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

@github-actions github-actions Bot added size/S This PR changes 10-29 lines, ignoring generated files area/testing Issues or PRs related to testing (e2e, bats, unit tests) labels Jul 5, 2026
The E2E sandbox tenant (tenant-test) provisions back-to-back tenant
Kubernetes control planes via kubernetes-latest.bats and
kubernetes-previous.bats. Each control plane brings up two worker VMs
whose 20Gi root disks are populated by CDI, and CDI's second-phase
importer allocates a scratch PVC of the same size before the qcow2
unpack. Peak per-tenant footprint is therefore ~82Gi during import
(2 × 20Gi target + 2 × 21Gi scratch), collapsing to 40Gi at rest.

kubernetes-latest teardown deletes the tenant Kubernetes CR and waits
via cozy_wait_tenant_drained for the KubeVirt VMs, VMIs and namespace
PVCs to disappear. The API-level PVC delete returns quickly, but the
LINSTOR CSI detach + DRBD resource release on the underlying nodes
lags past the 300s drain budget. During that window, the deleted
PVCs still count against ResourceQuota's requests.storage because
the storage-provisioner has not finished releasing the volume — so
kubernetes-previous starts its own CDI import with 40Gi of stale
kubernetes-latest quota still charged, and CDI's scratch PVC create
for the second worker (used=80Gi + scratch=21Gi = 101Gi) is
rejected by the tenant-quota admission check at 100Gi. The second
worker's DataVolume never leaves ImportInProgress, the tenant node
never joins, and the 12-minute node-join deadline in
run-kubernetes.sh trips kubernetes-previous.bats.

Raise the sandbox tenant-quota storage ceiling to 200Gi so the
overlap between one test's slow storage cleanup and the next test's
CDI import fits inside the quota. The failing-run diagnostic is
cozyreport artifact from run 28730757213:

  cdi-deployment log:
    scratch PVC API create errored: … forbidden: exceeded quota:
    tenant-quota, requested: requests.storage=22763536384,
    used: requests.storage=85899345920,
    limited: requests.storage=100Gi

This is a test-infrastructure fix; the 100Gi default in the tenant
chart itself is unchanged. The assertion below the CR update is
lifted from 100Gi to 200Gi in lockstep.

Signed-off-by: Ivan Okhotnikov <xorokhotnikov@gmail.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a race condition in the E2E test suite where overlapping tenant lifecycles cause storage quota violations. By doubling the available storage for the test tenant, the system can now accommodate the transient peak usage during CDI imports when previous test resources have not yet been fully released by the storage provider.

Highlights

  • Storage Quota Increase: Increased the E2E sandbox tenant storage quota from 100Gi to 200Gi to prevent resource exhaustion during back-to-back Kubernetes test execution.
  • Test Stability: Updated the E2E test assertion to verify the new 200Gi quota, ensuring that CDI scratch PVC allocations do not fail due to transient storage usage during tenant teardown overlap.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot Bot added the area/ci Issues or PRs related to CI workflows, GitHub Actions, automation label Jul 5, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request increases the storage resource quota from 100Gi to 200Gi in the E2E installation test suite (hack/e2e-install-cozystack.bats) to prevent resource quota issues during back-to-back tenant Kubernetes tests. The review feedback points out that the PR title uses an invalid scope (e2e) according to the repository style guide, and suggests using a valid scope such as tests or hack.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

cpu: "60"
memory: "128Gi"
storage: "100Gi"
# 200Gi so back-to-back tenant Kubernetes tests

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

The PR title uses the scope e2e, which is not listed as a valid scope in the repository style guide. Please consider updating the PR title and commit message to use a valid scope such as tests or hack to comply with the Conventional Commits requirements.

References
  1. Each commit must follow Conventional Commits format with valid scopes (e.g., tests, hack, ci, api, docs). (link)

@IvanHunters
IvanHunters merged commit b6ac249 into main Jul 5, 2026
20 checks passed
@IvanHunters
IvanHunters deleted the fix/e2e-tenant-quota-storage branch July 5, 2026 10:37

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — minimal, test-only quota bump that unblocks a real back-to-back tenant-test flake, with production defaults untouched.

Business context: raise the E2E sandbox tenant's storage quota so the kubernetes-latest → kubernetes-previous back-to-back tests don't trip the tenant ResourceQuota during CDI import while the prior test's DRBD/LINSTOR detach is still releasing storage.

Non-blocking notes

  1. The bump absorbs a transient quota-accounting overlap (deleted PVCs still counted while LINSTOR/DRBD detach lags past cozy_wait_tenant_drained) with headroom rather than closing it — fine for e2e stability, and the ~78Gi margin covers the documented worst-case overlap. If detach lag ever grows past that, the flake returns; a more durable (but more coupled) alternative would be to make the drain wait block until quota.status.used.requests.storage actually decays. Not needed now.
  2. Minor description nit: "The 100Gi default in packages/apps/tenant is unchanged" — the app's resourceQuotas default is actually {} (empty); the 100Gi lived only in this fixture. The intent (no product default touched) is correct.
  3. The title scope e2e is valid per contributing.md and the labeler (maps to area/testing); no rename needed.

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

Labels

area/ci Issues or PRs related to CI workflows, GitHub Actions, automation area/testing Issues or PRs related to testing (e2e, bats, unit tests) size/S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants