Skip to content

feat: make the tier1 and tier2 cache volumes optional - #199

Open
armru wants to merge 4 commits into
mainfrom
dev/136
Open

feat: make the tier1 and tier2 cache volumes optional#199
armru wants to merge 4 commits into
mainfrom
dev/136

Conversation

@armru

@armru armru commented Aug 31, 2026

Copy link
Copy Markdown
Member

A Server had to dedicate a PVC to the Kopia cache of every tier it
configured, which is three volumes for the common tier1+tier2 setup and a
decision the user has no basis to make before running anything.

tier1.cache and tier2.cache are now optional. When a tier has no cache
stanza, its cache lives in the tier1 data volume, under /data/cache_tier1
and /data/cache_tier2. The fallback needs that volume, so tier2.cache stays
required when tier1 is not configured, which a CEL rule enforces. The stanza
can be added or removed on a running server: the VolumeClaimTemplates change
recreates the StatefulSet through the existing path, and the cache left
behind is reclaimed, either as a directory in the data volume or as a PVC
the operator deletes.

The issue asks to move the cache folder to its new volume. Nothing is moved:
Kopia rebuilds the cache on demand, so the old copy is only reclaimed and
the first operations after the restart run against a cold cache. Copying it
would also only work in one direction, since a removed cache PVC is no
longer mounted anywhere.

Closes #136

@armru
armru force-pushed the dev/136 branch 2 times, most recently from 16cbec4 to 16bd0cc Compare September 2, 2026 08:08
When a tier's cache moves to a different volume, the cache it leaves
behind keeps consuming space on the old one, and nothing ever removes
it: the cache directory is only wiped when the repository is first
initialized.

Add an optional `stale_cache` path per tier. When set, and different
from the cache in use, the server removes it before initializing the
repository. Kopia rebuilds the cache on demand, so there is nothing to
migrate.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
A Server had to dedicate a PVC to the Kopia cache of every tier it
configured, which is three volumes for the common tier1+tier2 setup and
a decision the user has no basis to make before running anything.

`tier1.cache` and `tier2.cache` are now optional. When a tier has no
cache stanza, its cache lives in the tier1 data volume, under
/data/cache_tier1 and /data/cache_tier2. Since the fallback needs the
data volume, tier2.cache stays required when tier1 is not configured,
which a CEL rule enforces; the cache shrink rules now tolerate a cache
that is absent on either side of an update.

The stanza can be added or removed on a running server: the
VolumeClaimTemplates change recreates the StatefulSet through the
existing path, the server reclaims a cache left behind in the data
volume, and the operator deletes the PVC of a cache that is no longer
dedicated. Cache PVCs are the only ones reclaimed, as they hold no
backup data.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Explain when to dedicate a PVC to a tier's cache and what happens when
you do not, and drop the cache stanza from the quickstart, whose data
PVC now has to accommodate the cache.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Every volume the server claims was built by its own injector, each
repeating the same labelled PersistentVolumeClaim literal, and the cache
work added a third guard to that pattern. A single volumeClaimTemplates
function now returns them all, in the order the StatefulSet had before,
and the same collapsing applies to the cache paths in the environment
builder and to the desired PVC sizes.

The StatefulSet spec is unchanged, hash included, so no server is
restarted by this.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
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

1 participant