Files
cozystack/packages/apps/clickhouse
Andrei Kvapil e7b62ca3c8 [platform] Replace Helm lookup with valuesFrom mechanism (#1787)
## What this PR does

Replaces Helm lookup functions with FluxCD valuesFrom mechanism for
passing configuration to HelmReleases. This provides cleaner config
propagation and eliminates the need for force reconcile controllers.

### Changes:

**Platform/Tenant charts:**
- Add Secret `cozystack-values` creation in platform chart (for
tenant-root and system namespaces)
- Add Secret `cozystack-values` creation in tenant chart (for child
namespaces)

**cozystack-api:**
- Add `valuesFrom` references to HelmRelease when creating applications
- Filter keys starting with `_` when returning Application specs
- Validate that user values don't contain `_` prefixed keys

**cozystack-controller:**
- Add validation that HelmRelease contains correct valuesFrom
configuration
- Remove `CozystackConfigReconciler` (no longer needed)
- Remove `TenantHelmReconciler` (no longer needed)

**Helm charts (40+ files):**
- Add helper templates in cozy-lib for `_cluster`/`_namespace` access
- Replace ConfigMap lookups with `.Values._cluster.*`
- Replace Namespace annotation lookups with `.Values._namespace.*`

### Architecture:

```
Secret cozystack-values (in each namespace)
├── _cluster: YAML with data from ConfigMaps (cozystack, cozystack-branding, cozystack-scheduling)
└── _namespace: YAML with namespace service references (etcd, host, ingress, monitoring, seaweedfs)

HelmRelease
└── spec.valuesFrom:
    ├── Secret/cozystack-values → _namespace → .Values._namespace
    └── Secret/cozystack-values → _cluster → .Values._cluster
```

### Release note

```release-note
[platform] Replace Helm lookup functions with FluxCD valuesFrom mechanism for configuration propagation
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Helm releases and namespaces now source centralized cluster/namespace
configuration via a new secret (cozystack-values), and many templates
read values from chart-provided _cluster/_namespace entries.

* **Bug Fixes**
* API now rejects application specs containing reserved keys prefixed
with "_" to prevent invalid configurations.

* **Refactor**
* Two background reconciler controllers were removed from startup,
simplifying controller initialization.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-01-09 14:54:01 +01:00
..
2025-10-06 20:18:29 +00:00
2024-08-12 14:47:11 +02:00
2024-07-16 17:31:52 +02:00
2025-09-24 12:32:37 +02:00

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).

How to restore backup from S3

  1. Find the snapshot:

    restic -r s3:s3.example.org/clickhouse-backups/table_name snapshots
    
  2. Restore it:

    restic -r s3:s3.example.org/clickhouse-backups/table_name restore latest --target /tmp/
    

For more details, read Restic: Effective Backup from Stdin.

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 small
size Persistent Volume Claim size available for application data. quantity 10Gi
storageClass StorageClass used to store the data. string ""

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 regular backups (default: false). bool false
backup.s3Region AWS S3 region where backups are stored. string us-east-1
backup.s3Bucket S3 bucket used for storing backups. string s3.example.org/clickhouse-backups
backup.schedule Cron schedule for automated backups. string 0 2 * * *
backup.cleanupStrategy Retention strategy for cleaning up old backups. string --keep-last=3 --keep-daily=3 --keep-within-weekly=1m
backup.s3AccessKey Access key for S3 authentication. string <your-access-key>
backup.s3SecretKey Secret key for S3 authentication. string <your-secret-key>
backup.resticPassword Password for Restic backup encryption. string <password>

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 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. When left empty, the preset defined in resourcesPreset is applied.

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