The apps API admits release names of up to 53 characters, and several
charts name a Job <release>-<suffix>. Kubernetes copies a Job name into
the job-name label of its pods, and a label value takes at most 63
characters, so the apiserver refused these Jobs for the longest names. A
Kafka whose name has 42 to 44 characters could not be installed, a
VMDisk of 37 or more could not grow, a VMInstance of 40 or 41 could not
take an instance type, profile or external change, and a Bucket of 44 or
more or a Qdrant of 42 or more failed its post-delete hook. Those Job
names, and the pod label vm-instance copies from one, are now cut to 63
characters. A release name is never longer than 53, so only the fixed
suffix is cut and two releases still get two Jobs.
A CronJob name is refused over 52 characters, because the controller
names each Job it starts <cronjob>-<timestamp>. With the backup CronJob
on, a MariaDB whose name has 38 characters or more and a ClickHouse of
35 or more failed the whole release. A cut there reaches into the
release name and could give two releases one CronJob, so a name that
does not fit becomes the release name cut to 38 characters, a hash of
the full release name and -backup, the way the ClickHouse Keeper name
is already shortened.
The tenant cleanup Job is named after the tenant namespace, which a
nested tenant can fill to 63 characters by itself. The Job runs in
cozy-system next to that of every other tenant, where a plain cut could
give a parent and its child one name and let the child's
before-hook-creation delete the parent's Job while it runs, so it is
shortened with a hash of the namespace the same way.
Names that fit render exactly as before, and a name that did not fit
never produced an object, so nothing is renamed on upgrade. The hook
ServiceAccounts, Roles and RoleBindings have no such limit and keep
their names.
Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
(cherry picked from commit a2c9c07a16)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
Managed ClickHouse Service
ClickHouse is an open source high-performance and column-oriented SQL database management system (DBMS). It is used for online analytical processing (OLAP).
Backup orchestration
Two backup paths coexist on the chart; pick one per release.
Recommended: BackupClass + Plan via the Altinity strategy
The cluster-scoped Altinity strategy
(strategy.backups.cozystack.io/v1alpha1) wraps
Altinity's clickhouse-backup in a one-shot
batch/v1.Job per BackupJob / RestoreJob. It is engine-aware (FREEZE +
upload), supports both in-place and targetApplicationRef (to-copy) restore,
and does not require any in-chart CronJob.
Wiring per release:
- Set
backup.enabled: trueplus thes3*(ors3CredentialsSecret.name) fields on the chart values. The chart materialises a Secret named<release>-backup-s3carrying bucket coordinates and credentials. That Secret is consumed by the chart-emittedclickhouse-backupsidecar (rendered into the ClickHouseInstallation Pod bytemplates/clickhouse.yaml); the strategy Pod itself is a curl/jq client that reaches the sidecar's HTTP API on port 7171 and never reads the Secret directly. - Cluster admin one-time installs an
Altinitystrategy and aBackupClassthat mapsapps.cozystack.io/ClickHouseto it (seeexamples/backups/clickhouse/01-create-strategy.shand02-create-backupclass.sh). - Tenant creates a
Plan(cron schedule) or submits an ad-hocBackupJobreferencing the BackupClass. Restoring is aRestoreJobreferencing the resultingBackup; omittargetApplicationReffor in-place, set it to a second ClickHouse instance for to-copy.
Bringing your own S3 credentials Secret
Setting backup.s3CredentialsSecret.name makes the chart skip the
materialisation of <release>-backup-s3 and points the sidecar at the
referenced Secret instead. The Secret must hold the five S3 fields as
separate string keys, not a JSON blob; the per-key field names default
to bucketName / endpoint / region / accessKey / secretKey and
can be remapped via backup.s3CredentialsSecret.{bucketKey,endpointKey,…}.
Example:
apiVersion: v1
kind: Secret
metadata:
name: my-s3-creds
namespace: tenant-test
type: Opaque
stringData:
bucketName: my-clickhouse-archive
endpoint: https://s3.example.org
region: us-east-1
accessKey: AKIAIOSFODNN7EXAMPLE
secretKey: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
---
# In ClickHouse values.yaml:
backup:
enabled: true
s3CredentialsSecret:
name: my-s3-creds
The Cozystack
Bucketapp's BucketInfo Secret (bucket-<name>-<user>, singleBucketInfokey holding a JSON blob) is not directly consumable ass3CredentialsSecret. Either let the chart read the raw values viabackup.s3*(asexamples/backups/clickhouse/03-create-bucket.shdoes — extract coordinates from BucketInfo and pass them to the chart values), or materialise an intermediate Secret with the five string keys above.
Legacy: chart-emitted Restic CronJob
The chart still ships a CronJob that streams per-table SHOW CREATE TABLE
SELECT * FORMAT TabSeparatedinto a Restic repository. This path is kept for backward compatibility; new installations should prefer the BackupClass flow above.
To opt in:
-
Set
backup.enabled: true,backup.schedule: "0 2 * * *"(or another non-empty cron),backup.s3*andbackup.resticPassword. -
To restore manually:
restic -r s3:s3.example.org/clickhouse-backups/table_name snapshots restic -r s3:s3.example.org/clickhouse-backups/table_name restore latest --target /tmp/For more details, read Restic: Effective Backup from Stdin.
The legacy backup.schedule, backup.cleanupStrategy, and
backup.resticPassword values are deprecated and will be removed once the
Altinity strategy is the default in all reference deployments. The
chart-emitted CronJob renders only when backup.schedule is non-empty.
storageClassis annotated as immutable in the chart schema — seedocs/storage-immutability.mdfor the contract and which consumers enforce it.
Parameters
Common parameters
| Name | Description | Type | Value |
|---|---|---|---|
replicas |
Number of ClickHouse replicas. | int |
2 |
shards |
Number of ClickHouse shards. | int |
1 |
resources |
Explicit CPU and memory configuration for each ClickHouse replica. When omitted, the preset defined in resourcesPreset is applied. |
object |
{} |
resources.cpu |
CPU available to each replica. | quantity |
"" |
resources.memory |
Memory (RAM) available to each replica. | quantity |
"" |
resourcesPreset |
Default sizing preset used when resources is omitted. |
string |
t1.small |
size |
Persistent Volume Claim size available for application data. | quantity |
10Gi |
storageClass |
StorageClass used to store the data. | string |
"" |
version |
ClickHouse major.minor version to deploy. Applies to both the ClickHouse server and ClickHouse Keeper images. Downgrading to an older major is unsafe (ClickHouse cannot read data written by a newer server and Keeper snapshots are not backward compatible) — only increase this value. | string |
v24.9 |
Application-specific parameters
| Name | Description | Type | Value |
|---|---|---|---|
logStorageSize |
Size of Persistent Volume for logs. | quantity |
2Gi |
logTTL |
TTL (expiration time) for query_log and query_thread_log. |
int |
15 |
users |
Users configuration map. | map[string]object |
{} |
users[name].password |
Password for the user. | string |
"" |
users[name].readonly |
User is readonly (default: false). | bool |
false |
Backup parameters
| Name | Description | Type | Value |
|---|---|---|---|
backup |
Backup configuration. | object |
{} |
backup.enabled |
Enable backup integration. Materialises the chart-emitted <release>-backup-s3 Secret consumed by the Altinity backup strategy and, when schedule is non-empty, also renders the legacy chart-managed CronJob. |
bool |
false |
backup.useSystemBucket |
Opt-in: when true, the chart-emitted <release>-backup-s3 Secret is skipped and the clickhouse-backup sidecar reads bucket coordinates + S3 credentials from the platform-projected cozy-backups-creds Secret. S3_PATH is set to <namespace>/<release> for cross-tenant isolation. Use together with the platform cozy-default BackupClass — tenants do not need to fill any s3* field below. |
bool |
false |
backup.s3Region |
DEPRECATED. Per-tenant S3 configuration is being phased out in favour of the platform-managed cozy-default BackupClass. Optional now so tenants on useSystemBucket: true can omit it. |
string |
us-east-1 |
backup.s3Bucket |
DEPRECATED. Optional; see s3Region. |
string |
s3.example.org/clickhouse-backups |
backup.endpoint |
DEPRECATED. S3 endpoint URL for the legacy chart-emitted sidecar. | string |
"" |
backup.s3PathOverride |
DEPRECATED. Object-key prefix inside the legacy s3Bucket; the new platform flow scopes by namespace automatically. |
string |
"" |
backup.schedule |
Legacy. Cron schedule for the chart-emitted CronJob that runs the dump+restic backup. Empty (default) skips the legacy CronJob; recommended when a BackupClass + Plan from backups.cozystack.io already drives backup orchestration via the Altinity strategy. |
string |
"" |
backup.cleanupStrategy |
Legacy. Restic retention policy passed to the legacy CronJob (restic forget …). Unused by the Altinity strategy. |
string |
--keep-last=3 --keep-daily=3 --keep-within-weekly=1m |
backup.s3AccessKey |
DEPRECATED. Tenants no longer supply S3 keys; the platform-managed Bucket Secret is the source of truth. Optional now so useSystemBucket: true tenants can omit it. |
string |
<your-access-key> |
backup.s3SecretKey |
DEPRECATED. Optional; see s3AccessKey. |
string |
<your-secret-key> |
backup.resticPassword |
Legacy. Password for Restic backup encryption used by the legacy CronJob. Unused by the Altinity strategy. | string |
<password> |
backup.s3CredentialsSecret |
DEPRECATED. Pre-existing Secret reference for the legacy chart-emitted sidecar. The platform flow projects cozy-backups-creds instead. |
object |
{} |
backup.s3CredentialsSecret.name |
Name of the Secret in the application namespace. Empty means the chart materialises <release>-backup-s3 from the legacy s3* fields. |
string |
"" |
backup.s3CredentialsSecret.bucketKey |
Key in the Secret holding the bucket name. Defaults to bucketName. |
string |
"" |
backup.s3CredentialsSecret.endpointKey |
Key in the Secret holding the S3 endpoint URL. Defaults to endpoint. |
string |
"" |
backup.s3CredentialsSecret.regionKey |
Key in the Secret holding the S3 region. Defaults to region. |
string |
"" |
backup.s3CredentialsSecret.accessKeyIDKey |
Key in the Secret holding the access key ID. Defaults to accessKey. |
string |
"" |
backup.s3CredentialsSecret.secretAccessKeyKey |
Key in the Secret holding the secret access key. Defaults to secretKey. |
string |
"" |
backup.endpointCA |
CA bundle the sidecar trusts when the S3 endpoint's certificate is signed by a private CA (e.g. Cozystack's in-cluster SeaweedFS). Applies to both the per-tenant and the useSystemBucket flow, and to the clickhouse-backup sidecar only — the legacy schedule CronJob writes to S3 through restic and does not consume it, so a private-CA endpoint combined with schedule still fails TLS. Use the BackupClass flow for such an endpoint. |
object |
{} |
backup.endpointCA.name |
Name of the Secret in the application namespace. Empty (default) mounts nothing and leaves the sidecar on the system trust store only. | string |
"" |
backup.endpointCA.key |
Key inside the Secret holding the PEM CA bundle. Defaults to ca.crt. |
string |
ca.crt |
ClickHouse Keeper parameters
| Name | Description | Type | Value |
|---|---|---|---|
clickhouseKeeper |
ClickHouse Keeper configuration. | object |
{} |
clickhouseKeeper.enabled |
Deploy ClickHouse Keeper for cluster coordination. | bool |
true |
clickhouseKeeper.size |
Persistent Volume Claim size available for application data. | quantity |
1Gi |
clickhouseKeeper.resourcesPreset |
Default sizing preset. | string |
t1.micro |
clickhouseKeeper.replicas |
Number of Keeper replicas. | int |
3 |
Parameter examples and reference
resources and resourcesPreset
resources sets explicit CPU and memory configurations for each replica.
Every resource it leaves unset is taken from the preset defined in resourcesPreset.
resources:
cpu: 4000m
memory: 4Gi
resourcesPreset sets named CPU and memory configurations for each replica.
This setting is ignored if the corresponding resources value is set.
| Preset name | CPU | memory |
|---|---|---|
nano |
250m |
128Mi |
micro |
500m |
256Mi |
small |
1 |
512Mi |
medium |
1 |
1Gi |
large |
2 |
2Gi |
xlarge |
4 |
4Gi |
2xlarge |
8 |
8Gi |