Allow overriding the vtbackup data volume per tablet pool (#661) - #798
Open
mcrauwel wants to merge 7 commits into
Open
Allow overriding the vtbackup data volume per tablet pool (#661)#798mcrauwel wants to merge 7 commits into
mcrauwel wants to merge 7 commits into
Conversation
vtbackup Pods (the initial backup taken at shard creation and any
periodic/scheduled backups) inherit their spec from the tablet pool,
including DataVolumeClaimTemplate. That forces a PVC and disk allocation
per shard just to bootstrap an empty backup, which is wasteful and
sometimes unschedulable in large clusters.
Add an optional `vtbackup` block on VitessShardTabletPool with a
`dataVolumeClaimTemplate` override:
- block omitted -> inherit the pool's data volume (unchanged).
- block present, empty -> vtbackup Pods run with no PVC (ephemeral
emptyDir scratch space).
- template set -> vtbackup Pods use that template (e.g. a
smaller disk or a different storageClass).
Both vtbackup code paths funnel through MakeVtbackupSpec, so the override
applies consistently to initial and scheduled backups. Tablet Pods are
unaffected.
Tests: unit coverage of all three states, plus an integration assertion
that an empty override yields a vtbackup-init Pod with no PVC-backed
volume while the tablets keep their PVCs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthias Crauwels <matthias.crauwels@planetscale.com>
…a-volume-override
Signed-off-by: Matt Lord <mattalord@gmail.com>
frouioui
reviewed
Jul 21, 2026
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
frouioui
approved these changes
Aug 3, 2026
…a-volume-override # Conflicts: # test/endtoend/operator/operator-latest.yaml # test/integration/vitesscluster/vitesscluster_test.go
Signed-off-by: Matt Lord <mattalord@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #661.
This change adds an optional, shard-scoped
vtbackupblock toVitessShardTemplate. The block is a sibling oftabletPoolsand controls the scratch data volume used by vtbackup Pods for that shard.Historically, vtbackup Pods inherited the first tablet pool's
dataVolumeClaimTemplate. That behavior allocates a PVC and an underlying disk per shard, even for the initial backup of an empty database. Large clusters can therefore allocate substantial unused storage or fail to bootstrap when those PVCs cannot bind.Configuration
An empty
vtbackupblock lets the initial backup use ephemeral scratch space while tablet Pods retain their normal PVCs:A shard can instead provide a dedicated PVC template for vtbackup Pods:
Semantics
vtbackupconfigurationemptyDirscratch spacedataVolumeClaimTemplatesetScheduled backups keep persistent scratch storage when the block is empty because vtbackup restores the latest full database before taking a new backup. Using an unbounded
emptyDirfor that workload could cause node disk pressure or eviction.Omitting the block preserves the historical behavior. Tablet Pod storage is unaffected.
Storage reconciliation
The operator records a hash of the effective vtbackup PVC template on the initial-backup Pod and PVC. When the storage configuration changes, it:
This allows the controller to converge across PVC-to-
emptyDir,emptyDir-to-PVC, and custom-PVC-template changes. In particular, addingvtbackup: {}can recover an initial backup that is Pending because its inherited PVC cannot bind.Scope
This change only separates vtbackup data-volume configuration from tablet storage. Broader vtbackup Pod overrides can build on the shard-scoped
vtbackupblock in follow-up work.Tests
vtbackupblock still creates and mounts a PVC.emptyDir,emptyDir-to-PVC, and custom-template transitions.vtbackup: {}removes the initial-backup PVC while tablet Pods retain theirs.Local verification:
make unit-testgolangci-lint: 0 issues