Skip to content

Commit

Permalink
delete extra logs, fix ch for cozy (#431)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a local hook to generate a versions map and check for
changes.
- Added new configuration options for ClickHouse, including enhanced
logging, user management, and structured templates.
- New parameters for persistent volume size and Docker image
specifications in ClickHouse configuration.
- Added hostname matching capabilities in ClickHouse operator
configuration.

- **Bug Fixes**
	- Updated exclusion patterns for YAML files in pre-commit hooks.

- **Version Updates**
	- Incremented ClickHouse chart version from 0.5.0 to 0.6.0.
- Updated versioning for several packages, including `clickhouse` and
`tenant`.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Andrei Kvapil <[email protected]>
  • Loading branch information
klinch0 and kvaps authored Oct 21, 2024
1 parent 2578756 commit 18bbdb6
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/apps/clickhouse/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.0
version: 0.6.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
Expand Down
14 changes: 8 additions & 6 deletions packages/apps/clickhouse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ more details:

### Common parameters

| Name | Description | Value |
| -------------- | ----------------------------------- | ------ |
| `size` | Persistent Volume size | `10Gi` |
| `shards` | Number of Clickhouse replicas | `1` |
| `replicas` | Number of Clickhouse shards | `2` |
| `storageClass` | StorageClass used to store the data | `""` |
| Name | Description | Value |
| ---------------- | ----------------------------------- | ------ |
| `size` | Persistent Volume size | `10Gi` |
| `logStorageSize` | Persistent Volume for logs size | `2Gi` |
| `shards` | Number of Clickhouse replicas | `1` |
| `replicas` | Number of Clickhouse shards | `2` |
| `storageClass` | StorageClass used to store the data | `""` |
| `logTTL` | for query_log and query_thread_log | `15` |

### Configuration parameters

Expand Down
83 changes: 75 additions & 8 deletions packages/apps/clickhouse/templates/clickhouse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ kind: "ClickHouseInstallation"
metadata:
name: "{{ .Release.Name }}"
spec:
{{- with .Values.size }}
namespaceDomainPattern: "%s.svc.cozy.local"
defaults:
templates:
dataVolumeClaimTemplate: data-volume-template
{{- end }}
podTemplate: clickhouse-per-host
serviceTemplate: svc-template
configuration:
{{- with $users }}
users:
Expand All @@ -46,24 +47,90 @@ spec:
{{ $name }}/networks/ip: ["::/0"]
{{- end }}
{{- end }}
files:
config.d/z_log_disable.xml: |
<clickhouse>
<asynchronous_metric_log remove="1"/>
<metric_log remove="1"/>
<query_views_log remove="1" />
<part_log remove="1"/>
<session_log remove="1"/>
<text_log remove="1" />
<trace_log remove="1"/>
<crash_log remove="1"/>
<opentelemetry_span_log remove="1"/>
<processors_profile_log remove="1"/>
</clickhouse>
config.d/query_log_ttl.xml: |
<clickhouse>
<query_log replace="1">
<database>system</database>
<table>query_log</table>
<engine>ENGINE = MergeTree PARTITION BY (event_date)
ORDER BY (event_time)
TTL event_date + INTERVAL {{ .Values.logTTL }} DAY DELETE
</engine>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_log>
<query_thread_log replace="1">
<database>system</database>
<table>query_thread_log</table>
<engine>ENGINE = MergeTree PARTITION BY (event_date)
ORDER BY (event_time)
TTL event_date + INTERVAL {{ .Values.logTTL }} DAY DELETE
</engine>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_thread_log>
</clickhouse>
profiles:
readonly/readonly: "1"
clusters:
- name: "clickhouse"
layout:
shardsCount: {{ .Values.shards }}
replicasCount: {{ .Values.replicas }}
{{- with .Values.size }}
templates:
volumeClaimTemplates:
- name: data-volume-template
spec:
accessModes:
- ReadWriteOnce
{{- with $.Values.storageClass }}
storageClassName: {{ . }}
{{- end }}
resources:
requests:
storage: {{ . }}
{{- end }}
storage: {{ .Values.size }}
- name: log-volume-template
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.logStorageSize }}
podTemplates:
- name: clickhouse-per-host
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "clickhouse.altinity.com/chi"
operator: In
values:
- "{{ .Release.Name }}"
topologyKey: "kubernetes.io/hostname"
containers:
- name: clickhouse
volumeMounts:
- name: data-volume-template
mountPath: /var/lib/clickhouse
- name: log-volume-template
mountPath: /var/log/clickhouse-server
serviceTemplates:
- name: svc-template
generateName: chendpoint-{chi}
spec:
ports:
- name: http
port: 8123
- name: tcp
port: 9000
10 changes: 10 additions & 0 deletions packages/apps/clickhouse/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
"description": "Persistent Volume size",
"default": "10Gi"
},
"logStorageSize": {
"type": "string",
"description": "Persistent Volume for logs size",
"default": "2Gi"
},
"shards": {
"type": "number",
"description": "Number of Clickhouse replicas",
Expand All @@ -22,6 +27,11 @@
"description": "StorageClass used to store the data",
"default": ""
},
"logTTL": {
"type": "number",
"description": "for query_log and query_thread_log",
"default": 15
},
"backup": {
"type": "object",
"properties": {
Expand Down
4 changes: 4 additions & 0 deletions packages/apps/clickhouse/values.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
## @section Common parameters

## @param size Persistent Volume size
## @param logStorageSize Persistent Volume for logs size
## @param shards Number of Clickhouse replicas
## @param replicas Number of Clickhouse shards
## @param storageClass StorageClass used to store the data
## @param logTTL for query_log and query_thread_log
##
size: 10Gi
logStorageSize: 2Gi
shards: 1
replicas: 2
storageClass: ""
logTTL: 15

## @section Configuration parameters

Expand Down
3 changes: 2 additions & 1 deletion packages/apps/versions_map
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ clickhouse 0.2.0 7cd7de73
clickhouse 0.2.1 5ca8823
clickhouse 0.3.0 b00621e
clickhouse 0.4.0 320fc32
clickhouse 0.5.0 HEAD
clickhouse 0.5.0 2a4768a5
clickhouse 0.6.0 HEAD
ferretdb 0.1.0 4ffa8615
ferretdb 0.1.1 5ca8823
ferretdb 0.2.0 adaf603
Expand Down
4 changes: 4 additions & 0 deletions packages/system/clickhouse-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ altinity-clickhouse-operator:
config.yaml:
watch:
namespaces: [".*"]
clickhouse:
configuration:
network:
hostRegexpTemplate: "(chi-{chi}-[^.]+\\d+-\\d+|clickhouse\\-{chi})\\.{namespace}\\.svc\\.cozy\\.local$"

0 comments on commit 18bbdb6

Please sign in to comment.