[clickhouse] add clickhouse keeper (#1320)

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does


### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
- update ch operator
- add chk
```

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

## Summary by CodeRabbit

* **New Features**
* Added configurable parameter to set the number of ClickHouse Keeper
replicas, with a default of 3.
* Replica count for ClickHouse Keeper and related resources can now be
adjusted via configuration.

* **Documentation**
* Updated documentation to describe the new `clickhouseKeeper.replicas`
parameter and its usage.
  * Removed an outdated command from setup instructions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
klinch0
2025-08-07 14:26:11 +03:00
committed by GitHub
8 changed files with 21 additions and 5 deletions

View File

@@ -4,6 +4,5 @@
cd packages/core/installer
make image-cozystack REGISTRY=YOUR_CUSTOM_REGISTRY
make apply
kubectl delete pod dashboard-redis-master-0 -n cozy-dashboard
kubectl delete po -l app=source-controller -n cozy-fluxcd
```

View File

@@ -60,6 +60,7 @@ For more details, read [Restic: Effective Backup from Stdin](https://blog.aenix.
| `clickhouseKeeper.enabled` | Deploy ClickHouse Keeper for cluster coordination | `true` |
| `clickhouseKeeper.size` | Persistent Volume Claim size, available for application data | `1Gi` |
| `clickhouseKeeper.resourcesPreset` | Default sizing preset used when `resources` is omitted. Allowed values: nano, micro, small, medium, large, xlarge, 2xlarge. | `micro` |
| `clickhouseKeeper.replicas` | Number of keeper replicas | `3` |
## Parameter examples and reference

View File

@@ -15,7 +15,7 @@ spec:
clusters:
- name: "cluster1"
layout:
replicasCount: 3
replicasCount: {{ .Values.clickhouseKeeper.replicas }}
settings:
logger/level: "trace"
logger/console: "true"

View File

@@ -94,8 +94,14 @@ spec:
{{- if .Values.clickhouseKeeper.enabled }}
zookeeper:
nodes:
- host: "keeper-{{ .Release.Name }}-keeper.{{ .Release.Namespace }}.svc.{{ $clusterDomain }}"
{{- $replicas := int .Values.clickhouseKeeper.replicas }}
{{- $release := .Release.Name }}
{{- $namespace := .Release.Namespace }}
{{- $clusterDomain := .Values.clusterDomain }}
{{- range $i := until $replicas }}
- host: "chk-{{ $release }}-keeper-cluster1-0-{{ $i }}.{{ $namespace }}.svc.{{ $clusterDomain }}"
port: 2181
{{- end }}
{{- end }}
templates:
volumeClaimTemplates:

View File

@@ -23,6 +23,9 @@ rules:
- workloadmonitors
resourceNames:
- {{ .Release.Name }}
{{- if .Values.clickhouseKeeper.enabled }}
- {{ .Release.Name }}-keeper
{{- end }}
verbs: ["get", "list", "watch"]
---
kind: RoleBinding

View File

@@ -18,8 +18,8 @@ kind: WorkloadMonitor
metadata:
name: {{ $.Release.Name }}-keeper
spec:
replicas: 3
minReplicas: 3
replicas: {{ .Values.clickhouseKeeper.replicas }}
minReplicas: 1
kind: clickhouse
type: clickhouse
selector:

View File

@@ -52,6 +52,11 @@
"description": "Deploy ClickHouse Keeper for cluster coordination ",
"type": "boolean"
},
"replicas": {
"default": 3,
"description": "Number of keeper replicas",
"type": "number"
},
"resourcesPreset": {
"default": "micro",
"description": "Default sizing preset used when `resources` is omitted. Allowed values: nano, micro, small, medium, large, xlarge, 2xlarge.",

View File

@@ -60,7 +60,9 @@ backup:
## @param clickhouseKeeper.enabled Deploy ClickHouse Keeper for cluster coordination
## @param clickhouseKeeper.size Persistent Volume Claim size, available for application data
## @param clickhouseKeeper.resourcesPreset Default sizing preset used when `resources` is omitted. Allowed values: nano, micro, small, medium, large, xlarge, 2xlarge.
## @param clickhouseKeeper.replicas Number of keeper replicas
clickhouseKeeper:
enabled: true
size: 1Gi
resourcesPreset: micro
replicas: 3