Files
cozystack/packages/apps/clickhouse/Makefile
Алексей Артамонов 2c8f6b8ca1 fix(clickhouse)!: clean up orphaned keeper and data PVCs on delete (#3057)
After deleting a ClickHouse app CR, the keeper PVC and the main data/log
PVCs were left orphaned in the tenant namespace, consuming storage
permanently. The clickhouse-keeper-operator does not delete data PVCs on CR
removal (data-safety default) and the CRD exposes no
persistentVolumeClaimRetentionPolicy equivalent.

Add a post-delete cleanup hook (modeled on the MariaDB hook) that deletes
every PVC carrying the release label app.kubernetes.io/instance=<release>.
Also stamp that label on the keeper volumeClaimTemplates in chkeeper.yaml:
the keeper PVC previously had no release label (the chart labelled only the
keeper pod template, not the PVC), so a single selector would have missed
the very PVC the issue reports.

BREAKING CHANGE: deleting a ClickHouse app now permanently removes all of its
PVCs (keeper + data + logs) and the data they hold. Nothing is left behind to
recover from. This matches the existing MariaDB cleanup-hook behaviour and the
general cozystack model where deleting a managed app reclaims its storage.

Signed-off-by: Алексей Артамонов <aleksei.artamonov@aenix.io>
2026-07-01 18:31:05 +03:00

31 lines
1.3 KiB
Makefile

CLICKHOUSE_BACKUP_TAG = $(shell awk '$$0 ~ /^version:/ {print $$2}' Chart.yaml)
include ../../../hack/common-envs.mk
include ../../../hack/package.mk
generate:
cozyvalues-gen -m 'clickhouse' -v values.yaml -s values.schema.json -r README.md -g ../../../api/apps/v1alpha1/clickhouse/types.go
../../../hack/update-crd.sh
.PHONY: test
test:
helm unittest .
image:
docker buildx build images/clickhouse-backup \
$(call image-tags,clickhouse-backup,$(CLICKHOUSE_BACKUP_TAG)) \
$(call cache-args,clickhouse-backup) \
--metadata-file images/clickhouse-backup.json \
$(BUILDX_ARGS)
echo "$(REGISTRY)/clickhouse-backup:$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/clickhouse-backup.json -o json -r)" \
> images/clickhouse-backup.tag
rm -f images/clickhouse-backup.json
docker buildx build images/altinity-clickhouse-backup \
$(call image-tags,altinity-clickhouse-backup,$(CLICKHOUSE_BACKUP_TAG)) \
$(call cache-args,altinity-clickhouse-backup) \
--metadata-file images/altinity-clickhouse-backup.json \
$(BUILDX_ARGS)
echo "$(REGISTRY)/altinity-clickhouse-backup:$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/altinity-clickhouse-backup.json -o json -r)" \
> images/altinity-clickhouse-backup.tag
rm -f images/altinity-clickhouse-backup.json