Skip to content

feat(operator)!: replace per-purpose PVCs with a single unified /klio PVC - #245

Merged
gabriele-wolfox merged 7 commits into
mainfrom
single-pvc
Sep 10, 2026
Merged

feat(operator)!: replace per-purpose PVCs with a single unified /klio PVC#245
gabriele-wolfox merged 7 commits into
mainfrom
single-pvc

Conversation

@fcanovai

@fcanovai fcanovai commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

The Server used to provision four PVCs, each gated on the tier that needed it: data and cachetier1 for tier1, cachetier2 for tier2, and queue for the work queue. Sizing four volumes independently is awkward to operate and leaves capacity stranded in whichever one was under-provisioned.

Every server now gets exactly one PVC, named klio and mounted at /klio, holding the same state as fixed subdirectories: /klio/data, /klio/queue, /klio/cache_tier1 and /klio/cache_tier2. Read-only tier2-only servers get the PVC and the mount too; the core creates only the subdirectories the active tiers need, via afero so tests can exercise directory creation against an in-memory filesystem instead of real disk. Directory creation (WAL, Kopia repository, cache, queue) now happens in one place, initializeTier1, before the server starts.

spec.storage.pvcTemplate replaces spec.tier1.data, spec.tier1.cache, spec.tier2.cache and spec.queue, and the four per-PVC shrink guards collapse into one CEL rule on ServerSpec. That rule is guarded against Servers created before spec.storage existed: evaluating it against a pre-migration Server used to crash admission with a CEL "no such key" error instead of failing cleanly. PVC resize now targets that single PVC directly by its deterministic name instead of listing and filtering by label, and the klio.cnpg.io/type label, which never gained a second value, is dropped from the StatefulSet/Service/Pods.

BREAKING CHANGE: Server.spec.tier1.data, Server.spec.tier1.cache, Server.spec.tier2.cache and Server.spec.queue are removed and replaced by the required Server.spec.storage. Existing Server resources are invalid against the new CRD and must be rewritten. The old PVCs are retained but no longer used; migrating their contents into the unified volume is a manual procedure, documented in the "0.0.20 to 0.0.21" section of upgrade_notes.md.

Closes #135, closes #136

Assisted-by: Claude

@fcanovai
fcanovai marked this pull request as ready for review September 9, 2026 08:21
@fcanovai
fcanovai requested review from a team and jlong49 as code owners September 9, 2026 08:21
@gabriele-wolfox
gabriele-wolfox force-pushed the single-pvc branch 4 times, most recently from 2d853d8 to 3194998 Compare September 10, 2026 09:02
fcanovai and others added 7 commits September 10, 2026 11:20
… PVC

The Server used to provision four PVCs, each gated on the tier that
needed it: data and cachetier1 for tier1, cachetier2 for tier2, and
queue for the work queue. Sizing four volumes independently is
awkward to operate and leaves capacity stranded in whichever one was
under-provisioned.

Every server now gets exactly one PVC, named klio and mounted at
/klio, holding the same state as fixed subdirectories: /klio/data,
/klio/queue, /klio/cache_tier1 and /klio/cache_tier2. Read-only
tier2-only servers get the PVC and the mount too; the core creates
only the subdirectories the active tiers need, via afero so tests can
exercise directory creation against an in-memory filesystem instead of
real disk. Directory creation (WAL, Kopia repository, cache, queue)
now happens in one place, initializeTier1, before the server starts.

spec.storage.pvcTemplate replaces spec.tier1.data, spec.tier1.cache,
spec.tier2.cache and spec.queue, and the four per-PVC shrink guards
collapse into one CEL rule on ServerSpec. That rule is guarded against
Servers created before spec.storage existed: evaluating it against a
pre-migration Server used to crash admission with a CEL "no such key"
error instead of failing cleanly. PVC resize now targets that single
PVC directly by its deterministic name instead of listing and
filtering by label, and the klio.cnpg.io/type label, which never
gained a second value, is dropped from the StatefulSet/Service/Pods.

BREAKING CHANGE: Server.spec.tier1.data, Server.spec.tier1.cache,
Server.spec.tier2.cache and Server.spec.queue are removed and
replaced by the required Server.spec.storage. Existing Server
resources are invalid against the new CRD and must be rewritten. The
old PVCs are retained but no longer used; migrating their contents
into the unified volume is a manual procedure, documented in the
"0.0.20 to 0.0.21" section of upgrade_notes.md.

Closes #135, closes #136

Assisted-by: Claude
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
The initializeTier1 check already rejects a tier1 server without a
queue before runServer is reached, so the second check was
unreachable. Also note in the directory tests that they rely on the
kopia binary being absent.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
With a single PVC the label can only ever hold the value klio and
nothing in the operator reads it any more: resize looks the PVC up by
its deterministic name. Key the e2e size checks by PVC name as well.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Name the operator log line that is the only signal while a Server is
waiting to be migrated, state the PVC name as hardcoded by the operator
and give the kubectl check to run after migration. Drop the pvcType
label from the sample manifest.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
The spellcheck CI flags "hardcodes" as unknown in upgrade_notes.md.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
The function initializeTier1 already errors when the queue directory
is unset, but no test exercised that path, leaving it without
regression coverage.

Co-Authored-By: Claude
Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
The storage-shrink CEL rule was updated to short-circuit when
oldSelf.storage is missing, fixing an admission crash for Servers
stored before spec.storage existed. No test created such a Server, so
the fix had no regression coverage.

Co-Authored-By: Claude
Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
@gabriele-wolfox
gabriele-wolfox merged commit 40001ba into main Sep 10, 2026
16 checks passed
@gabriele-wolfox
gabriele-wolfox deleted the single-pvc branch September 10, 2026 09:52
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.

Make cache volumes optional Make queue volume optional

3 participants