Skip to content

clickhouse: keeper PVC is not deleted after the CR is removed #3057

Closed

Description

@scooby87

Describe the bug

After deleting a ClickHouse app CR, the ZooKeeper/keeper data PVC remains, consuming storage permanently.

Environment

  • Cozystack version: v1.4.0-rc.2
  • Provider: on-prem (bare-metal)

To Reproduce

  1. Create a tenant, deploy ClickHouse/test.
  2. Wait until Ready.
  3. Delete the ClickHouse CR; wait ~120s.
  4. kubectl -n <ns> get pvc — the keeper PVC remains.

Expected behaviour
Data PVCs are released (or explicitly cleaned) after the CR is deleted.

Actual behaviour

pvc/default-chk-clickhouse-test-keeper-cluster1-0-0-0   Bound

Additional context

  • Root cause: The keeper PVC backs a ClickHouseKeeperInstallation (packages/apps/clickhouse/templates/chkeeper.yaml:65-72, volumeClaimTemplates), reconciled by the clickhouse-keeper-operator. The operator does not delete data PVCs when the CHK CR is removed (data-safety default), and the CRD exposes no persistentVolumeClaimRetentionPolicy equivalent. (The main ClickHouse data PVCs have the same gap.)
  • Proposed fix: Add a post-delete PVC cleanup hook packages/apps/clickhouse/templates/hooks/cleanup-pvc.yaml, modeled on the MariaDB hook, selecting PVCs by app={{ .Release.Name }}-keeper (chkeeper.yaml:42) and app.kubernetes.io/instance={{ .Release.Name }}.

Found during a create→delete leak sweep of all 22 apps on Cozystack v1.4.0-rc.2.

Activity

  1. self-assigned this
    on Jun 25, 2026
  2. added
    kind/bugCategorizes issue or PR as related to a bug
    priority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release
    area/databaseIssues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse)
    on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/databaseIssues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse)kind/bugCategorizes issue or PR as related to a bugpriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next releasetriage/acceptedIndicates an issue is ready to be actively worked on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions