[clickhouse] add clickhouse keeper

Signed-off-by: kklinch0 <kklinch0@gmail.com>
This commit is contained in:
kklinch0
2025-08-07 14:07:02 +03:00
parent 2fa56fc1e1
commit 896209a004
44 changed files with 6999 additions and 4278 deletions

View File

@@ -27,6 +27,10 @@ spec:
s3AccessKey: oobaiRus9pah8PhohL1ThaeTa4UVa7gu
s3SecretKey: ju3eum4dekeich9ahM1te8waeGai0oog
resticPassword: ChaXoveekoh6eigh4siesheeda2quai0
clickhouseKeeper:
enabled: true
resourcesPreset: "micro"
size: "1Gi"
resources: {}
resourcesPreset: "nano"
EOF

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

@@ -16,7 +16,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.11.1
version: 0.12.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to

View File

@@ -7,6 +7,7 @@ include ../../../scripts/package.mk
generate:
readme-generator-for-helm -v values.yaml -s values.schema.json -r README.md
yq -i -o json --indent 4 '.properties.resourcesPreset.enum = $(PRESET_ENUM)' values.schema.json
yq -i -o json --indent 4 '.properties.clickhouseKeeper.resourcesPreset.enum = $(PRESET_ENUM)' values.schema.json
image:
docker buildx build images/clickhouse-backup \

View File

@@ -53,6 +53,15 @@ For more details, read [Restic: Effective Backup from Stdin](https://blog.aenix.
| `backup.s3SecretKey` | Secret key for S3, used for authentication | `ju3eum4dekeich9ahM1te8waeGai0oog` |
| `backup.resticPassword` | Password for Restic backup encryption | `ChaXoveekoh6eigh4siesheeda2quai0` |
### clickhouseKeeper parameters
| Name | Description | Value |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------- |
| `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
### resources and resourcesPreset

View File

@@ -0,0 +1,96 @@
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
{{- $clusterDomain := (index $cozyConfig.data "cluster-domain") | default "cozy.local" }}
{{- if .Values.clickhouseKeeper.enabled }}
apiVersion: "clickhouse-keeper.altinity.com/v1"
kind: "ClickHouseKeeperInstallation"
metadata:
name: "{{ .Release.Name }}-keeper"
annotations:
prometheus.io/port: "7000"
prometheus.io/scrape: "true"
spec:
namespaceDomainPattern: "%s.svc.{{ $clusterDomain }}"
configuration:
clusters:
- name: "cluster1"
layout:
replicasCount: {{ .Values.clickhouseKeeper.replicas }}
settings:
logger/level: "trace"
logger/console: "true"
listen_host: "0.0.0.0"
keeper_server/four_letter_word_white_list: "*"
keeper_server/coordination_settings/raft_logs_level: "information"
prometheus/endpoint: "/metrics"
prometheus/port: "7000"
prometheus/metrics: "true"
prometheus/events: "true"
prometheus/asynchronous_metrics: "true"
prometheus/status_info: "false"
defaults:
templates:
# Templates are specified as default for all clusters
podTemplate: default
dataVolumeClaimTemplate: default
templates:
podTemplates:
- name: default
metadata:
labels:
app: "{{ .Release.Name }}-keeper"
annotations:
prometheus.io/port: "7000"
prometheus.io/scrape: "true"
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- "{{ .Release.Name }}-keeper"
topologyKey: "kubernetes.io/hostname"
containers:
- name: clickhouse-keeper
imagePullPolicy: IfNotPresent
image: clickhouse/clickhouse-keeper:24.9.2.42
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.clickhouseKeeper.resourcesPreset .Values.resources $) | nindent 20 }}
securityContext:
fsGroup: 101
volumeClaimTemplates:
- name: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "{{ .Values.clickhouseKeeper.size }}"
---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMPodScrape
metadata:
name: {{ .Release.Name }}-keeper
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-keeper
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
- port: metrics
path: /metrics
interval: 30s
scheme: http
relabelConfigs:
- action: replace
sourceLabels: [__meta_kubernetes_pod_node_name]
targetLabel: instance
{{- end }}

View File

@@ -91,6 +91,18 @@ spec:
layout:
shardsCount: {{ .Values.shards }}
replicasCount: {{ .Values.replicas }}
{{- if .Values.clickhouseKeeper.enabled }}
zookeeper:
nodes:
{{- $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:
- name: data-volume-template

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

@@ -11,3 +11,18 @@ spec:
selector:
app.kubernetes.io/instance: {{ $.Release.Name }}
version: {{ $.Chart.Version }}
{{- if .Values.clickhouseKeeper.enabled }}
---
apiVersion: cozystack.io/v1alpha1
kind: WorkloadMonitor
metadata:
name: {{ $.Release.Name }}-keeper
spec:
replicas: {{ .Values.clickhouseKeeper.replicas }}
minReplicas: 1
kind: clickhouse
type: clickhouse
selector:
app: {{ $.Release.Name }}-keeper
version: {{ $.Chart.Version }}
{{- end }}

View File

@@ -45,6 +45,42 @@
},
"type": "object"
},
"clickhouseKeeper": {
"properties": {
"enabled": {
"default": true,
"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.",
"type": "string"
},
"size": {
"default": "1Gi",
"description": "Persistent Volume Claim size, available for application data",
"type": "string"
}
},
"type": "object",
"resourcesPreset": {
"enum": [
"nano",
"micro",
"small",
"medium",
"large",
"xlarge",
"2xlarge"
]
}
},
"logStorageSize": {
"default": "2Gi",
"description": "Size of Persistent Volume for logs",

View File

@@ -56,3 +56,13 @@ backup:
s3SecretKey: ju3eum4dekeich9ahM1te8waeGai0oog
resticPassword: ChaXoveekoh6eigh4siesheeda2quai0
## @section clickhouseKeeper parameters
## @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

View File

@@ -15,7 +15,8 @@ clickhouse 0.9.2 632224a3
clickhouse 0.10.0 6358fd7a
clickhouse 0.10.1 4369b031
clickhouse 0.11.0 08cb7c0f
clickhouse 0.11.1 HEAD
clickhouse 0.11.1 0e47e1e8
clickhouse 0.12.0 HEAD
ferretdb 0.1.0 e9716091
ferretdb 0.1.1 91b0499a
ferretdb 0.2.0 6c5cf5bf

View File

@@ -1,11 +1,12 @@
apiVersion: v2
appVersion: 0.23.4
appVersion: 0.25.2
description: 'Helm chart to deploy [altinity-clickhouse-operator](https://github.com/Altinity/clickhouse-operator). The
ClickHouse Operator creates, configures and manages ClickHouse clusters running
on Kubernetes. For upgrade please install CRDs separately: ```bash kubectl apply
-f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/crds/CustomResourceDefinition-clickhouseinstallations.clickhouse.altinity.com.yaml kubectl
apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/crds/CustomResourceDefinition-clickhouseinstallationtemplates.clickhouse.altinity.com.yaml kubectl
apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/crds/CustomResourceDefinition-clickhouseoperatorconfigurations.clickhouse.altinity.com.yaml
-f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/clickhouse-operator/crds/CustomResourceDefinition-clickhouseinstallations.clickhouse.altinity.com.yaml kubectl
apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/clickhouse-operator/crds/CustomResourceDefinition-clickhouseinstallationtemplates.clickhouse.altinity.com.yaml kubectl
apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/clickhouse-operator/crds/CustomResourceDefinition-clickhouseoperatorconfigurations.clickhouse.altinity.com.yaml kubectl
apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/clickhouse-operator/crds/CustomResourceDefinition-clickhousekeeperinstallations.clickhouse-keeper.altinity.com.yaml
```'
home: https://github.com/Altinity/clickhouse-operator
icon: https://logosandtypes.com/wp-content/uploads/2020/12/altinity.svg
@@ -14,4 +15,4 @@ maintainers:
name: altinity
name: altinity-clickhouse-operator
type: application
version: 0.23.4
version: 0.25.2

View File

@@ -1,6 +1,6 @@
# altinity-clickhouse-operator
![Version: 0.23.4](https://img.shields.io/badge/Version-0.23.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.23.4](https://img.shields.io/badge/AppVersion-0.23.4-informational?style=flat-square)
![Version: 0.25.2](https://img.shields.io/badge/Version-0.25.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.25.2](https://img.shields.io/badge/AppVersion-0.25.2-informational?style=flat-square)
Helm chart to deploy [altinity-clickhouse-operator](https://github.com/Altinity/clickhouse-operator).
@@ -8,9 +8,10 @@ The ClickHouse Operator creates, configures and manages ClickHouse clusters runn
For upgrade please install CRDs separately:
```bash
kubectl apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/crds/CustomResourceDefinition-clickhouseinstallations.clickhouse.altinity.com.yaml
kubectl apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/crds/CustomResourceDefinition-clickhouseinstallationtemplates.clickhouse.altinity.com.yaml
kubectl apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/crds/CustomResourceDefinition-clickhouseoperatorconfigurations.clickhouse.altinity.com.yaml
kubectl apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/clickhouse-operator/crds/CustomResourceDefinition-clickhouseinstallations.clickhouse.altinity.com.yaml
kubectl apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/clickhouse-operator/crds/CustomResourceDefinition-clickhouseinstallationtemplates.clickhouse.altinity.com.yaml
kubectl apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/clickhouse-operator/crds/CustomResourceDefinition-clickhouseoperatorconfigurations.clickhouse.altinity.com.yaml
kubectl apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/clickhouse-operator/crds/CustomResourceDefinition-clickhousekeeperinstallations.clickhouse-keeper.altinity.com.yaml
```
**Homepage:** <https://github.com/Altinity/clickhouse-operator>
@@ -25,34 +26,38 @@ For upgrade please install CRDs separately:
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalResources | list | `[]` | list of additional resources to create (are processed via `tpl` function), useful for create ClickHouse clusters together with clickhouse-operator, look `kubectl explain chi` for details |
| affinity | object | `{}` | affinity for scheduler pod assignment, look `kubectl explain pod.spec.affinity` for details |
| configs | object | check the values.yaml file for the config content, auto-generated from latest operator release | clickhouse-operator configs |
| additionalResources | list | `[]` | list of additional resources to create (processed via `tpl` function), useful for create ClickHouse clusters together with clickhouse-operator. check `kubectl explain chi` for details |
| affinity | object | `{}` | affinity for scheduler pod assignment, check `kubectl explain pod.spec.affinity` for details |
| commonAnnotations | object | `{}` | set of annotations that will be applied to all the resources for the operator |
| commonLabels | object | `{}` | set of labels that will be applied to all the resources for the operator |
| configs | object | check the `values.yaml` file for the config content (auto-generated from latest operator release) | clickhouse operator configs |
| dashboards.additionalLabels | object | `{"grafana_dashboard":""}` | labels to add to a secret with dashboards |
| dashboards.annotations | object | `{}` | annotations to add to a secret with dashboards |
| dashboards.enabled | bool | `false` | provision grafana dashboards as secrets (can be synced by grafana dashboards sidecar https://github.com/grafana/helm-charts/blob/grafana-6.33.1/charts/grafana/values.yaml#L679 ) |
| dashboards.enabled | bool | `false` | provision grafana dashboards as configMaps (can be synced by grafana dashboards sidecar https://github.com/grafana/helm-charts/blob/grafana-8.3.4/charts/grafana/values.yaml#L778 ) |
| dashboards.grafana_folder | string | `"clickhouse"` | |
| fullnameOverride | string | `""` | full name of the chart. |
| imagePullSecrets | list | `[]` | image pull secret for private images in clickhouse-operator pod possible value format [{"name":"your-secret-name"}] look `kubectl explain pod.spec.imagePullSecrets` for details |
| imagePullSecrets | list | `[]` | image pull secret for private images in clickhouse-operator pod possible value format `[{"name":"your-secret-name"}]`, check `kubectl explain pod.spec.imagePullSecrets` for details |
| metrics.containerSecurityContext | object | `{}` | |
| metrics.enabled | bool | `true` | |
| metrics.env | list | `[]` | additional environment variables for the deployment of metrics-exporter containers possible format value [{"name": "SAMPLE", "value": "text"}] |
| metrics.env | list | `[]` | additional environment variables for the deployment of metrics-exporter containers possible format value `[{"name": "SAMPLE", "value": "text"}]` |
| metrics.image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| metrics.image.repository | string | `"altinity/metrics-exporter"` | image repository |
| metrics.image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) |
| metrics.resources | object | `{}` | custom resource configuration |
| nameOverride | string | `""` | override name of the chart |
| nodeSelector | object | `{}` | node for scheduler pod assignment, look `kubectl explain pod.spec.nodeSelector` for details |
| namespaceOverride | string | `""` | |
| nodeSelector | object | `{}` | node for scheduler pod assignment, check `kubectl explain pod.spec.nodeSelector` for details |
| operator.containerSecurityContext | object | `{}` | |
| operator.env | list | `[]` | additional environment variables for the clickhouse-operator container in deployment possible format value [{"name": "SAMPLE", "value": "text"}] |
| operator.env | list | `[]` | additional environment variables for the clickhouse-operator container in deployment possible format value `[{"name": "SAMPLE", "value": "text"}]` |
| operator.image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| operator.image.repository | string | `"altinity/clickhouse-operator"` | image repository |
| operator.image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) |
| operator.resources | object | `{}` | custom resource configuration, look `kubectl explain pod.spec.containers.resources` for details |
| podAnnotations | object | `{"clickhouse-operator-metrics/port":"9999","clickhouse-operator-metrics/scrape":"true","prometheus.io/port":"8888","prometheus.io/scrape":"true"}` | annotations to add to the clickhouse-operator pod, look `kubectl explain pod.spec.annotations` for details |
| operator.resources | object | `{}` | custom resource configuration, check `kubectl explain pod.spec.containers.resources` for details |
| podAnnotations | object | check the `values.yaml` file | annotations to add to the clickhouse-operator pod, check `kubectl explain pod.spec.annotations` for details |
| podLabels | object | `{}` | labels to add to the clickhouse-operator pod |
| podSecurityContext | object | `{}` | |
| rbac.create | bool | `true` | specifies whether cluster roles and cluster role bindings should be created |
| rbac.create | bool | `true` | specifies whether rbac resources should be created |
| rbac.namespaceScoped | bool | `false` | specifies whether to create roles and rolebindings at the cluster level or namespace level |
| secret.create | bool | `true` | create a secret with operator credentials |
| secret.password | string | `"clickhouse_operator_password"` | operator credentials password |
| secret.username | string | `"clickhouse_operator"` | operator credentials username |
@@ -60,6 +65,15 @@ For upgrade please install CRDs separately:
| serviceAccount.create | bool | `true` | specifies whether a service account should be created |
| serviceAccount.name | string | `nil` | the name of the service account to use; if not set and create is true, a name is generated using the fullname template |
| serviceMonitor.additionalLabels | object | `{}` | additional labels for service monitor |
| serviceMonitor.enabled | bool | `false` | ServiceMonitor Custom resource is created for a (prometheus-operator)[https://github.com/prometheus-operator/prometheus-operator] |
| tolerations | list | `[]` | tolerations for scheduler pod assignment, look `kubectl explain pod.spec.tolerations` for details |
| serviceMonitor.clickhouseMetrics.interval | string | `"30s"` | |
| serviceMonitor.clickhouseMetrics.metricRelabelings | list | `[]` | |
| serviceMonitor.clickhouseMetrics.relabelings | list | `[]` | |
| serviceMonitor.clickhouseMetrics.scrapeTimeout | string | `""` | |
| serviceMonitor.enabled | bool | `false` | ServiceMonitor Custom resource is created for a [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator) In serviceMonitor will be created two endpoints clickhouse-metrics on port 8888 and operator-metrics # 9999. Ypu can specify interval, scrapeTimeout, relabelings, metricRelabelings for each endpoint below |
| serviceMonitor.operatorMetrics.interval | string | `"30s"` | |
| serviceMonitor.operatorMetrics.metricRelabelings | list | `[]` | |
| serviceMonitor.operatorMetrics.relabelings | list | `[]` | |
| serviceMonitor.operatorMetrics.scrapeTimeout | string | `""` | |
| tolerations | list | `[]` | tolerations for scheduler pod assignment, check `kubectl explain pod.spec.tolerations` for details |
| topologySpreadConstraints | list | `[]` | |

View File

@@ -0,0 +1,17 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}
{{ template "chart.badgesSection" . }}
{{ template "chart.description" . }}
{{ template "chart.homepageLine" . }}
{{ template "chart.maintainersSection" . }}
{{ template "chart.sourcesSection" . }}
{{ template "chart.requirementsSection" . }}
{{ template "chart.valuesSection" . }}

View File

@@ -4,14 +4,14 @@
# SINGULAR=clickhouseinstallation
# PLURAL=clickhouseinstallations
# SHORT=chi
# OPERATOR_VERSION=0.23.4
# OPERATOR_VERSION=0.25.2
#
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clickhouseinstallations.clickhouse.altinity.com
labels:
clickhouse.altinity.com/chop: 0.23.4
clickhouse.altinity.com/chop: 0.25.2
spec:
group: clickhouse.altinity.com
scope: Namespaced
@@ -51,13 +51,12 @@ spec:
jsonPath: .status.taskID
- name: status
type: string
description: CHI status
description: Resource status
jsonPath: .status.status
- name: hosts-unchanged
- name: hosts-completed
type: integer
description: Unchanged hosts count
priority: 1 # show in wide view
jsonPath: .status.hostsUnchanged
description: Completed hosts count
jsonPath: .status.hostsCompleted
- name: hosts-updated
type: integer
description: Updated hosts count
@@ -68,20 +67,11 @@ spec:
description: Added hosts count
priority: 1 # show in wide view
jsonPath: .status.hostsAdded
- name: hosts-completed
type: integer
description: Completed hosts count
jsonPath: .status.hostsCompleted
- name: hosts-deleted
type: integer
description: Hosts deleted count
priority: 1 # show in wide view
jsonPath: .status.hostsDeleted
- name: hosts-delete
type: integer
description: Hosts to be deleted count
priority: 1 # show in wide view
jsonPath: .status.hostsDelete
- name: endpoint
type: string
description: Client access endpoint
@@ -92,39 +82,51 @@ spec:
description: Age of the resource
# Displayed in all priorities
jsonPath: .metadata.creationTimestamp
- name: suspend
type: string
description: Suspend reconciliation
# Displayed in all priorities
jsonPath: .spec.suspend
subresources:
status: {}
schema:
openAPIV3Schema:
description: "define a set of Kubernetes resources (StatefulSet, PVC, Service, ConfigMap) which describe behavior one or more ClickHouse clusters"
description: "define a set of Kubernetes resources (StatefulSet, PVC, Service, ConfigMap) which describe behavior one or more clusters"
type: object
required:
- spec
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |
APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |
Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
status:
type: object
description: "Current ClickHouseInstallation manifest status, contains many fields like a normalized configuration, clickhouse-operator version, current action and all applied action list, current taskID and all applied taskIDs and other"
description: |
Status contains many fields like a normalized configuration, clickhouse-operator version, current action and all applied action list, current taskID and all applied taskIDs and other
properties:
chop-version:
type: string
description: "ClickHouse operator version"
description: "Operator version"
chop-commit:
type: string
description: "ClickHouse operator git commit SHA"
description: "Operator git commit SHA"
chop-date:
type: string
description: "ClickHouse operator build date"
description: "Operator build date"
chop-ip:
type: string
description: "IP address of the operator's pod which managed this CHI"
description: "IP address of the operator's pod which managed this resource"
clusters:
type: integer
minimum: 0
@@ -222,17 +224,23 @@ spec:
endpoint:
type: string
description: "Endpoint"
endpoints:
type: array
description: "All endpoints"
nullable: true
items:
type: string
generation:
type: integer
minimum: 0
description: "Generation"
normalized:
type: object
description: "Normalized CHI requested"
description: "Normalized resource requested"
x-kubernetes-preserve-unknown-fields: true
normalizedCompleted:
type: object
description: "Normalized CHI completed"
description: "Normalized resource completed"
x-kubernetes-preserve-unknown-fields: true
hostsWithTablesCreated:
type: array
@@ -240,6 +248,12 @@ spec:
nullable: true
items:
type: string
hostsWithReplicaCaughtUp:
type: array
description: "List of hosts with replica caught up"
nullable: true
items:
type: string
usedTemplates:
type: array
description: "List of templates used to build this CHI"
@@ -301,6 +315,13 @@ spec:
enum:
- ""
- "RollingUpdate"
suspend:
!!merge <<: *TypeStringBool
description: |
Suspend reconciliation of resources managed by a ClickHouse Installation.
Works as the following:
- When `suspend` is `true` operator stops reconciling all resources.
- When `suspend` is `false` or not set, operator reconciles all resources.
troubleshoot:
!!merge <<: *TypeStringBool
description: |
@@ -412,6 +433,63 @@ spec:
service:
!!merge <<: *TypeObjectsCleanup
description: "Behavior policy for failed Service, `Retain` by default"
runtime:
type: object
description: "runtime parameters for clickhouse-operator process which are used during reconcile cycle"
properties:
reconcileShardsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile shards of a cluster in parallel, 1 by default"
reconcileShardsMaxConcurrencyPercent:
type: integer
minimum: 0
maximum: 100
description: "The maximum percentage of cluster shards that may be reconciled in parallel, 50 percent by default."
macros:
type: object
description: "macros parameters"
properties:
sections:
type: object
description: "sections behaviour for macros"
properties:
users:
type: object
description: "sections behaviour for macros on users"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
profiles:
type: object
description: "sections behaviour for macros on profiles"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
quotas:
type: object
description: "sections behaviour for macros on quotas"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
settings:
type: object
description: "sections behaviour for macros on settings"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
files:
type: object
description: "sections behaviour for macros on files"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
defaults:
type: object
description: |
@@ -424,7 +502,7 @@ spec:
description: |
define should replicas be specified by FQDN in `<host></host>`.
In case of "no" will use short hostname and clickhouse-server will use kubernetes default suffixes for DNS lookup
"yes" by default
"no" by default
distributedDDL:
type: object
description: |
@@ -474,7 +552,13 @@ spec:
description: "optional, template name from chi.spec.templates.volumeClaimTemplates, allows customization each `PVC` which will mount for clickhouse log directory in each `Pod` during render and reconcile every StatefulSet.spec resource described in `chi.spec.configuration.clusters`"
serviceTemplate:
type: string
description: "optional, template name from chi.spec.templates.serviceTemplates, allows customization for one `Service` resource which will created by `clickhouse-operator` which cover all clusters in whole `chi` resource"
description: "optional, template name from chi.spec.templates.serviceTemplates. used for customization of the `Service` resource, created by `clickhouse-operator` to cover all clusters in whole `chi` resource"
serviceTemplates:
type: array
description: "optional, template names from chi.spec.templates.serviceTemplates. used for customization of the `Service` resources, created by `clickhouse-operator` to cover all clusters in whole `chi` resource"
nullable: true
items:
type: string
clusterServiceTemplate:
type: string
description: "optional, template name from chi.spec.templates.serviceTemplates, allows customization for each `Service` resource which will created by `clickhouse-operator` which cover each clickhouse cluster described in `chi.spec.configuration.clusters`"
@@ -486,7 +570,7 @@ spec:
description: "optional, template name from chi.spec.templates.serviceTemplates, allows customization for each `Service` resource which will created by `clickhouse-operator` which cover each replica inside each shard inside each clickhouse cluster described in `chi.spec.configuration.clusters`"
volumeClaimTemplate:
type: string
description: "DEPRECATED! VolumeClaimTemplate is deprecated in favor of DataVolumeClaimTemplate and LogVolumeClaimTemplate"
description: "optional, alias for dataVolumeClaimTemplate, template name from chi.spec.templates.volumeClaimTemplates, allows customization each `PVC` which will mount for clickhouse data directory in each `Pod` during render and reconcile every StatefulSet.spec resource described in `chi.spec.configuration.clusters`"
configuration:
type: object
description: "allows configure multiple aspects and behavior for `clickhouse-server` instance and also allows describe multiple `clickhouse-server` clusters inside one `chi` resource"
@@ -521,6 +605,9 @@ spec:
secure:
!!merge <<: *TypeStringBool
description: "if a secure connection to Zookeeper is required"
availabilityZone:
type: string
description: "availability zone for Zookeeper node"
session_timeout_ms:
type: integer
description: "session timeout during connect to Zookeeper"
@@ -540,6 +627,20 @@ spec:
you can configure password hashed, authorization restrictions, database level security row filters etc.
More details: https://clickhouse.tech/docs/en/operations/settings/settings-users/
Your yaml code will convert to XML, see examples https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#specconfigurationusers
any key could contains `valueFrom` with `secretKeyRef` which allow pass password from kubernetes secrets
secret value will pass in `pod.spec.containers.evn`, and generate with from_env=XXX in XML in /etc/clickhouse-server/users.d/chop-generated-users.xml
it not allow automatically updates when updates `secret`, change spec.taskID for manually trigger reconcile cycle
look into https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-01-overview.yaml for examples
any key with prefix `k8s_secret_` shall has value with format namespace/secret/key or secret/key
in this case value from secret will write directly into XML tag during render *-usersd ConfigMap
any key with prefix `k8s_secret_env` shall has value with format namespace/secret/key or secret/key
in this case value from secret will write into environment variable and write to XML tag via from_env=XXX
look into https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-01-overview.yaml for examples
# nullable: true
x-kubernetes-preserve-unknown-fields: true
profiles:
@@ -566,6 +667,12 @@ spec:
allows configure `clickhouse-server` settings inside <yandex>...</yandex> tag in each `Pod` during generate `ConfigMap` which will mount in `/etc/clickhouse-server/config.d/`
More details: https://clickhouse.tech/docs/en/operations/settings/settings/
Your yaml code will convert to XML, see examples https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#specconfigurationsettings
any key could contains `valueFrom` with `secretKeyRef` which allow pass password from kubernetes secrets
look into https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-01-overview.yaml for examples
secret value will pass in `pod.spec.env`, and generate with from_env=XXX in XML in /etc/clickhouse-server/config.d/chop-generated-settings.xml
it not allow automatically updates when updates `secret`, change spec.taskID for manually trigger reconcile cycle
# nullable: true
x-kubernetes-preserve-unknown-fields: true
files: &TypeFiles
@@ -575,14 +682,20 @@ spec:
every key in this object is the file name
every value in this object is the file content
you can use `!!binary |` and base64 for binary files, see details here https://yaml.org/type/binary.html
each key could contains prefix like USERS, COMMON, HOST or config.d, users.d, cond.d, wrong prefixes will ignored, subfolders also will ignored
each key could contains prefix like {common}, {users}, {hosts} or config.d, users.d, conf.d, wrong prefixes will be ignored, subfolders also will be ignored
More details: https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-05-files-nested.yaml
any key could contains `valueFrom` with `secretKeyRef` which allow pass values from kubernetes secrets
secrets will mounted into pod as separate volume in /etc/clickhouse-server/secrets.d/
and will automatically update when update secret
it useful for pass SSL certificates from cert-manager or similar tool
look into https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-01-overview.yaml for examples
# nullable: true
x-kubernetes-preserve-unknown-fields: true
clusters:
type: array
description: |
describes ClickHouse clusters layout and allows change settings on cluster-level, shard-level and replica-level
describes clusters layout and allows change settings on cluster-level, shard-level and replica-level
every cluster is a set of StatefulSet, one StatefulSet contains only one Pod with `clickhouse-server`
all Pods will rendered in <remote_server> part of ClickHouse configs, mounted from ConfigMap as `/etc/clickhouse-server/config.d/chop-generated-remote_servers.xml`
Clusters will use for Distributed table engine, more details: https://clickhouse.tech/docs/en/engines/table-engines/special/distributed/
@@ -595,7 +708,7 @@ spec:
properties:
name:
type: string
description: "cluster name, used to identify set of ClickHouse servers and wide used during generate names of related Kubernetes resources"
description: "cluster name, used to identify set of servers and wide used during generate names of related Kubernetes resources"
minLength: 1
# See namePartClusterMaxLen const
maxLength: 15
@@ -683,6 +796,32 @@ spec:
required:
- name
- key
pdbMaxUnavailable:
type: integer
description: |
Pod eviction is allowed if at most "pdbMaxUnavailable" pods are unavailable after the eviction,
i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions
by specifying 0. This is a mutually exclusive setting with "minAvailable".
minimum: 0
maximum: 65535
reconcile:
type: object
description: "allow tuning reconciling process"
properties:
runtime:
type: object
description: "runtime parameters for clickhouse-operator process which are used during reconcile cycle"
properties:
reconcileShardsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile shards of a cluster in parallel, 1 by default"
reconcileShardsMaxConcurrencyPercent:
type: integer
minimum: 0
maximum: 100
description: "The maximum percentage of cluster shards that may be reconciled in parallel, 50 percent by default."
layout:
type: object
description: |
@@ -690,18 +829,24 @@ spec:
allows override settings on each shard and replica separatelly
# nullable: true
properties:
type:
type: string
description: "DEPRECATED - to be removed soon"
shardsCount:
type: integer
description: "how much shards for current ClickHouse cluster will run in Kubernetes, each shard contains shared-nothing part of data and contains set of replicas, cluster contains 1 shard by default"
description: |
how much shards for current ClickHouse cluster will run in Kubernetes,
each shard contains shared-nothing part of data and contains set of replicas,
cluster contains 1 shard by default"
replicasCount:
type: integer
description: "how much replicas in each shards for current ClickHouse cluster will run in Kubernetes, each replica is a separate `StatefulSet` which contains only one `Pod` with `clickhouse-server` instance, every shard contains 1 replica by default"
description: |
how much replicas in each shards for current cluster will run in Kubernetes,
each replica is a separate `StatefulSet` which contains only one `Pod` with `clickhouse-server` instance,
every shard contains 1 replica by default"
shards:
type: array
description: "optional, allows override top-level `chi.spec.configuration`, cluster-level `chi.spec.configuration.clusters` settings for each shard separately, use it only if you fully understand what you do"
description: |
optional, allows override top-level `chi.spec.configuration`, cluster-level
`chi.spec.configuration.clusters` settings for each shard separately,
use it only if you fully understand what you do"
# nullable: true
items:
type: object
@@ -1036,7 +1181,7 @@ spec:
description: "template name, could use to link inside top-level `chi.spec.defaults.templates.podTemplate`, cluster-level `chi.spec.configuration.clusters.templates.podTemplate`, shard-level `chi.spec.configuration.clusters.layout.shards.temlates.podTemplate`, replica-level `chi.spec.configuration.clusters.layout.replicas.templates.podTemplate`"
generateName:
type: string
description: "allows define format for generated `Pod` name, look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates for details about aviailable template variables"
description: "allows define format for generated `Pod` name, look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates for details about available template variables"
zone:
type: object
description: "allows define custom zone name and will separate ClickHouse `Pods` between nodes, shortcut for `chi.spec.templates.podTemplates.spec.affinity.podAntiAffinity`"
@@ -1108,7 +1253,9 @@ spec:
maximum: 65535
topologyKey:
type: string
description: "use for inter-pod affinity look to `pod.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.topologyKey`, More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity"
description: |
use for inter-pod affinity look to `pod.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.topologyKey`,
more info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity"
metadata:
type: object
description: |
@@ -1124,7 +1271,8 @@ spec:
x-kubernetes-preserve-unknown-fields: true
volumeClaimTemplates:
type: array
description: "allows define template for rendering `PVC` kubernetes resource, which would use inside `Pod` for mount clickhouse `data`, clickhouse `logs` or something else"
description: |
allows define template for rendering `PVC` kubernetes resource, which would use inside `Pod` for mount clickhouse `data`, clickhouse `logs` or something else
# nullable: true
items:
type: object
@@ -1177,14 +1325,17 @@ spec:
replica-level `chi.spec.configuration.clusters.layout.replicas.templates.replicaServiceTemplate` or `chi.spec.configuration.clusters.layout.shards.replicas.replicaServiceTemplate`
generateName:
type: string
description: "allows define format for generated `Service` name, look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates for details about aviailable template variables"
description: |
allows define format for generated `Service` name,
look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates
for details about available template variables"
metadata:
# TODO specify ObjectMeta
type: object
description: |
allows pass standard object's metadata from template to Service
Could be use for define specificly for Cloud Provider metadata which impact to behavior of service
More info: https://kubernetes.io/docs/concepts/services-networking/service/
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
# nullable: true
x-kubernetes-preserve-unknown-fields: true
spec:
@@ -1197,7 +1348,9 @@ spec:
x-kubernetes-preserve-unknown-fields: true
useTemplates:
type: array
description: "list of `ClickHouseInstallationTemplate` (chit) resource names which will merge with current `Chi` manifest during render Kubernetes resources to create related ClickHouse clusters"
description: |
list of `ClickHouseInstallationTemplate` (chit) resource names which will merge with current `CHI`
manifest during render Kubernetes resources to create related ClickHouse clusters"
# nullable: true
items:
type: object

View File

@@ -4,14 +4,14 @@
# SINGULAR=clickhouseinstallationtemplate
# PLURAL=clickhouseinstallationtemplates
# SHORT=chit
# OPERATOR_VERSION=0.23.4
# OPERATOR_VERSION=0.25.2
#
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clickhouseinstallationtemplates.clickhouse.altinity.com
labels:
clickhouse.altinity.com/chop: 0.23.4
clickhouse.altinity.com/chop: 0.25.2
spec:
group: clickhouse.altinity.com
scope: Namespaced
@@ -51,13 +51,12 @@ spec:
jsonPath: .status.taskID
- name: status
type: string
description: CHI status
description: Resource status
jsonPath: .status.status
- name: hosts-unchanged
- name: hosts-completed
type: integer
description: Unchanged hosts count
priority: 1 # show in wide view
jsonPath: .status.hostsUnchanged
description: Completed hosts count
jsonPath: .status.hostsCompleted
- name: hosts-updated
type: integer
description: Updated hosts count
@@ -68,20 +67,11 @@ spec:
description: Added hosts count
priority: 1 # show in wide view
jsonPath: .status.hostsAdded
- name: hosts-completed
type: integer
description: Completed hosts count
jsonPath: .status.hostsCompleted
- name: hosts-deleted
type: integer
description: Hosts deleted count
priority: 1 # show in wide view
jsonPath: .status.hostsDeleted
- name: hosts-delete
type: integer
description: Hosts to be deleted count
priority: 1 # show in wide view
jsonPath: .status.hostsDelete
- name: endpoint
type: string
description: Client access endpoint
@@ -92,39 +82,51 @@ spec:
description: Age of the resource
# Displayed in all priorities
jsonPath: .metadata.creationTimestamp
- name: suspend
type: string
description: Suspend reconciliation
# Displayed in all priorities
jsonPath: .spec.suspend
subresources:
status: {}
schema:
openAPIV3Schema:
description: "define a set of Kubernetes resources (StatefulSet, PVC, Service, ConfigMap) which describe behavior one or more ClickHouse clusters"
description: "define a set of Kubernetes resources (StatefulSet, PVC, Service, ConfigMap) which describe behavior one or more clusters"
type: object
required:
- spec
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |
APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |
Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
status:
type: object
description: "Current ClickHouseInstallation manifest status, contains many fields like a normalized configuration, clickhouse-operator version, current action and all applied action list, current taskID and all applied taskIDs and other"
description: |
Status contains many fields like a normalized configuration, clickhouse-operator version, current action and all applied action list, current taskID and all applied taskIDs and other
properties:
chop-version:
type: string
description: "ClickHouse operator version"
description: "Operator version"
chop-commit:
type: string
description: "ClickHouse operator git commit SHA"
description: "Operator git commit SHA"
chop-date:
type: string
description: "ClickHouse operator build date"
description: "Operator build date"
chop-ip:
type: string
description: "IP address of the operator's pod which managed this CHI"
description: "IP address of the operator's pod which managed this resource"
clusters:
type: integer
minimum: 0
@@ -222,17 +224,23 @@ spec:
endpoint:
type: string
description: "Endpoint"
endpoints:
type: array
description: "All endpoints"
nullable: true
items:
type: string
generation:
type: integer
minimum: 0
description: "Generation"
normalized:
type: object
description: "Normalized CHI requested"
description: "Normalized resource requested"
x-kubernetes-preserve-unknown-fields: true
normalizedCompleted:
type: object
description: "Normalized CHI completed"
description: "Normalized resource completed"
x-kubernetes-preserve-unknown-fields: true
hostsWithTablesCreated:
type: array
@@ -240,6 +248,12 @@ spec:
nullable: true
items:
type: string
hostsWithReplicaCaughtUp:
type: array
description: "List of hosts with replica caught up"
nullable: true
items:
type: string
usedTemplates:
type: array
description: "List of templates used to build this CHI"
@@ -301,6 +315,13 @@ spec:
enum:
- ""
- "RollingUpdate"
suspend:
!!merge <<: *TypeStringBool
description: |
Suspend reconciliation of resources managed by a ClickHouse Installation.
Works as the following:
- When `suspend` is `true` operator stops reconciling all resources.
- When `suspend` is `false` or not set, operator reconciles all resources.
troubleshoot:
!!merge <<: *TypeStringBool
description: |
@@ -412,6 +433,63 @@ spec:
service:
!!merge <<: *TypeObjectsCleanup
description: "Behavior policy for failed Service, `Retain` by default"
runtime:
type: object
description: "runtime parameters for clickhouse-operator process which are used during reconcile cycle"
properties:
reconcileShardsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile shards of a cluster in parallel, 1 by default"
reconcileShardsMaxConcurrencyPercent:
type: integer
minimum: 0
maximum: 100
description: "The maximum percentage of cluster shards that may be reconciled in parallel, 50 percent by default."
macros:
type: object
description: "macros parameters"
properties:
sections:
type: object
description: "sections behaviour for macros"
properties:
users:
type: object
description: "sections behaviour for macros on users"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
profiles:
type: object
description: "sections behaviour for macros on profiles"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
quotas:
type: object
description: "sections behaviour for macros on quotas"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
settings:
type: object
description: "sections behaviour for macros on settings"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
files:
type: object
description: "sections behaviour for macros on files"
properties:
enabled:
!!merge <<: *TypeStringBool
description: "enabled or not"
defaults:
type: object
description: |
@@ -424,7 +502,7 @@ spec:
description: |
define should replicas be specified by FQDN in `<host></host>`.
In case of "no" will use short hostname and clickhouse-server will use kubernetes default suffixes for DNS lookup
"yes" by default
"no" by default
distributedDDL:
type: object
description: |
@@ -474,7 +552,13 @@ spec:
description: "optional, template name from chi.spec.templates.volumeClaimTemplates, allows customization each `PVC` which will mount for clickhouse log directory in each `Pod` during render and reconcile every StatefulSet.spec resource described in `chi.spec.configuration.clusters`"
serviceTemplate:
type: string
description: "optional, template name from chi.spec.templates.serviceTemplates, allows customization for one `Service` resource which will created by `clickhouse-operator` which cover all clusters in whole `chi` resource"
description: "optional, template name from chi.spec.templates.serviceTemplates. used for customization of the `Service` resource, created by `clickhouse-operator` to cover all clusters in whole `chi` resource"
serviceTemplates:
type: array
description: "optional, template names from chi.spec.templates.serviceTemplates. used for customization of the `Service` resources, created by `clickhouse-operator` to cover all clusters in whole `chi` resource"
nullable: true
items:
type: string
clusterServiceTemplate:
type: string
description: "optional, template name from chi.spec.templates.serviceTemplates, allows customization for each `Service` resource which will created by `clickhouse-operator` which cover each clickhouse cluster described in `chi.spec.configuration.clusters`"
@@ -486,7 +570,7 @@ spec:
description: "optional, template name from chi.spec.templates.serviceTemplates, allows customization for each `Service` resource which will created by `clickhouse-operator` which cover each replica inside each shard inside each clickhouse cluster described in `chi.spec.configuration.clusters`"
volumeClaimTemplate:
type: string
description: "DEPRECATED! VolumeClaimTemplate is deprecated in favor of DataVolumeClaimTemplate and LogVolumeClaimTemplate"
description: "optional, alias for dataVolumeClaimTemplate, template name from chi.spec.templates.volumeClaimTemplates, allows customization each `PVC` which will mount for clickhouse data directory in each `Pod` during render and reconcile every StatefulSet.spec resource described in `chi.spec.configuration.clusters`"
configuration:
type: object
description: "allows configure multiple aspects and behavior for `clickhouse-server` instance and also allows describe multiple `clickhouse-server` clusters inside one `chi` resource"
@@ -521,6 +605,9 @@ spec:
secure:
!!merge <<: *TypeStringBool
description: "if a secure connection to Zookeeper is required"
availabilityZone:
type: string
description: "availability zone for Zookeeper node"
session_timeout_ms:
type: integer
description: "session timeout during connect to Zookeeper"
@@ -540,6 +627,20 @@ spec:
you can configure password hashed, authorization restrictions, database level security row filters etc.
More details: https://clickhouse.tech/docs/en/operations/settings/settings-users/
Your yaml code will convert to XML, see examples https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#specconfigurationusers
any key could contains `valueFrom` with `secretKeyRef` which allow pass password from kubernetes secrets
secret value will pass in `pod.spec.containers.evn`, and generate with from_env=XXX in XML in /etc/clickhouse-server/users.d/chop-generated-users.xml
it not allow automatically updates when updates `secret`, change spec.taskID for manually trigger reconcile cycle
look into https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-01-overview.yaml for examples
any key with prefix `k8s_secret_` shall has value with format namespace/secret/key or secret/key
in this case value from secret will write directly into XML tag during render *-usersd ConfigMap
any key with prefix `k8s_secret_env` shall has value with format namespace/secret/key or secret/key
in this case value from secret will write into environment variable and write to XML tag via from_env=XXX
look into https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-01-overview.yaml for examples
# nullable: true
x-kubernetes-preserve-unknown-fields: true
profiles:
@@ -566,6 +667,12 @@ spec:
allows configure `clickhouse-server` settings inside <yandex>...</yandex> tag in each `Pod` during generate `ConfigMap` which will mount in `/etc/clickhouse-server/config.d/`
More details: https://clickhouse.tech/docs/en/operations/settings/settings/
Your yaml code will convert to XML, see examples https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#specconfigurationsettings
any key could contains `valueFrom` with `secretKeyRef` which allow pass password from kubernetes secrets
look into https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-01-overview.yaml for examples
secret value will pass in `pod.spec.env`, and generate with from_env=XXX in XML in /etc/clickhouse-server/config.d/chop-generated-settings.xml
it not allow automatically updates when updates `secret`, change spec.taskID for manually trigger reconcile cycle
# nullable: true
x-kubernetes-preserve-unknown-fields: true
files: &TypeFiles
@@ -575,14 +682,20 @@ spec:
every key in this object is the file name
every value in this object is the file content
you can use `!!binary |` and base64 for binary files, see details here https://yaml.org/type/binary.html
each key could contains prefix like USERS, COMMON, HOST or config.d, users.d, cond.d, wrong prefixes will ignored, subfolders also will ignored
each key could contains prefix like {common}, {users}, {hosts} or config.d, users.d, conf.d, wrong prefixes will be ignored, subfolders also will be ignored
More details: https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-05-files-nested.yaml
any key could contains `valueFrom` with `secretKeyRef` which allow pass values from kubernetes secrets
secrets will mounted into pod as separate volume in /etc/clickhouse-server/secrets.d/
and will automatically update when update secret
it useful for pass SSL certificates from cert-manager or similar tool
look into https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/05-settings-01-overview.yaml for examples
# nullable: true
x-kubernetes-preserve-unknown-fields: true
clusters:
type: array
description: |
describes ClickHouse clusters layout and allows change settings on cluster-level, shard-level and replica-level
describes clusters layout and allows change settings on cluster-level, shard-level and replica-level
every cluster is a set of StatefulSet, one StatefulSet contains only one Pod with `clickhouse-server`
all Pods will rendered in <remote_server> part of ClickHouse configs, mounted from ConfigMap as `/etc/clickhouse-server/config.d/chop-generated-remote_servers.xml`
Clusters will use for Distributed table engine, more details: https://clickhouse.tech/docs/en/engines/table-engines/special/distributed/
@@ -595,7 +708,7 @@ spec:
properties:
name:
type: string
description: "cluster name, used to identify set of ClickHouse servers and wide used during generate names of related Kubernetes resources"
description: "cluster name, used to identify set of servers and wide used during generate names of related Kubernetes resources"
minLength: 1
# See namePartClusterMaxLen const
maxLength: 15
@@ -683,6 +796,32 @@ spec:
required:
- name
- key
pdbMaxUnavailable:
type: integer
description: |
Pod eviction is allowed if at most "pdbMaxUnavailable" pods are unavailable after the eviction,
i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions
by specifying 0. This is a mutually exclusive setting with "minAvailable".
minimum: 0
maximum: 65535
reconcile:
type: object
description: "allow tuning reconciling process"
properties:
runtime:
type: object
description: "runtime parameters for clickhouse-operator process which are used during reconcile cycle"
properties:
reconcileShardsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile shards of a cluster in parallel, 1 by default"
reconcileShardsMaxConcurrencyPercent:
type: integer
minimum: 0
maximum: 100
description: "The maximum percentage of cluster shards that may be reconciled in parallel, 50 percent by default."
layout:
type: object
description: |
@@ -690,18 +829,24 @@ spec:
allows override settings on each shard and replica separatelly
# nullable: true
properties:
type:
type: string
description: "DEPRECATED - to be removed soon"
shardsCount:
type: integer
description: "how much shards for current ClickHouse cluster will run in Kubernetes, each shard contains shared-nothing part of data and contains set of replicas, cluster contains 1 shard by default"
description: |
how much shards for current ClickHouse cluster will run in Kubernetes,
each shard contains shared-nothing part of data and contains set of replicas,
cluster contains 1 shard by default"
replicasCount:
type: integer
description: "how much replicas in each shards for current ClickHouse cluster will run in Kubernetes, each replica is a separate `StatefulSet` which contains only one `Pod` with `clickhouse-server` instance, every shard contains 1 replica by default"
description: |
how much replicas in each shards for current cluster will run in Kubernetes,
each replica is a separate `StatefulSet` which contains only one `Pod` with `clickhouse-server` instance,
every shard contains 1 replica by default"
shards:
type: array
description: "optional, allows override top-level `chi.spec.configuration`, cluster-level `chi.spec.configuration.clusters` settings for each shard separately, use it only if you fully understand what you do"
description: |
optional, allows override top-level `chi.spec.configuration`, cluster-level
`chi.spec.configuration.clusters` settings for each shard separately,
use it only if you fully understand what you do"
# nullable: true
items:
type: object
@@ -1036,7 +1181,7 @@ spec:
description: "template name, could use to link inside top-level `chi.spec.defaults.templates.podTemplate`, cluster-level `chi.spec.configuration.clusters.templates.podTemplate`, shard-level `chi.spec.configuration.clusters.layout.shards.temlates.podTemplate`, replica-level `chi.spec.configuration.clusters.layout.replicas.templates.podTemplate`"
generateName:
type: string
description: "allows define format for generated `Pod` name, look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates for details about aviailable template variables"
description: "allows define format for generated `Pod` name, look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates for details about available template variables"
zone:
type: object
description: "allows define custom zone name and will separate ClickHouse `Pods` between nodes, shortcut for `chi.spec.templates.podTemplates.spec.affinity.podAntiAffinity`"
@@ -1108,7 +1253,9 @@ spec:
maximum: 65535
topologyKey:
type: string
description: "use for inter-pod affinity look to `pod.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.topologyKey`, More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity"
description: |
use for inter-pod affinity look to `pod.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.topologyKey`,
more info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity"
metadata:
type: object
description: |
@@ -1124,7 +1271,8 @@ spec:
x-kubernetes-preserve-unknown-fields: true
volumeClaimTemplates:
type: array
description: "allows define template for rendering `PVC` kubernetes resource, which would use inside `Pod` for mount clickhouse `data`, clickhouse `logs` or something else"
description: |
allows define template for rendering `PVC` kubernetes resource, which would use inside `Pod` for mount clickhouse `data`, clickhouse `logs` or something else
# nullable: true
items:
type: object
@@ -1177,14 +1325,17 @@ spec:
replica-level `chi.spec.configuration.clusters.layout.replicas.templates.replicaServiceTemplate` or `chi.spec.configuration.clusters.layout.shards.replicas.replicaServiceTemplate`
generateName:
type: string
description: "allows define format for generated `Service` name, look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates for details about aviailable template variables"
description: |
allows define format for generated `Service` name,
look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates
for details about available template variables"
metadata:
# TODO specify ObjectMeta
type: object
description: |
allows pass standard object's metadata from template to Service
Could be use for define specificly for Cloud Provider metadata which impact to behavior of service
More info: https://kubernetes.io/docs/concepts/services-networking/service/
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
# nullable: true
x-kubernetes-preserve-unknown-fields: true
spec:
@@ -1197,7 +1348,9 @@ spec:
x-kubernetes-preserve-unknown-fields: true
useTemplates:
type: array
description: "list of `ClickHouseInstallationTemplate` (chit) resource names which will merge with current `Chi` manifest during render Kubernetes resources to create related ClickHouse clusters"
description: |
list of `ClickHouseInstallationTemplate` (chit) resource names which will merge with current `CHI`
manifest during render Kubernetes resources to create related ClickHouse clusters"
# nullable: true
items:
type: object

View File

@@ -1,13 +1,13 @@
# Template Parameters:
#
# OPERATOR_VERSION=0.23.4
# OPERATOR_VERSION=0.25.2
#
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clickhousekeeperinstallations.clickhouse-keeper.altinity.com
labels:
clickhouse-keeper.altinity.com/chop: 0.23.4
clickhouse-keeper.altinity.com/chop: 0.25.2
spec:
group: clickhouse-keeper.altinity.com
scope: Namespaced
@@ -22,123 +22,487 @@ spec:
served: true
storage: true
additionalPrinterColumns:
- name: version
type: string
description: Operator version
priority: 1 # show in wide view
jsonPath: .status.chop-version
- name: clusters
type: integer
description: Clusters count
jsonPath: .status.clusters
- name: shards
type: integer
description: Shards count
priority: 1 # show in wide view
jsonPath: .status.shards
- name: hosts
type: integer
description: Hosts count
jsonPath: .status.hosts
- name: taskID
type: string
description: TaskID
priority: 1 # show in wide view
jsonPath: .status.taskID
- name: status
type: string
description: CHK status
description: Resource status
jsonPath: .status.status
- name: replicas
- name: hosts-unchanged
type: integer
description: Replica count
description: Unchanged hosts count
priority: 1 # show in wide view
jsonPath: .status.replicas
jsonPath: .status.hostsUnchanged
- name: hosts-updated
type: integer
description: Updated hosts count
priority: 1 # show in wide view
jsonPath: .status.hostsUpdated
- name: hosts-added
type: integer
description: Added hosts count
priority: 1 # show in wide view
jsonPath: .status.hostsAdded
- name: hosts-completed
type: integer
description: Completed hosts count
jsonPath: .status.hostsCompleted
- name: hosts-deleted
type: integer
description: Hosts deleted count
priority: 1 # show in wide view
jsonPath: .status.hostsDeleted
- name: hosts-delete
type: integer
description: Hosts to be deleted count
priority: 1 # show in wide view
jsonPath: .status.hostsDelete
- name: endpoint
type: string
description: Client access endpoint
priority: 1 # show in wide view
jsonPath: .status.endpoint
- name: age
type: date
description: Age of the resource
# Displayed in all priorities
jsonPath: .metadata.creationTimestamp
- name: suspend
type: string
description: Suspend reconciliation
# Displayed in all priorities
jsonPath: .spec.suspend
subresources:
status: {}
schema:
openAPIV3Schema:
description: "define a set of Kubernetes resources (StatefulSet, PVC, Service, ConfigMap) which describe behavior one or more clusters"
type: object
required:
- spec
description: "define a set of Kubernetes resources (StatefulSet, PVC, Service, ConfigMap) which describe behavior one ClickHouse Keeper cluster"
properties:
apiVersion:
type: string
description: |
APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
kind:
type: string
kind:
description: |
Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
status:
type: object
description: |
Current ClickHouseKeeperInstallation status, contains many fields like overall status, desired replicas and ready replica list with their endpoints
Status contains many fields like a normalized configuration, clickhouse-operator version, current action and all applied action list, current taskID and all applied taskIDs and other
properties:
chop-version:
type: string
description: "ClickHouse operator version"
description: "Operator version"
chop-commit:
type: string
description: "ClickHouse operator git commit SHA"
description: "Operator git commit SHA"
chop-date:
type: string
description: "ClickHouse operator build date"
description: "Operator build date"
chop-ip:
type: string
description: "IP address of the operator's pod which managed this CHI"
description: "IP address of the operator's pod which managed this resource"
clusters:
type: integer
minimum: 0
description: "Clusters count"
shards:
type: integer
minimum: 0
description: "Shards count"
replicas:
type: integer
minimum: 0
description: "Replicas count"
hosts:
type: integer
minimum: 0
description: "Hosts count"
status:
type: string
description: "Status"
replicas:
type: integer
format: int32
description: Replicas is the number of number of desired replicas in the cluster
readyReplicas:
taskID:
type: string
description: "Current task id"
taskIDsStarted:
type: array
description: ReadyReplicas is the array of endpoints of those ready replicas in the cluster
description: "Started task ids"
nullable: true
items:
type: object
properties:
host:
type: string
description: dns name or ip address for Keeper node
port:
type: integer
minimum: 0
maximum: 65535
description: TCP port which used to connect to Keeper node
secure:
type: string
description: if a secure connection to Keeper is required
type: string
taskIDsCompleted:
type: array
description: "Completed task ids"
nullable: true
items:
type: string
action:
type: string
description: "Action"
actions:
type: array
description: "Actions"
nullable: true
items:
type: string
error:
type: string
description: "Last error"
errors:
type: array
description: "Errors"
nullable: true
items:
type: string
hostsUnchanged:
type: integer
minimum: 0
description: "Unchanged Hosts count"
hostsUpdated:
type: integer
minimum: 0
description: "Updated Hosts count"
hostsAdded:
type: integer
minimum: 0
description: "Added Hosts count"
hostsCompleted:
type: integer
minimum: 0
description: "Completed Hosts count"
hostsDeleted:
type: integer
minimum: 0
description: "Deleted Hosts count"
hostsDelete:
type: integer
minimum: 0
description: "About to delete Hosts count"
pods:
type: array
description: "Pods"
nullable: true
items:
type: string
pod-ips:
type: array
description: "Pod IPs"
nullable: true
items:
type: string
fqdns:
type: array
description: "Pods FQDNs"
nullable: true
items:
type: string
endpoint:
type: string
description: "Endpoint"
endpoints:
type: array
description: "All endpoints"
nullable: true
items:
type: string
generation:
type: integer
minimum: 0
description: "Generation"
normalized:
type: object
description: "Normalized CHK requested"
description: "Normalized resource requested"
x-kubernetes-preserve-unknown-fields: true
normalizedCompleted:
type: object
description: "Normalized CHK completed"
description: "Normalized resource completed"
x-kubernetes-preserve-unknown-fields: true
hostsWithTablesCreated:
type: array
description: "List of hosts with tables created by the operator"
nullable: true
items:
type: string
hostsWithReplicaCaughtUp:
type: array
description: "List of hosts with replica caught up"
nullable: true
items:
type: string
usedTemplates:
type: array
description: "List of templates used to build this CHI"
nullable: true
x-kubernetes-preserve-unknown-fields: true
items:
type: object
x-kubernetes-preserve-unknown-fields: true
spec:
type: object
description: KeeperSpec defines the desired state of a Keeper cluster
# x-kubernetes-preserve-unknown-fields: true
description: |
Specification of the desired behavior of one or more ClickHouse clusters
More info: https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md
properties:
taskID:
type: string
description: |
Allows to define custom taskID for CHI update and watch status of this update execution.
Displayed in all .status.taskID* fields.
By default (if not filled) every update of CHI manifest will generate random taskID
stop: &TypeStringBool
type: string
description: |
Allows to stop all ClickHouse clusters defined in a CHI.
Works as the following:
- When `stop` is `1` operator sets `Replicas: 0` in each StatefulSet. Thie leads to having all `Pods` and `Service` deleted. All PVCs are kept intact.
- When `stop` is `0` operator sets `Replicas: 1` and `Pod`s and `Service`s will created again and all retained PVCs will be attached to `Pod`s.
enum:
# List StringBoolXXX constants from model
- ""
- "0"
- "1"
- "False"
- "false"
- "True"
- "true"
- "No"
- "no"
- "Yes"
- "yes"
- "Off"
- "off"
- "On"
- "on"
- "Disable"
- "disable"
- "Enable"
- "enable"
- "Disabled"
- "disabled"
- "Enabled"
- "enabled"
suspend:
!!merge <<: *TypeStringBool
description: |
Suspend reconciliation of resources managed by a ClickHouse Keeper.
Works as the following:
- When `suspend` is `true` operator stops reconciling all resources.
- When `suspend` is `false` or not set, operator reconciles all resources.
namespaceDomainPattern:
type: string
description: |
Custom domain pattern which will be used for DNS names of `Service` or `Pod`.
Typical use scenario - custom cluster domain in Kubernetes cluster
Example: %s.svc.my.test
replicas:
type: integer
format: int32
reconciling:
type: object
description: "Optional, allows tuning reconciling cycle for ClickhouseInstallation from clickhouse-operator side"
# nullable: true
properties:
policy:
type: string
description: |
DISCUSSED TO BE DEPRECATED
Syntax sugar
Overrides all three 'reconcile.host.wait.{exclude, queries, include}' values from the operator's config
Possible values:
- wait - should wait to exclude host, complete queries and include host back into the cluster
- nowait - should NOT wait to exclude host, complete queries and include host back into the cluster
enum:
- ""
- "wait"
- "nowait"
configMapPropagationTimeout:
type: integer
description: |
Timeout in seconds for `clickhouse-operator` to wait for modified `ConfigMap` to propagate into the `Pod`
More details: https://kubernetes.io/docs/concepts/configuration/configmap/#mounted-configmaps-are-updated-automatically
minimum: 0
maximum: 3600
cleanup:
type: object
description: "Optional, defines behavior for cleanup Kubernetes resources during reconcile cycle"
# nullable: true
properties:
unknownObjects:
type: object
description: |
Describes what clickhouse-operator should do with found Kubernetes resources which should be managed by clickhouse-operator,
but do not have `ownerReference` to any currently managed `ClickHouseInstallation` resource.
Default behavior is `Delete`"
# nullable: true
properties:
statefulSet: &TypeObjectsCleanup
type: string
description: "Behavior policy for unknown StatefulSet, `Delete` by default"
enum:
# List ObjectsCleanupXXX constants from model
- ""
- "Retain"
- "Delete"
pvc:
type: string
!!merge <<: *TypeObjectsCleanup
description: "Behavior policy for unknown PVC, `Delete` by default"
configMap:
!!merge <<: *TypeObjectsCleanup
description: "Behavior policy for unknown ConfigMap, `Delete` by default"
service:
!!merge <<: *TypeObjectsCleanup
description: "Behavior policy for unknown Service, `Delete` by default"
reconcileFailedObjects:
type: object
description: |
Describes what clickhouse-operator should do with Kubernetes resources which are failed during reconcile.
Default behavior is `Retain`"
# nullable: true
properties:
statefulSet:
!!merge <<: *TypeObjectsCleanup
description: "Behavior policy for failed StatefulSet, `Retain` by default"
pvc:
!!merge <<: *TypeObjectsCleanup
description: "Behavior policy for failed PVC, `Retain` by default"
configMap:
!!merge <<: *TypeObjectsCleanup
description: "Behavior policy for failed ConfigMap, `Retain` by default"
service:
!!merge <<: *TypeObjectsCleanup
description: "Behavior policy for failed Service, `Retain` by default"
defaults:
type: object
description: |
Replicas is the expected size of the keeper cluster.
The valid range of size is from 1 to 7.
minimum: 1
maximum: 7
define default behavior for whole ClickHouseInstallation, some behavior can be re-define on cluster, shard and replica level
More info: https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#specdefaults
# nullable: true
properties:
replicasUseFQDN:
!!merge <<: *TypeStringBool
description: |
define should replicas be specified by FQDN in `<host></host>`.
In case of "no" will use short hostname and clickhouse-server will use kubernetes default suffixes for DNS lookup
"no" by default
distributedDDL:
type: object
description: |
allows change `<yandex><distributed_ddl></distributed_ddl></yandex>` settings
More info: https://clickhouse.tech/docs/en/operations/server-configuration-parameters/settings/#server-settings-distributed_ddl
# nullable: true
properties:
profile:
type: string
description: "Settings from this profile will be used to execute DDL queries"
storageManagement:
type: object
description: default storage management options
properties:
provisioner: &TypePVCProvisioner
type: string
description: "defines `PVC` provisioner - be it StatefulSet or the Operator"
enum:
- ""
- "StatefulSet"
- "Operator"
reclaimPolicy: &TypePVCReclaimPolicy
type: string
description: |
defines behavior of `PVC` deletion.
`Delete` by default, if `Retain` specified then `PVC` will be kept when deleting StatefulSet
enum:
- ""
- "Retain"
- "Delete"
templates: &TypeTemplateNames
type: object
description: "optional, configuration of the templates names which will use for generate Kubernetes resources according to one or more ClickHouse clusters described in current ClickHouseInstallation (chi) resource"
# nullable: true
properties:
hostTemplate:
type: string
description: "optional, template name from chi.spec.templates.hostTemplates, which will apply to configure every `clickhouse-server` instance during render ConfigMap resources which will mount into `Pod`"
podTemplate:
type: string
description: "optional, template name from chi.spec.templates.podTemplates, allows customization each `Pod` resource during render and reconcile each StatefulSet.spec resource described in `chi.spec.configuration.clusters`"
dataVolumeClaimTemplate:
type: string
description: "optional, template name from chi.spec.templates.volumeClaimTemplates, allows customization each `PVC` which will mount for clickhouse data directory in each `Pod` during render and reconcile every StatefulSet.spec resource described in `chi.spec.configuration.clusters`"
logVolumeClaimTemplate:
type: string
description: "optional, template name from chi.spec.templates.volumeClaimTemplates, allows customization each `PVC` which will mount for clickhouse log directory in each `Pod` during render and reconcile every StatefulSet.spec resource described in `chi.spec.configuration.clusters`"
serviceTemplate:
type: string
description: "optional, template name from chi.spec.templates.serviceTemplates. used for customization of the `Service` resource, created by `clickhouse-operator` to cover all clusters in whole `chi` resource"
serviceTemplates:
type: array
description: "optional, template names from chi.spec.templates.serviceTemplates. used for customization of the `Service` resources, created by `clickhouse-operator` to cover all clusters in whole `chi` resource"
nullable: true
items:
type: string
clusterServiceTemplate:
type: string
description: "optional, template name from chi.spec.templates.serviceTemplates, allows customization for each `Service` resource which will created by `clickhouse-operator` which cover each clickhouse cluster described in `chi.spec.configuration.clusters`"
shardServiceTemplate:
type: string
description: "optional, template name from chi.spec.templates.serviceTemplates, allows customization for each `Service` resource which will created by `clickhouse-operator` which cover each shard inside clickhouse cluster described in `chi.spec.configuration.clusters`"
replicaServiceTemplate:
type: string
description: "optional, template name from chi.spec.templates.serviceTemplates, allows customization for each `Service` resource which will created by `clickhouse-operator` which cover each replica inside each shard inside each clickhouse cluster described in `chi.spec.configuration.clusters`"
volumeClaimTemplate:
type: string
description: "optional, alias for dataVolumeClaimTemplate, template name from chi.spec.templates.volumeClaimTemplates, allows customization each `PVC` which will mount for clickhouse data directory in each `Pod` during render and reconcile every StatefulSet.spec resource described in `chi.spec.configuration.clusters`"
configuration:
type: object
description: "allows configure multiple aspects and behavior for `clickhouse-server` instance and also allows describe multiple `clickhouse-server` clusters inside one `chi` resource"
# nullable: true
properties:
settings:
settings: &TypeSettings
type: object
description: "allows configure multiple aspects and behavior for `clickhouse-keeper` instance"
description: |
allows configure multiple aspects and behavior for `clickhouse-keeper` instance
# nullable: true
x-kubernetes-preserve-unknown-fields: true
files: &TypeFiles
type: object
description: |
allows define content of any setting
# nullable: true
x-kubernetes-preserve-unknown-fields: true
clusters:
type: array
description: |
describes ClickHouseKeeper clusters layout and allows change settings on cluster-level and replica-level
describes clusters layout and allows change settings on cluster-level and replica-level
# nullable: true
items:
type: object
@@ -147,25 +511,178 @@ spec:
properties:
name:
type: string
description: "cluster name, used to identify set of ClickHouseKeeper servers and wide used during generate names of related Kubernetes resources"
description: "cluster name, used to identify set of servers and wide used during generate names of related Kubernetes resources"
minLength: 1
# See namePartClusterMaxLen const
maxLength: 15
pattern: "^[a-zA-Z0-9-]{0,15}$"
settings:
!!merge <<: *TypeSettings
description: |
optional, allows configure `clickhouse-server` settings inside <yandex>...</yandex> tag in each `Pod` only in one cluster during generate `ConfigMap` which will mount in `/etc/clickhouse-server/config.d/`
override top-level `chi.spec.configuration.settings`
More details: https://clickhouse.tech/docs/en/operations/settings/settings/
files:
!!merge <<: *TypeFiles
description: |
optional, allows define content of any setting file inside each `Pod` on current cluster during generate `ConfigMap` which will mount in `/etc/clickhouse-server/config.d/` or `/etc/clickhouse-server/conf.d/` or `/etc/clickhouse-server/users.d/`
override top-level `chi.spec.configuration.files`
templates:
!!merge <<: *TypeTemplateNames
description: |
optional, configuration of the templates names which will use for generate Kubernetes resources according to selected cluster
override top-level `chi.spec.configuration.templates`
layout:
type: object
description: |
describe current cluster layout, how many replicas
describe current cluster layout, how much shards in cluster, how much replica in shard
allows override settings on each shard and replica separatelly
# nullable: true
properties:
replicasCount:
type: integer
description: "how many replicas in ClickHouseKeeper cluster"
description: |
how much replicas in each shards for current cluster will run in Kubernetes,
each replica is a separate `StatefulSet` which contains only one `Pod` with `clickhouse-server` instance,
every shard contains 1 replica by default"
replicas:
type: array
description: "optional, allows override top-level `chi.spec.configuration` and cluster-level `chi.spec.configuration.clusters` configuration for each replica and each shard relates to selected replica, use it only if you fully understand what you do"
# nullable: true
items:
type: object
properties:
name:
type: string
description: "optional, by default replica name is generated, but you can override it and setup custom name"
minLength: 1
# See namePartShardMaxLen const
maxLength: 15
pattern: "^[a-zA-Z0-9-]{0,15}$"
settings:
!!merge <<: *TypeSettings
description: |
optional, allows configure `clickhouse-server` settings inside <yandex>...</yandex> tag in `Pod` only in one replica during generate `ConfigMap` which will mount in `/etc/clickhouse-server/conf.d/`
override top-level `chi.spec.configuration.settings`, cluster-level `chi.spec.configuration.clusters.settings` and will ignore if shard-level `chi.spec.configuration.clusters.layout.shards` present
More details: https://clickhouse.tech/docs/en/operations/settings/settings/
files:
!!merge <<: *TypeFiles
description: |
optional, allows define content of any setting file inside each `Pod` only in one replica during generate `ConfigMap` which will mount in `/etc/clickhouse-server/config.d/` or `/etc/clickhouse-server/conf.d/` or `/etc/clickhouse-server/users.d/`
override top-level `chi.spec.configuration.files` and cluster-level `chi.spec.configuration.clusters.files`, will ignore if `chi.spec.configuration.clusters.layout.shards` presents
templates:
!!merge <<: *TypeTemplateNames
description: |
optional, configuration of the templates names which will use for generate Kubernetes resources according to selected replica
override top-level `chi.spec.configuration.templates`, cluster-level `chi.spec.configuration.clusters.templates`
shardsCount:
type: integer
description: "optional, count of shards related to current replica, you can override each shard behavior on low-level `chi.spec.configuration.clusters.layout.replicas.shards`"
minimum: 1
shards:
type: array
description: "optional, list of shards related to current replica, will ignore if `chi.spec.configuration.clusters.layout.shards` presents"
# nullable: true
items:
# Host
type: object
properties:
name:
type: string
description: "optional, by default shard name is generated, but you can override it and setup custom name"
minLength: 1
# See namePartReplicaMaxLen const
maxLength: 15
pattern: "^[a-zA-Z0-9-]{0,15}$"
zkPort:
type: integer
minimum: 1
maximum: 65535
raftPort:
type: integer
minimum: 1
maximum: 65535
settings:
!!merge <<: *TypeSettings
description: |
optional, allows configure `clickhouse-server` settings inside <yandex>...</yandex> tag in `Pod` only in one shard related to current replica during generate `ConfigMap` which will mount in `/etc/clickhouse-server/conf.d/`
override top-level `chi.spec.configuration.settings`, cluster-level `chi.spec.configuration.clusters.settings` and replica-level `chi.spec.configuration.clusters.layout.replicas.settings`
More details: https://clickhouse.tech/docs/en/operations/settings/settings/
files:
!!merge <<: *TypeFiles
description: |
optional, allows define content of any setting file inside each `Pod` only in one shard related to current replica during generate `ConfigMap` which will mount in `/etc/clickhouse-server/config.d/` or `/etc/clickhouse-server/conf.d/` or `/etc/clickhouse-server/users.d/`
override top-level `chi.spec.configuration.files` and cluster-level `chi.spec.configuration.clusters.files`, will ignore if `chi.spec.configuration.clusters.layout.shards` presents
templates:
!!merge <<: *TypeTemplateNames
description: |
optional, configuration of the templates names which will use for generate Kubernetes resources according to selected replica
override top-level `chi.spec.configuration.templates`, cluster-level `chi.spec.configuration.clusters.templates`, replica-level `chi.spec.configuration.clusters.layout.replicas.templates`
templates:
type: object
description: "allows define templates which will use for render Kubernetes resources like StatefulSet, ConfigMap, Service, PVC, by default, clickhouse-operator have own templates, but you can override it"
# nullable: true
properties:
hostTemplates:
type: array
description: "hostTemplate will use during apply to generate `clickhose-server` config files"
# nullable: true
items:
type: object
#required:
# - name
properties:
name:
description: "template name, could use to link inside top-level `chi.spec.defaults.templates.hostTemplate`, cluster-level `chi.spec.configuration.clusters.templates.hostTemplate`, shard-level `chi.spec.configuration.clusters.layout.shards.temlates.hostTemplate`, replica-level `chi.spec.configuration.clusters.layout.replicas.templates.hostTemplate`"
type: string
portDistribution:
type: array
description: "define how will distribute numeric values of named ports in `Pod.spec.containers.ports` and clickhouse-server configs"
# nullable: true
items:
type: object
#required:
# - type
properties:
type:
type: string
description: "type of distribution, when `Unspecified` (default value) then all listen ports on clickhouse-server configuration in all Pods will have the same value, when `ClusterScopeIndex` then ports will increment to offset from base value depends on shard and replica index inside cluster with combination of `chi.spec.templates.podTemlates.spec.HostNetwork` it allows setup ClickHouse cluster inside Kubernetes and provide access via external network bypass Kubernetes internal network"
enum:
# List PortDistributionXXX constants
- ""
- "Unspecified"
- "ClusterScopeIndex"
spec:
# Host
type: object
properties:
name:
type: string
description: "by default, hostname will generate, but this allows define custom name for each `clickhuse-server`"
minLength: 1
# See namePartReplicaMaxLen const
maxLength: 15
pattern: "^[a-zA-Z0-9-]{0,15}$"
zkPort:
type: integer
minimum: 1
maximum: 65535
raftPort:
type: integer
minimum: 1
maximum: 65535
settings:
!!merge <<: *TypeSettings
description: |
optional, allows configure `clickhouse-server` settings inside <yandex>...</yandex> tag in each `Pod` where this template will apply during generate `ConfigMap` which will mount in `/etc/clickhouse-server/conf.d/`
More details: https://clickhouse.tech/docs/en/operations/settings/settings/
files:
!!merge <<: *TypeFiles
description: |
optional, allows define content of any setting file inside each `Pod` where this template will apply during generate `ConfigMap` which will mount in `/etc/clickhouse-server/config.d/` or `/etc/clickhouse-server/conf.d/` or `/etc/clickhouse-server/users.d/`
templates:
!!merge <<: *TypeTemplateNames
description: "be careful, this part of CRD allows override template inside template, don't use it if you don't understand what you do"
podTemplates:
type: array
description: |
@@ -180,6 +697,83 @@ spec:
name:
type: string
description: "template name, could use to link inside top-level `chi.spec.defaults.templates.podTemplate`, cluster-level `chi.spec.configuration.clusters.templates.podTemplate`, shard-level `chi.spec.configuration.clusters.layout.shards.temlates.podTemplate`, replica-level `chi.spec.configuration.clusters.layout.replicas.templates.podTemplate`"
generateName:
type: string
description: "allows define format for generated `Pod` name, look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates for details about available template variables"
zone:
type: object
description: "allows define custom zone name and will separate ClickHouse `Pods` between nodes, shortcut for `chi.spec.templates.podTemplates.spec.affinity.podAntiAffinity`"
#required:
# - values
properties:
key:
type: string
description: "optional, if defined, allows select kubernetes nodes by label with `name` equal `key`"
values:
type: array
description: "optional, if defined, allows select kubernetes nodes by label with `value` in `values`"
# nullable: true
items:
type: string
distribution:
type: string
description: "DEPRECATED, shortcut for `chi.spec.templates.podTemplates.spec.affinity.podAntiAffinity`"
enum:
- ""
- "Unspecified"
- "OnePerHost"
podDistribution:
type: array
description: "define ClickHouse Pod distribution policy between Kubernetes Nodes inside Shard, Replica, Namespace, CHI, another ClickHouse cluster"
# nullable: true
items:
type: object
#required:
# - type
properties:
type:
type: string
description: "you can define multiple affinity policy types"
enum:
# List PodDistributionXXX constants
- ""
- "Unspecified"
- "ClickHouseAntiAffinity"
- "ShardAntiAffinity"
- "ReplicaAntiAffinity"
- "AnotherNamespaceAntiAffinity"
- "AnotherClickHouseInstallationAntiAffinity"
- "AnotherClusterAntiAffinity"
- "MaxNumberPerNode"
- "NamespaceAffinity"
- "ClickHouseInstallationAffinity"
- "ClusterAffinity"
- "ShardAffinity"
- "ReplicaAffinity"
- "PreviousTailAffinity"
- "CircularReplication"
scope:
type: string
description: "scope for apply each podDistribution"
enum:
# list PodDistributionScopeXXX constants
- ""
- "Unspecified"
- "Shard"
- "Replica"
- "Cluster"
- "ClickHouseInstallation"
- "Namespace"
number:
type: integer
description: "define, how much ClickHouse Pods could be inside selected scope with selected distribution type"
minimum: 0
maximum: 65535
topologyKey:
type: string
description: |
use for inter-pod affinity look to `pod.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.topologyKey`,
more info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity"
metadata:
type: object
description: |
@@ -195,7 +789,8 @@ spec:
x-kubernetes-preserve-unknown-fields: true
volumeClaimTemplates:
type: array
description: "allows define template for rendering `PVC` kubernetes resource, which would use inside `Pod` for mount clickhouse `data`, clickhouse `logs` or something else"
description: |
allows define template for rendering `PVC` kubernetes resource, which would use inside `Pod` for mount clickhouse `data`, clickhouse `logs` or something else
# nullable: true
items:
type: object
@@ -211,6 +806,8 @@ spec:
cluster-level `chi.spec.configuration.clusters.templates.dataVolumeClaimTemplate` or `chi.spec.configuration.clusters.templates.logVolumeClaimTemplate`,
shard-level `chi.spec.configuration.clusters.layout.shards.temlates.dataVolumeClaimTemplate` or `chi.spec.configuration.clusters.layout.shards.temlates.logVolumeClaimTemplate`
replica-level `chi.spec.configuration.clusters.layout.replicas.templates.dataVolumeClaimTemplate` or `chi.spec.configuration.clusters.layout.replicas.templates.logVolumeClaimTemplate`
provisioner: *TypePVCProvisioner
reclaimPolicy: *TypePVCReclaimPolicy
metadata:
type: object
description: |
@@ -244,6 +841,12 @@ spec:
cluster-level `chi.spec.configuration.clusters.templates.clusterServiceTemplate`
shard-level `chi.spec.configuration.clusters.layout.shards.temlates.shardServiceTemplate`
replica-level `chi.spec.configuration.clusters.layout.replicas.templates.replicaServiceTemplate` or `chi.spec.configuration.clusters.layout.shards.replicas.replicaServiceTemplate`
generateName:
type: string
description: |
allows define format for generated `Service` name,
look to https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates
for details about available template variables"
metadata:
# TODO specify ObjectMeta
type: object

View File

@@ -7,7 +7,7 @@ kind: CustomResourceDefinition
metadata:
name: clickhouseoperatorconfigurations.clickhouse.altinity.com
labels:
clickhouse.altinity.com/chop: 0.23.4
clickhouse.altinity.com/chop: 0.25.2
spec:
group: clickhouse.altinity.com
scope: Namespaced
@@ -137,6 +137,7 @@ spec:
items:
type: object
description: "setting: value pairs for configuration restart policy"
x-kubernetes-preserve-unknown-fields: true
access:
type: object
description: "parameters which use for connect to clickhouse from clickhouse-operator deployment"
@@ -181,6 +182,47 @@ spec:
minimum: 1
maximum: 600
description: "Timout to perform SQL query from the operator to ClickHouse instances. In seconds."
addons:
type: object
description: "Configuration addons specifies additional settings"
properties:
rules:
type: array
description: "Array of set of rules per specified ClickHouse versions"
items:
type: object
properties:
version:
type: string
description: "ClickHouse version expression"
spec:
type: object
description: "spec"
properties:
configuration:
type: object
description: "allows configure multiple aspects and behavior for `clickhouse-server` instance and also allows describe multiple `clickhouse-server` clusters inside one `chi` resource"
properties:
users:
type: object
description: "see same section from CR spec"
x-kubernetes-preserve-unknown-fields: true
profiles:
type: object
description: "see same section from CR spec"
x-kubernetes-preserve-unknown-fields: true
quotas:
type: object
description: "see same section from CR spec"
x-kubernetes-preserve-unknown-fields: true
settings:
type: object
description: "see same section from CR spec"
x-kubernetes-preserve-unknown-fields: true
files:
type: object
description: "see same section from CR spec"
x-kubernetes-preserve-unknown-fields: true
metrics:
type: object
description: "parameters which use for connect to fetch metrics from clickhouse by clickhouse-operator"
@@ -323,6 +365,19 @@ spec:
include:
!!merge <<: *TypeStringBool
description: "Whether the operator during reconcile procedure should wait for a ClickHouse host to be included into a ClickHouse cluster"
replicas:
type: object
description: "Whether the operator during reconcile procedure should wait for replicas to catch-up"
properties:
all:
!!merge <<: *TypeStringBool
description: "Whether the operator during reconcile procedure should wait for all replicas to catch-up"
new:
!!merge <<: *TypeStringBool
description: "Whether the operator during reconcile procedure should wait for new replicas to catch-up"
delay:
type: integer
description: "replication max absolute delay to consider replica is not delayed"
annotation:
type: object
description: "defines which metadata.annotations items will include or exclude during render StatefulSet, Pod, PVC resources"
@@ -373,6 +428,40 @@ spec:
- "LabelClusterScopeCycleSize"
- "LabelClusterScopeCycleIndex"
- "LabelClusterScopeCycleOffset"
metrics:
type: object
description: "defines metrics exporter options"
properties:
labels:
type: object
description: "defines metric labels options"
properties:
exclude:
type: array
description: |
When adding labels to a metric exclude labels with names from the following list
items:
type: string
status:
type: object
description: "defines status options"
properties:
fields:
type: object
description: "defines status fields options"
properties:
action:
!!merge <<: *TypeStringBool
description: "Whether the operator should fill status field 'action'"
actions:
!!merge <<: *TypeStringBool
description: "Whether the operator should fill status field 'actions'"
error:
!!merge <<: *TypeStringBool
description: "Whether the operator should fill status field 'error'"
errors:
!!merge <<: *TypeStringBool
description: "Whether the operator should fill status field 'errors'"
statefulSet:
type: object
description: "define StatefulSet-specific parameters"

View File

@@ -147,8 +147,8 @@
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"query": "SELECT\r\n t,\r\n arrayMap(a -> (a.1, a.2 / runningDifference(t / 1000)), groupArr)\r\nFROM (\r\n SELECT t, groupArray((q, c)) AS groupArr\r\n FROM (\r\n SELECT\r\n (intDiv(toUInt32(event_time), 2) * 2) * 1000 AS t,\r\n normalizeQuery(query) AS q,\r\n count() c\r\n FROM cluster('all-sharded',system.query_log)\r\n WHERE $timeFilter\r\n AND( ('$type' = '1,2,3,4' AND type != 'QueryStart') OR ('$type' != '1,2,3,4' AND type IN ($type)))\r\n $conditionalTest(AND query_kind IN ($query_kind), $query_kind)\r\n $conditionalTest(AND initial_user IN ($user), $user)\r\n $conditionalTest(AND query_duration_ms >= $min_duration_ms, $min_duration_ms)\r\n $conditionalTest(AND query_duration_ms <= $max_duration_ms, $max_duration_ms)\r\n AND normalized_query_hash GLOBAL IN (\r\n SELECT normalized_query_hash AS h\r\n FROM cluster('all-sharded',system.query_log)\r\n WHERE $timeFilter\r\n AND( ('$type' = '1,2,3,4' AND type != 'QueryStart') OR ('$type' != '1,2,3,4' AND type IN ($type)))\r\n $conditionalTest(AND query_kind IN ($query_kind), $query_kind)\r\n $conditionalTest(AND type IN ($type), $type)\r\n $conditionalTest(AND initial_user IN ($user), $user)\r\n $conditionalTest(AND query_duration_ms >= $min_duration_ms, $min_duration_ms)\r\n $conditionalTest(AND query_duration_ms <= $max_duration_ms, $max_duration_ms)\r\n GROUP BY h\r\n ORDER BY count() DESC\r\n LIMIT $top\r\n SETTINGS skip_unavailable_shards=1\r\n )\r\n GROUP BY t, query\r\n ORDER BY t\r\n )\r\n GROUP BY t\r\n ORDER BY t\r\n) SETTINGS skip_unavailable_shards=1",
"rawQuery": "SELECT\r\n t,\r\n arrayMap(a -> (a.1, a.2 / runningDifference(t / 1000)), groupArr)\r\nFROM (\r\n SELECT t, groupArray((q, c)) AS groupArr\r\n FROM (\r\n SELECT\r\n (intDiv(toUInt32(event_time), 2) * 2) * 1000 AS t,\r\n normalizeQuery(query) AS q,\r\n count() c\r\n FROM cluster('all-sharded',system.query_log)\r\n WHERE event_date >= toDate(1694531137) AND event_date <= toDate(1694534737) AND event_time >= toDateTime(1694531137) AND event_time <= toDateTime(1694534737)\r\n AND( ('1,2,3,4' = '1,2,3,4' AND type != 'QueryStart') OR ('1,2,3,4' != '1,2,3,4' AND type IN (1,2,3,4)))\r\n \r\n \r\n \r\n \r\n AND normalized_query_hash GLOBAL IN (\r\n SELECT normalized_query_hash AS h\r\n FROM cluster('all-sharded',system.query_log)\r\n WHERE event_date >= toDate(1694531137) AND event_date <= toDate(1694534737) AND event_time >= toDateTime(1694531137) AND event_time <= toDateTime(1694534737)\r\n AND( ('1,2,3,4' = '1,2,3,4' AND type != 'QueryStart') OR ('1,2,3,4' != '1,2,3,4' AND type IN (1,2,3,4)))\r\n \r\n \r\n \r\n \r\n \r\n GROUP BY h\r\n ORDER BY count() DESC\r\n LIMIT 30\r\n SETTINGS skip_unavailable_shards=1\r\n )\r\n GROUP BY t, query\r\n ORDER BY t\r\n )\r\n GROUP BY t\r\n ORDER BY t\r\n) SETTINGS skip_unavailable_shards=1",
"query": "SELECT\r\n t,\r\n arrayMap(a -> (a.1, a.2 / (t/1000 - lagInFrame(t/1000,1,0) OVER ()) ), groupArr)\r\nFROM (\r\n SELECT t, groupArray((q, c)) AS groupArr\r\n FROM (\r\n SELECT\r\n (intDiv(toUInt32(event_time), 2) * 2) * 1000 AS t,\r\n normalizeQuery(query) AS q,\r\n count() c\r\n FROM cluster('all-sharded',system.query_log)\r\n WHERE $timeFilter\r\n AND( ('$type' = '1,2,3,4' AND type != 'QueryStart') OR ('$type' != '1,2,3,4' AND type IN ($type)))\r\n $conditionalTest(AND query_kind IN ($query_kind), $query_kind)\r\n $conditionalTest(AND initial_user IN ($user), $user)\r\n $conditionalTest(AND query_duration_ms >= $min_duration_ms, $min_duration_ms)\r\n $conditionalTest(AND query_duration_ms <= $max_duration_ms, $max_duration_ms)\r\n AND normalized_query_hash GLOBAL IN (\r\n SELECT normalized_query_hash AS h\r\n FROM cluster('all-sharded',system.query_log)\r\n WHERE $timeFilter\r\n AND( ('$type' = '1,2,3,4' AND type != 'QueryStart') OR ('$type' != '1,2,3,4' AND type IN ($type)))\r\n $conditionalTest(AND query_kind IN ($query_kind), $query_kind)\r\n $conditionalTest(AND type IN ($type), $type)\r\n $conditionalTest(AND initial_user IN ($user), $user)\r\n $conditionalTest(AND query_duration_ms >= $min_duration_ms, $min_duration_ms)\r\n $conditionalTest(AND query_duration_ms <= $max_duration_ms, $max_duration_ms)\r\n GROUP BY h\r\n ORDER BY count() DESC\r\n LIMIT $top\r\n SETTINGS skip_unavailable_shards=1\r\n )\r\n GROUP BY t, query\r\n ORDER BY t\r\n )\r\n GROUP BY t\r\n ORDER BY t\r\n) SETTINGS skip_unavailable_shards=1",
"rawQuery": "SELECT\r\n t,\r\n arrayMap(a -> (a.1, a.2 / (t/1000 - lagInFrame(t/1000,1,0) OVER ()) ), groupArr)\r\nFROM (\r\n SELECT t, groupArray((q, c)) AS groupArr\r\n FROM (\r\n SELECT\r\n (intDiv(toUInt32(event_time), 2) * 2) * 1000 AS t,\r\n normalizeQuery(query) AS q,\r\n count() c\r\n FROM cluster('all-sharded',system.query_log)\r\n WHERE event_date >= toDate(1694531137) AND event_date <= toDate(1694534737) AND event_time >= toDateTime(1694531137) AND event_time <= toDateTime(1694534737)\r\n AND( ('1,2,3,4' = '1,2,3,4' AND type != 'QueryStart') OR ('1,2,3,4' != '1,2,3,4' AND type IN (1,2,3,4)))\r\n \r\n \r\n \r\n \r\n AND normalized_query_hash GLOBAL IN (\r\n SELECT normalized_query_hash AS h\r\n FROM cluster('all-sharded',system.query_log)\r\n WHERE event_date >= toDate(1694531137) AND event_date <= toDate(1694534737) AND event_time >= toDateTime(1694531137) AND event_time <= toDateTime(1694534737)\r\n AND( ('1,2,3,4' = '1,2,3,4' AND type != 'QueryStart') OR ('1,2,3,4' != '1,2,3,4' AND type IN (1,2,3,4)))\r\n \r\n \r\n \r\n \r\n \r\n GROUP BY h\r\n ORDER BY count() DESC\r\n LIMIT 30\r\n SETTINGS skip_unavailable_shards=1\r\n )\r\n GROUP BY t, query\r\n ORDER BY t\r\n )\r\n GROUP BY t\r\n ORDER BY t\r\n) SETTINGS skip_unavailable_shards=1",
"refId": "A",
"resultFormat": "time_series",
"round": "0s",
@@ -743,7 +743,7 @@
"interval": "",
"intervalFactor": 2,
"query": "$rate(count() c)\nFROM cluster('all-sharded',system.query_log)\nWHERE $timeFilter\n AND( ('$type' = '1,2,3,4' AND type != 'QueryStart') OR ('$type' != '1,2,3,4' AND type IN ($type)))\n $conditionalTest(AND query_kind IN ($query_kind), $query_kind)\n $conditionalTest(AND initial_user IN ($user), $user)\n $conditionalTest(AND query_duration_ms >= $min_duration_ms,$min_duration_ms)\n $conditionalTest(AND query_duration_ms <= $max_duration_ms,$max_duration_ms)\n",
"rawQuery": "SELECT t, c/runningDifference(t/1000) cRate FROM ( SELECT (intDiv(toUInt32(event_time), 4) * 4) * 1000 AS t, count() c FROM cluster('all-sharded',system.query_log)\nWHERE event_date >= toDate(1694531229) AND event_date <= toDate(1694534829) AND event_time >= toDateTime(1694531229) AND event_time <= toDateTime(1694534829) AND event_date >= toDate(1694531229) AND event_date <= toDate(1694534829) AND event_time >= toDateTime(1694531229) AND event_time <= toDateTime(1694534829)\n AND( ('1,2,3,4' = '1,2,3,4' AND type != 'QueryStart') OR ('1,2,3,4' != '1,2,3,4' AND type IN (1,2,3,4)))\n \n \n \n GROUP BY t ORDER BY t)",
"rawQuery": "SELECT t, c/(t/1000 - lagInFrame(t/1000,1,0) OVER ()) cRate FROM ( SELECT (intDiv(toUInt32(event_time), 4) * 4) * 1000 AS t, count() c FROM cluster('all-sharded',system.query_log)\nWHERE event_date >= toDate(1694531229) AND event_date <= toDate(1694534829) AND event_time >= toDateTime(1694531229) AND event_time <= toDateTime(1694534829) AND event_date >= toDate(1694531229) AND event_date <= toDate(1694534829) AND event_time >= toDateTime(1694531229) AND event_time <= toDateTime(1694534829)\n AND( ('1,2,3,4' = '1,2,3,4' AND type != 'QueryStart') OR ('1,2,3,4' != '1,2,3,4' AND type IN (1,2,3,4)))\n \n \n \n GROUP BY t ORDER BY t)",
"refId": "A",
"resultFormat": "time_series",
"round": "0s",

View File

@@ -1,4 +1,15 @@
{{/* vim: set filetype=go-template: */}}
{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "altinity-clickhouse-operator.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
{{/*
Expand the name of the chart.
*/}}
@@ -40,8 +51,8 @@ helm.sh/chart: {{ include "altinity-clickhouse-operator.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels }}
{{- if .Values.commonLabels }}
{{ toYaml .Values.commonLabels }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
@@ -54,6 +65,17 @@ app.kubernetes.io/name: {{ include "altinity-clickhouse-operator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Common annotations
*/}}
{{- define "altinity-clickhouse-operator.annotations" -}}
meta.helm.sh/release-name: {{ .Release.Name }}
meta.helm.sh/release-namespace: {{ .Release.Namespace }}
{{- if .Values.commonAnnotations }}
{{ toYaml .Values.commonAnnotations }}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}

View File

@@ -0,0 +1,21 @@
{{- if .Values.dashboards.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "altinity-clickhouse-operator.fullname" . }}-dashboards
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels:
{{- include "altinity-clickhouse-operator.labels" . | nindent 4 }}
{{- if .Values.dashboards.additionalLabels }}
{{- toYaml .Values.dashboards.additionalLabels | nindent 4 }}
{{- end }}
annotations:
{{- include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
{{- if .Values.dashboards.annotations }}
{{- toYaml .Values.dashboards.annotations | nindent 4 }}
{{- end }}
data:
{{- range $path, $_ := .Files.Glob "files/*.json" }}
{{ $path | trimPrefix "files/" }}: |- {{ $.Files.Get $path | nindent 4 -}}
{{ end }}
{{- end }}

View File

@@ -1,21 +0,0 @@
{{- if .Values.dashboards.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "altinity-clickhouse-operator.fullname" . }}-dashboards
namespace: {{ .Release.Namespace }}
labels:
{{- include "altinity-clickhouse-operator.labels" . | nindent 4 }}
{{- if .Values.dashboards.additionalLabels }}
{{- toYaml .Values.dashboards.additionalLabels | nindent 4 }}
{{- end }}
{{- with .Values.dashboards.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- range $path, $_ := .Files.Glob "files/*.json" }}
{{ $path | trimPrefix "files/" }}: {{ $.Files.Get $path | b64enc -}}
{{ end }}
{{- end }}

View File

@@ -1,4 +1,4 @@
{{- if .Values.rbac.create -}}
{{- if (and .Values.rbac.create (not .Values.rbac.namespaceScoped)) -}}
# Specifies either
# ClusterRole
# or
@@ -12,7 +12,7 @@ metadata:
name: {{ include "altinity-clickhouse-operator.fullname" . }}
#namespace: kube-system
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
rules:
#
# Core API group

View File

@@ -1,4 +1,4 @@
{{- if .Values.rbac.create -}}
{{- if (and .Values.rbac.create (not .Values.rbac.namespaceScoped)) -}}
# Specifies either
# ClusterRoleBinding between ClusterRole and ServiceAccount.
# or
@@ -11,7 +11,7 @@ metadata:
name: {{ include "altinity-clickhouse-operator.fullname" . }}
#namespace: kube-system
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
@@ -19,5 +19,15 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ include "altinity-clickhouse-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
# Template Parameters:
#
# NAMESPACE=kube-system
# COMMENT=
# ROLE_KIND=Role
# ROLE_NAME=clickhouse-operator
# ROLE_BINDING_KIND=RoleBinding
# ROLE_BINDING_NAME=clickhouse-operator
#
{{- end }}

View File

@@ -8,6 +8,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-confd-files" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.confdFiles) | nindent 2 }}

View File

@@ -8,6 +8,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-configd-files" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.configdFiles) | nindent 2 }}

View File

@@ -8,6 +8,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-files" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.files) | nindent 2 }}

View File

@@ -8,6 +8,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-templatesd-files" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.templatesdFiles) | nindent 2 }}

View File

@@ -8,6 +8,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-usersd-files" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.usersdFiles) | nindent 2 }}

View File

@@ -0,0 +1,14 @@
# Template Parameters:
#
# NAME=etc-keeper-operator-confd-files
# NAMESPACE=kube-system
# COMMENT=
#
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-keeper-confd-files" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.keeperConfdFiles) | nindent 2 }}

View File

@@ -0,0 +1,14 @@
# Template Parameters:
#
# NAME=etc-keeper-operator-configd-files
# NAMESPACE=kube-system
# COMMENT=
#
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-keeper-configd-files" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.keeperConfigdFiles) | nindent 2 }}

View File

@@ -0,0 +1,14 @@
# Template Parameters:
#
# NAME=etc-keeper-operator-templatesd-files
# NAMESPACE=kube-system
# COMMENT=
#
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-keeper-templatesd-files" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.keeperTemplatesdFiles) | nindent 2 }}

View File

@@ -0,0 +1,14 @@
# Template Parameters:
#
# NAME=etc-keeper-operator-usersd-files
# NAMESPACE=kube-system
# COMMENT=
#
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-keeper-usersd-files" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.keeperUsersdFiles) | nindent 2 }}

View File

@@ -2,9 +2,9 @@
#
# NAMESPACE=kube-system
# COMMENT=
# OPERATOR_IMAGE=altinity/clickhouse-operator:0.23.4
# OPERATOR_IMAGE=altinity/clickhouse-operator:0.25.2
# OPERATOR_IMAGE_PULL_POLICY=Always
# METRICS_EXPORTER_IMAGE=altinity/metrics-exporter:0.23.4
# METRICS_EXPORTER_IMAGE=altinity/metrics-exporter:0.25.2
# METRICS_EXPORTER_IMAGE_PULL_POLICY=Always
#
# Setup Deployment for clickhouse-operator
@@ -13,22 +13,27 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: {{ include "altinity-clickhouse-operator.fullname" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels: {{ include "altinity-clickhouse-operator.selectorLabels" . | nindent 6 }}
template:
metadata:
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 8 }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 8 }}{{ if .Values.podLabels }}{{ toYaml .Values.podLabels | nindent 8 }}{{ end }}
annotations:
{{ toYaml .Values.podAnnotations | nindent 8 }}
{{ if .Values.podAnnotations }}{{ toYaml .Values.podAnnotations | nindent 8 }}{{ end }}
checksum/files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-clickhouse-operator-files.yaml") . | sha256sum }}
checksum/confd-files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-clickhouse-operator-confd-files.yaml") . | sha256sum }}
checksum/configd-files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-clickhouse-operator-configd-files.yaml") . | sha256sum }}
checksum/templatesd-files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-clickhouse-operator-templatesd-files.yaml") . | sha256sum }}
checksum/usersd-files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-clickhouse-operator-usersd-files.yaml") . | sha256sum }}
checksum/keeper-confd-files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-keeper-operator-confd-files.yaml") . | sha256sum }}
checksum/keeper-configd-files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-keeper-operator-configd-files.yaml") . | sha256sum }}
checksum/keeper-templatesd-files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-keeper-operator-templatesd-files.yaml") . | sha256sum }}
checksum/keeper-usersd-files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-keeper-operator-usersd-files.yaml") . | sha256sum }}
spec:
serviceAccountName: {{ include "altinity-clickhouse-operator.serviceAccountName" . }}
volumes:
@@ -47,6 +52,18 @@ spec:
- name: etc-clickhouse-operator-usersd-folder
configMap:
name: {{ include "altinity-clickhouse-operator.fullname" . }}-usersd-files
- name: etc-keeper-operator-confd-folder
configMap:
name: {{ include "altinity-clickhouse-operator.fullname" . }}-keeper-confd-files
- name: etc-keeper-operator-configd-folder
configMap:
name: {{ include "altinity-clickhouse-operator.fullname" . }}-keeper-configd-files
- name: etc-keeper-operator-templatesd-folder
configMap:
name: {{ include "altinity-clickhouse-operator.fullname" . }}-keeper-templatesd-files
- name: etc-keeper-operator-usersd-folder
configMap:
name: {{ include "altinity-clickhouse-operator.fullname" . }}-keeper-usersd-files
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.operator.image.repository }}:{{ include "altinity-clickhouse-operator.operator.tag" . }}
@@ -55,13 +72,21 @@ spec:
- name: etc-clickhouse-operator-folder
mountPath: /etc/clickhouse-operator
- name: etc-clickhouse-operator-confd-folder
mountPath: /etc/clickhouse-operator/conf.d
mountPath: /etc/clickhouse-operator/chi/conf.d
- name: etc-clickhouse-operator-configd-folder
mountPath: /etc/clickhouse-operator/config.d
mountPath: /etc/clickhouse-operator/chi/config.d
- name: etc-clickhouse-operator-templatesd-folder
mountPath: /etc/clickhouse-operator/templates.d
mountPath: /etc/clickhouse-operator/chi/templates.d
- name: etc-clickhouse-operator-usersd-folder
mountPath: /etc/clickhouse-operator/users.d
mountPath: /etc/clickhouse-operator/chi/users.d
- name: etc-keeper-operator-confd-folder
mountPath: /etc/clickhouse-operator/chk/conf.d
- name: etc-keeper-operator-configd-folder
mountPath: /etc/clickhouse-operator/chk/keeper_config.d
- name: etc-keeper-operator-templatesd-folder
mountPath: /etc/clickhouse-operator/chk/templates.d
- name: etc-keeper-operator-usersd-folder
mountPath: /etc/clickhouse-operator/chk/users.d
env:
# Pod-specific
# spec.nodeName: ip-172-20-52-62.ec2.internal
@@ -125,13 +150,21 @@ spec:
- name: etc-clickhouse-operator-folder
mountPath: /etc/clickhouse-operator
- name: etc-clickhouse-operator-confd-folder
mountPath: /etc/clickhouse-operator/conf.d
mountPath: /etc/clickhouse-operator/chi/conf.d
- name: etc-clickhouse-operator-configd-folder
mountPath: /etc/clickhouse-operator/config.d
mountPath: /etc/clickhouse-operator/chi/config.d
- name: etc-clickhouse-operator-templatesd-folder
mountPath: /etc/clickhouse-operator/templates.d
mountPath: /etc/clickhouse-operator/chi/templates.d
- name: etc-clickhouse-operator-usersd-folder
mountPath: /etc/clickhouse-operator/users.d
mountPath: /etc/clickhouse-operator/chi/users.d
- name: etc-keeper-operator-confd-folder
mountPath: /etc/clickhouse-operator/chk/conf.d
- name: etc-keeper-operator-configd-folder
mountPath: /etc/clickhouse-operator/chk/keeper_config.d
- name: etc-keeper-operator-templatesd-folder
mountPath: /etc/clickhouse-operator/chk/templates.d
- name: etc-keeper-operator-usersd-folder
mountPath: /etc/clickhouse-operator/chk/users.d
env:
# Pod-specific
# spec.nodeName: ip-172-20-52-62.ec2.internal
@@ -193,3 +226,4 @@ spec:
affinity: {{ toYaml .Values.affinity | nindent 8 }}
tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
securityContext: {{ toYaml .Values.podSecurityContext | nindent 8 }}
topologySpreadConstraints: {{ toYaml .Values.topologySpreadConstraints | nindent 8 }}

View File

@@ -0,0 +1,211 @@
{{- if (and .Values.rbac.create .Values.rbac.namespaceScoped) -}}
# Specifies either
# ClusterRole
# or
# Role
# to be bound to ServiceAccount.
# ClusterRole is namespace-less and must have unique name
# Role is namespace-bound
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "altinity-clickhouse-operator.fullname" . }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
rules:
#
# Core API group
#
- apiGroups:
- ""
resources:
- configmaps
- services
- persistentvolumeclaims
- secrets
verbs:
- get
- list
- patch
- update
- watch
- create
- delete
- apiGroups:
- ""
resources:
- endpoints
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- apiGroups:
- ""
resources:
- persistentvolumes
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- patch
- update
- watch
- delete
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
#
# apps.* resources
#
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- get
- list
- patch
- update
- watch
- create
- delete
- apiGroups:
- apps
resources:
- replicasets
verbs:
- get
- patch
- update
- delete
# The operator deployment personally, identified by name
- apiGroups:
- apps
resources:
- deployments
resourceNames:
- {{ include "altinity-clickhouse-operator.fullname" . }}
verbs:
- get
- patch
- update
- delete
#
# policy.* resources
#
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- get
- list
- patch
- update
- watch
- create
- delete
#
# apiextensions
#
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- list
# clickhouse - related resources
- apiGroups:
- clickhouse.altinity.com
#
# The operators specific Custom Resources
#
resources:
- clickhouseinstallations
verbs:
- get
- list
- watch
- patch
- update
- delete
- apiGroups:
- clickhouse.altinity.com
resources:
- clickhouseinstallationtemplates
- clickhouseoperatorconfigurations
verbs:
- get
- list
- watch
- apiGroups:
- clickhouse.altinity.com
resources:
- clickhouseinstallations/finalizers
- clickhouseinstallationtemplates/finalizers
- clickhouseoperatorconfigurations/finalizers
verbs:
- update
- apiGroups:
- clickhouse.altinity.com
resources:
- clickhouseinstallations/status
- clickhouseinstallationtemplates/status
- clickhouseoperatorconfigurations/status
verbs:
- get
- update
- patch
- create
- delete
# clickhouse-keeper - related resources
- apiGroups:
- clickhouse-keeper.altinity.com
resources:
- clickhousekeeperinstallations
verbs:
- get
- list
- watch
- patch
- update
- delete
- apiGroups:
- clickhouse-keeper.altinity.com
resources:
- clickhousekeeperinstallations/finalizers
verbs:
- update
- apiGroups:
- clickhouse-keeper.altinity.com
resources:
- clickhousekeeperinstallations/status
verbs:
- get
- update
- patch
- create
- delete
{{- end }}

View File

@@ -0,0 +1,23 @@
{{- if (and .Values.rbac.create .Values.rbac.namespaceScoped) -}}
# Specifies either
# ClusterRoleBinding between ClusterRole and ServiceAccount.
# or
# RoleBinding between Role and ServiceAccount.
# ClusterRoleBinding is namespace-less and must have unique name
# RoleBinding is namespace-bound
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "altinity-clickhouse-operator.fullname" . }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "altinity-clickhouse-operator.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "altinity-clickhouse-operator.serviceAccountName" . }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
{{- end }}

View File

@@ -3,7 +3,7 @@
# Template parameters available:
# NAMESPACE=kube-system
# COMMENT=
# OPERATOR_VERSION=0.23.4
# OPERATOR_VERSION=0.25.2
# CH_USERNAME_SECRET_PLAIN=clickhouse_operator
# CH_PASSWORD_SECRET_PLAIN=clickhouse_operator_password
#
@@ -11,8 +11,9 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ include "altinity-clickhouse-operator.fullname" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
type: Opaque
data:
username: {{ .Values.secret.username | b64enc }}

View File

@@ -12,8 +12,9 @@ kind: Service
apiVersion: v1
metadata:
name: {{ printf "%s-metrics" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
spec:
ports:
- port: 8888

View File

@@ -10,9 +10,9 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "altinity-clickhouse-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ toYaml .Values.serviceAccount.annotations | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}{{ if .Values.serviceAccount.annotations }}{{ toYaml .Values.serviceAccount.annotations | nindent 4 }}{{ end }}
# Template Parameters:
#

View File

@@ -3,16 +3,45 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ printf "%s-clickhouse-metrics" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels:
{{- include "altinity-clickhouse-operator.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.additionalLabels }}
{{- if .Values.serviceMonitor.additionalLabels }}
{{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4 }}
{{- end }}
{{- end }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
spec:
endpoints:
- port: clickhouse-metrics # 8888
{{- with .Values.serviceMonitor.clickhouseMetrics.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.clickhouseMetrics.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.clickhouseMetrics.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.serviceMonitor.clickhouseMetrics.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
- port: operator-metrics # 9999
{{- with .Values.serviceMonitor.operatorMetrics.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.operatorMetrics.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.operatorMetrics.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.serviceMonitor.operatorMetrics.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
selector:
matchLabels:
{{- include "altinity-clickhouse-operator.selectorLabels" . | nindent 6 }}

View File

@@ -1,3 +1,8 @@
namespaceOverride: ""
# commonLabels -- set of labels that will be applied to all the resources for the operator
commonLabels: {}
# commonAnnotations -- set of annotations that will be applied to all the resources for the operator
commonAnnotations: {}
operator:
image:
# operator.image.repository -- image repository
@@ -7,7 +12,7 @@ operator:
# operator.image.pullPolicy -- image pull policy
pullPolicy: IfNotPresent
containerSecurityContext: {}
# operator.resources -- custom resource configuration, look `kubectl explain pod.spec.containers.resources` for details
# operator.resources -- custom resource configuration, check `kubectl explain pod.spec.containers.resources` for details
resources: {}
# limits:
# cpu: 100m
@@ -17,7 +22,7 @@ operator:
# memory: 128Mi
# operator.env -- additional environment variables for the clickhouse-operator container in deployment
# possible format value [{"name": "SAMPLE", "value": "text"}]
# possible format value `[{"name": "SAMPLE", "value": "text"}]`
env: []
metrics:
enabled: true
@@ -39,15 +44,16 @@ metrics:
# memory: 128Mi
# metrics.env -- additional environment variables for the deployment of metrics-exporter containers
# possible format value [{"name": "SAMPLE", "value": "text"}]
# possible format value `[{"name": "SAMPLE", "value": "text"}]`
env: []
# imagePullSecrets -- image pull secret for private images in clickhouse-operator pod
# possible value format [{"name":"your-secret-name"}]
# look `kubectl explain pod.spec.imagePullSecrets` for details
# possible value format `[{"name":"your-secret-name"}]`,
# check `kubectl explain pod.spec.imagePullSecrets` for details
imagePullSecrets: []
# podLabels -- labels to add to the clickhouse-operator pod
podLabels: {}
# podAnnotations -- annotations to add to the clickhouse-operator pod, look `kubectl explain pod.spec.annotations` for details
# podAnnotations -- annotations to add to the clickhouse-operator pod, check `kubectl explain pod.spec.annotations` for details
# @default -- check the `values.yaml` file
podAnnotations:
prometheus.io/port: '8888'
prometheus.io/scrape: 'true'
@@ -65,8 +71,10 @@ serviceAccount:
# serviceAccount.name -- the name of the service account to use; if not set and create is true, a name is generated using the fullname template
name:
rbac:
# rbac.create -- specifies whether cluster roles and cluster role bindings should be created
# rbac.create -- specifies whether rbac resources should be created
create: true
# rbac.namespaceScoped -- specifies whether to create roles and rolebindings at the cluster level or namespace level
namespaceScoped: false
secret:
# secret.create -- create a secret with operator credentials
create: true
@@ -74,21 +82,42 @@ secret:
username: clickhouse_operator
# secret.password -- operator credentials password
password: clickhouse_operator_password
# nodeSelector -- node for scheduler pod assignment, look `kubectl explain pod.spec.nodeSelector` for details
# nodeSelector -- node for scheduler pod assignment, check `kubectl explain pod.spec.nodeSelector` for details
nodeSelector: {}
# tolerations -- tolerations for scheduler pod assignment, look `kubectl explain pod.spec.tolerations` for details
# tolerations -- tolerations for scheduler pod assignment, check `kubectl explain pod.spec.tolerations` for details
tolerations: []
# affinity -- affinity for scheduler pod assignment, look `kubectl explain pod.spec.affinity` for details
# affinity -- affinity for scheduler pod assignment, check `kubectl explain pod.spec.affinity` for details
affinity: {}
# podSecurityContext - operator deployment SecurityContext, look `kubectl explain pod.spec.securityContext` for details
# podSecurityContext - operator deployment SecurityContext, check `kubectl explain pod.spec.securityContext` for details
podSecurityContext: {}
# topologySpreadConstraints - topologySpreadConstraints affinity for scheduler pod assignment, check `kubectl explain pod.spec.topologySpreadConstraints` for details
topologySpreadConstraints: []
serviceMonitor:
# serviceMonitor.enabled -- ServiceMonitor Custom resource is created for a (prometheus-operator)[https://github.com/prometheus-operator/prometheus-operator]
# serviceMonitor.enabled -- ServiceMonitor Custom resource is created for a [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator)
# In serviceMonitor will be created two endpoints clickhouse-metrics on port 8888 and operator-metrics # 9999. Ypu can specify interval, scrapeTimeout, relabelings, metricRelabelings for each endpoint below
enabled: false
# serviceMonitor.additionalLabels -- additional labels for service monitor
additionalLabels: {}
# configs -- clickhouse-operator configs
# @default -- check the values.yaml file for the config content, auto-generated from latest operator release
clickhouseMetrics:
# serviceMonitor.interval for clickhouse-metrics endpoint --
interval: 30s
# serviceMonitor.scrapeTimeout for clickhouse-metrics endpoint -- Prometheus ServiceMonitor scrapeTimeout. If empty, Prometheus uses the global scrape timeout unless it is less than the target's scrape interval value in which the latter is used.
scrapeTimeout: ""
# serviceMonitor.relabelings for clickhouse-metrics endpoint -- Prometheus [RelabelConfigs] to apply to samples before scraping
relabelings: []
# serviceMonitor.metricRelabelings for clickhouse-metrics endpoint -- Prometheus [MetricRelabelConfigs] to apply to samples before ingestio
metricRelabelings: []
operatorMetrics:
# serviceMonitor.interval for operator-metrics endpoint --
interval: 30s
# serviceMonitor.scrapeTimeout for operator-metrics endpoint -- Prometheus ServiceMonitor scrapeTimeout. If empty, Prometheus uses the global scrape timeout unless it is less than the target's scrape interval value in which the latter is used.
scrapeTimeout: ""
# serviceMonitor.relabelings for operator-metrics endpoint -- Prometheus [RelabelConfigs] to apply to samples before scraping
relabelings: []
# serviceMonitor.metricRelabelings for operator-metrics endpoint-- Prometheus [MetricRelabelConfigs] to apply to samples before ingestio
metricRelabelings: []
# configs -- clickhouse operator configs
# @default -- check the `values.yaml` file for the config content (auto-generated from latest operator release)
configs:
confdFiles: null
configdFiles:
@@ -212,12 +241,12 @@ configs:
# In case path is relative - it is relative to the folder where configuration file you are reading right now is located.
path:
# Path to the folder where ClickHouse configuration files common for all instances within a CHI are located.
common: config.d
common: chi/config.d
# Path to the folder where ClickHouse configuration files unique for each instance (host) within a CHI are located.
host: conf.d
host: chi/conf.d
# Path to the folder where ClickHouse configuration files with users' settings are located.
# Files are common for all instances within a CHI.
user: users.d
user: chi/users.d
################################################
##
## Configuration users section
@@ -287,10 +316,13 @@ configs:
- settings/macros/*: "no"
- settings/remote_servers/*: "no"
- settings/user_directories/*: "no"
# these settings should not lead to pod restarts
- settings/display_secrets_in_show_and_select: "no"
- zookeeper/*: "yes"
- files/*.xml: "yes"
- files/config.d/*.xml: "yes"
- files/config.d/*dict*.xml: "no"
- files/config.d/*no_restart*: "no"
# exceptions in default profile
- profiles/default/background_*_pool_size: "yes"
- profiles/default/max_*_for_server: "yes"
@@ -312,7 +344,6 @@ configs:
# These credentials are used for:
# 1. Metrics requests
# 2. Schema maintenance
# 3. DROP DNS CACHE
# User with these credentials can be specified in additional ClickHouse .xml config files,
# located in 'clickhouse.configuration.file.path.user' folder
username: ""
@@ -339,6 +370,56 @@ configs:
connect: 1
# Timout to perform SQL query from the operator to ClickHouse instances. In seconds.
query: 4
################################################
##
## Addons specifies additional configuration sections
## Should it be called something like "templates"?
##
################################################
addons:
rules:
- version: "*"
spec:
configuration:
users:
profiles:
quotas:
settings:
files:
- version: ">= 23.3"
spec:
configuration:
###
### users.d is global while description depends on CH version which may vary on per-host basis
### In case of global-ness this may be better to implement via auto-templates
###
### As a solution, this may be applied on the whole cluster based on any of its hosts
###
### What to do when host is just created? CH version is not known prior to CH started and user config is required before CH started.
### We do not have any info about the cluster on initial creation
###
users:
"{clickhouseOperatorUser}/access_management": 1
"{clickhouseOperatorUser}/named_collection_control": 1
"{clickhouseOperatorUser}/show_named_collections": 1
"{clickhouseOperatorUser}/show_named_collections_secrets": 1
profiles:
quotas:
settings:
files:
- version: ">= 23.5"
spec:
configuration:
users:
profiles:
clickhouse_operator/format_display_secrets_in_show_and_select: 1
quotas:
settings:
##
## this may be added on per-host basis into host's conf.d folder
##
display_secrets_in_show_and_select: 1
files:
#################################################
##
## Metrics collection
@@ -352,6 +433,25 @@ configs:
# Upon reaching this timeout metrics collection is aborted and no more metrics are collected in this cycle.
# All collected metrics are returned.
collect: 9
keeper:
configuration:
################################################
##
## Configuration files section
##
################################################
file:
# Each 'path' can be either absolute or relative.
# In case path is absolute - it is used as is
# In case path is relative - it is relative to the folder where configuration file you are reading right now is located.
path:
# Path to the folder where Keeper configuration files common for all instances within a CHK are located.
common: chk/keeper_config.d
# Path to the folder where Keeper configuration files unique for each instance (host) within a CHK are located.
host: chk/conf.d
# Path to the folder where Keeper configuration files with users' settings are located.
# Files are common for all instances within a CHI.
user: chk/users.d
################################################
##
## Template(s) management section
@@ -367,7 +467,17 @@ configs:
# Path to the folder where ClickHouseInstallation templates .yaml manifests are located.
# Templates are added to the list of all templates and used when CHI is reconciled.
# Templates are applied in sorted alpha-numeric order.
path: templates.d
path: chi/templates.d
chk:
# CHK template updates handling policy
# Possible policy values:
# - ReadOnStart. Accept CHIT updates on the operators start only.
# - ApplyOnNextReconcile. Accept CHIT updates at all time. Apply news CHITs on next regular reconcile of the CHI
policy: ApplyOnNextReconcile
# Path to the folder where ClickHouseInstallation templates .yaml manifests are located.
# Templates are added to the list of all templates and used when CHI is reconciled.
# Templates are applied in sorted alpha-numeric order.
path: chk/templates.d
################################################
##
## Reconcile section
@@ -386,9 +496,9 @@ configs:
# 3. The first shard is always reconciled alone. Concurrency starts from the second shard and onward.
# Thus limiting number of shards being reconciled (and thus having hosts down) in each CHI by both number and percentage
# Max number of concurrent shard reconciles within one CHI in progress
# Max number of concurrent shard reconciles within one cluster in progress
reconcileShardsThreadsNumber: 5
# Max percentage of concurrent shard reconciles within one CHI in progress
# Max percentage of concurrent shard reconciles within one cluster in progress
reconcileShardsMaxConcurrencyPercent: 50
# Reconcile StatefulSet scenario
statefulSet:
@@ -429,6 +539,10 @@ configs:
exclude: true
queries: true
include: false
replicas:
all: no
new: yes
delay: 10
################################################
##
## Annotations management section
@@ -473,6 +587,25 @@ configs:
appendScope: "no"
################################################
##
## Metrics management section
##
################################################
metrics:
labels:
exclude: []
################################################
##
## Status management section
##
################################################
status:
fields:
action: false
actions: false
error: false
errors: false
################################################
##
## StatefulSet management section
##
################################################
@@ -631,20 +764,87 @@ configs:
</default>
</profiles>
</yandex>
# additionalResources -- list of additional resources to create (are processed via `tpl` function), useful for create ClickHouse clusters together with clickhouse-operator, look `kubectl explain chi` for details
keeperConfdFiles: null
keeperConfigdFiles:
01-keeper-01-default-config.xml: |
<!-- IMPORTANT -->
<!-- This file is auto-generated -->
<!-- Do not edit this file - all changes would be lost -->
<!-- Edit appropriate template in the following folder: -->
<!-- deploy/builder/templates-config -->
<!-- IMPORTANT -->
<clickhouse>
<keeper_server>
<coordination_settings>
<min_session_timeout_ms>10000</min_session_timeout_ms>
<operation_timeout_ms>10000</operation_timeout_ms>
<raft_logs_level>information</raft_logs_level>
<session_timeout_ms>100000</session_timeout_ms>
</coordination_settings>
<hostname_checks_enabled>true</hostname_checks_enabled>
<log_storage_path>/var/lib/clickhouse-keeper/coordination/logs</log_storage_path>
<snapshot_storage_path>/var/lib/clickhouse-keeper/coordination/snapshots</snapshot_storage_path>
<storage_path>/var/lib/clickhouse-keeper</storage_path>
<tcp_port>2181</tcp_port>
</keeper_server>
<listen_host>::</listen_host>
<listen_host>0.0.0.0</listen_host>
<listen_try>1</listen_try>
<logger>
<console>1</console>
<level>information</level>
</logger>
<max_connections>4096</max_connections>
</clickhouse>
01-keeper-02-readiness.xml: |
<!-- IMPORTANT -->
<!-- This file is auto-generated -->
<!-- Do not edit this file - all changes would be lost -->
<!-- Edit appropriate template in the following folder: -->
<!-- deploy/builder/templates-config -->
<!-- IMPORTANT -->
<clickhouse>
<keeper_server>
<http_control>
<port>9182</port>
<readiness>
<endpoint>/ready</endpoint>
</readiness>
</http_control>
</keeper_server>
</clickhouse>
01-keeper-03-enable-reconfig.xml: |-
<!-- IMPORTANT -->
<!-- This file is auto-generated -->
<!-- Do not edit this file - all changes would be lost -->
<!-- Edit appropriate template in the following folder: -->
<!-- deploy/builder/templates-config -->
<!-- IMPORTANT -->
<clickhouse>
<keeper_server>
<enable_reconfiguration>false</enable_reconfiguration>
</keeper_server>
</clickhouse>
keeperTemplatesdFiles:
readme: |-
Templates in this folder are packaged with an operator and available via 'useTemplate'
keeperUsersdFiles: null
# additionalResources -- list of additional resources to create (processed via `tpl` function),
# useful for create ClickHouse clusters together with clickhouse-operator.
# check `kubectl explain chi` for details
additionalResources: []
# - |
# apiVersion: v1
# kind: ConfigMap
# metadata:
# name: {{ include "altinity-clickhouse-operator.fullname" . }}-cm
# namespace: {{ .Release.Namespace }}
# namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
# - |
# apiVersion: v1
# kind: Secret
# metadata:
# name: {{ include "altinity-clickhouse-operator.fullname" . }}-s
# namespace: {{ .Release.Namespace }}
# namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
# stringData:
# mykey: my-value
# - |
@@ -652,15 +852,16 @@ additionalResources: []
# kind: ClickHouseInstallation
# metadata:
# name: {{ include "altinity-clickhouse-operator.fullname" . }}-chi
# namespace: {{ .Release.Namespace }}
# namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
# spec:
# configuration:
# clusters:
# - name: default
# layout:
# shardsCount: 1
dashboards:
# dashboards.enabled -- provision grafana dashboards as secrets (can be synced by grafana dashboards sidecar https://github.com/grafana/helm-charts/blob/grafana-6.33.1/charts/grafana/values.yaml#L679 )
# dashboards.enabled -- provision grafana dashboards as configMaps (can be synced by grafana dashboards sidecar https://github.com/grafana/helm-charts/blob/grafana-8.3.4/charts/grafana/values.yaml#L778 )
enabled: false
# dashboards.additionalLabels -- labels to add to a secret with dashboards
additionalLabels: