Skip to content

feat(vd): add quota override label for PVC migration#2148

Merged
danilrwx merged 8 commits intomainfrom
fix/vd/quota-exclude-for-vd-migration
Mar 25, 2026
Merged

feat(vd): add quota override label for PVC migration#2148
danilrwx merged 8 commits intomainfrom
fix/vd/quota-exclude-for-vd-migration

Conversation

@danilrwx
Copy link
Copy Markdown
Contributor

@danilrwx danilrwx commented Mar 25, 2026

Description

Add resource-quota-overrides.deckhouse.io/ignore label to target PVC during migration to prevent double counting.

Why do we need it, and what problem does it solve?

When migrating PVCs (e.g., local disk to storageClass change), both source and target PVCs exist temporarily. Without the label, quota counts both PVCs (x2), potentially exceeding limits.

Migration State Table

Stage Source Target Quota
Before migration No label Source
Target created No label With label Source
Success Deleted Label removed Target
Failure No label Deleted Source
  • Label added to target PVC at creation
  • Label removed from target only on success
  • On failure, target is deleted, source remains primary
  • Temporary QuotaExceeded (both PVCs counted) is resolved once source is deleted

What is the expected result?

  1. Start migration of VirtualDisk
  2. Target PVC created with resource-quota-overrides.deckhouse.io/ignore label
  3. Migration completes → source deleted, label removed from target
  4. Quota correctly counts only target PVC

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: core
type: feature
summary: Add quota override label for PVC migration to prevent double counting.

- Add resource-quota-overrides.deckhouse.io/ignore label to target PVC
  when it is created during migration (handleMigratePrepareTarget)
- Remove the label from target PVC before deleting source PVC
  (handleComplete) to avoid x0 quota scenario

During migration, the quota will be x2 for a short time, but that's
expected. The main goal is to avoid x0 quota.

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the fix/vd/quota-exclude-for-vd-migration branch from d56ecd1 to 4599790 Compare March 25, 2026 10:51
@danilrwx danilrwx added this to the v1.7.0 milestone Mar 25, 2026
@danilrwx danilrwx marked this pull request as ready for review March 25, 2026 10:51
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the fix/vd/quota-exclude-for-vd-migration branch from 4f9662f to 73ee537 Compare March 25, 2026 12:37
Move quota override label from target PVC to source PVC during migration:
- Add label to source PVC after target PVC is successfully created (prevents x0 quota)
- Remove label from source PVC if migration fails (handleRevert, handleComplete)
- Source PVC is excluded from quota while migration is in progress
- If migration fails, quota starts counting source PVC again

This prevents double counting of storage resources during PVC migration
when both source and target PVCs exist simultaneously.

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the fix/vd/quota-exclude-for-vd-migration branch from 73ee537 to 481dee0 Compare March 25, 2026 12:51
…tion"

This reverts commit 481dee0.

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the fix/vd/quota-exclude-for-vd-migration branch 2 times, most recently from 2164883 to d261e75 Compare March 25, 2026 15:49
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the fix/vd/quota-exclude-for-vd-migration branch from d261e75 to 38dbb63 Compare March 25, 2026 15:50
@danilrwx danilrwx merged commit 4acea76 into main Mar 25, 2026
27 of 28 checks passed
@danilrwx danilrwx deleted the fix/vd/quota-exclude-for-vd-migration branch March 25, 2026 16:19
danilrwx added a commit that referenced this pull request Mar 25, 2026
* feat(vd): add quota override label for PVC migration

Add resource-quota-overrides.deckhouse.io/ignore label to target PVC during migration to prevent double counting.

---------

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Isteb4k pushed a commit that referenced this pull request Mar 25, 2026
* feat(vd): add quota override label for PVC migration

Add resource-quota-overrides.deckhouse.io/ignore label to target PVC during migration to prevent double counting.

---------

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
(cherry picked from commit 4acea76)
danilrwx added a commit that referenced this pull request Mar 25, 2026
* feat(vd): add quota override label for PVC migration

Add resource-quota-overrides.deckhouse.io/ignore label to target PVC during migration to prevent double counting.

---------

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Isteb4k pushed a commit that referenced this pull request Mar 25, 2026
* feat(vd): add quota override label for PVC migration

Add resource-quota-overrides.deckhouse.io/ignore label to target PVC during migration to prevent double counting.

---------

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
(cherry picked from commit 4acea76)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants