Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: clone clickhouse chart #71

Merged
merged 2 commits into from
May 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ jobs:
with:
command: package main/sentry --destination gh-pages/charts


- name: Build zips
uses: yeouchien/helm3-action@f3a7c239c5c60777210c8e631839edf5dd3fa29c
with:
command: package main/clickhouse --destination gh-pages/charts

- name: Create index file
uses: yeouchien/helm3-action@f3a7c239c5c60777210c8e631839edf5dd3fa29c
with:
Expand Down
21 changes: 21 additions & 0 deletions clickhouse/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
13 changes: 13 additions & 0 deletions clickhouse/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
appVersion: "19.14"
description: ClickHouse is an open source column-oriented database management system
capable of real time generation of analytical data reports using SQL queries
home: https://clickhouse.yandex/
icon: https://clickhouse.yandex/images/logo.png
keywords:
- clickhouse
- olap
- database
name: clickhouse
sources:
- https://github.com/sentry-kubernetes/charts
version: 1.0.0
169 changes: 169 additions & 0 deletions clickhouse/README.md

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions clickhouse/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
** Please be patient while the chart is being deployed **

1. Get the Clickhouse URL by running:

{{- if .Values.clickhouse.ingress.enabled }}

export HOSTNAME=$(kubectl get ingress --namespace {{ .Release.Namespace }} {{ template "clickhouse.fullname" . }} -o jsonpath='{.spec.rules[0].host}')
echo "Clickhouse URL: http://$HOSTNAME/"

{{- else }}

echo URL : http://127.0.0.1:8080/
echo Management URL : http://127.0.0.1:8080/manager
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "clickhouse.fullname" . }} 8123:{{ .Values.clickhouse.http_port }}
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "clickhouse.fullname" . }} 9000:{{ .Values.clickhouse.tcp_port }}
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "clickhouse.fullname" . }} 9009:{{ .Values.clickhouse.interserver_http_port }}

{{- end }}

2. Get the Tabix URL by running:

{{- if .Values.tabix.ingress.enabled }}

export HOSTNAME=$(kubectl get ingress --namespace {{ .Release.Namespace }} {{ template "clickhouse.fullname" . }}-tabix -o jsonpath='{.spec.rules[0].host}')
echo "Tabix URL: http://$HOSTNAME/"

{{- else }}

kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "clickhouse.fullname" . }}-tabix 80

{{- end }}
56 changes: 56 additions & 0 deletions clickhouse/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "clickhouse.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "clickhouse.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "clickhouse.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create clickhouse path.
if .Values.clickhouse.path is empty, default value "/var/lib/clickhouse".
*/}}
{{- define "clickhouse.fullpath" -}}
{{- if .Values.clickhouse.path -}}
{{- .Values.clickhouse.path | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s" "/var/lib/clickhouse" -}}
{{- end -}}
{{- end -}}

{{/*
Create clickhouse log path.
if .Values.clickhouse.configmap.logger.path is empty, default value "/var/log/clickhouse-server".
*/}}
{{- define "clickhouse.logpath" -}}
{{- if .Values.clickhouse.configmap.logger.path -}}
{{- .Values.clickhouse.configmap.logger.path | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s" "/var/log/clickhouse-server" -}}
{{- end -}}
{{- end -}}
112 changes: 112 additions & 0 deletions clickhouse/templates/configmap-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{{- if .Values.clickhouse.configmap.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "clickhouse.fullname" . }}-config
labels:
app.kubernetes.io/name: {{ include "clickhouse.name" . }}-config
app.kubernetes.io/instance: {{ .Release.Name }}-config
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
config.xml: |-
<?xml version="1.0"?>
<yandex>
<path>{{ include "clickhouse.fullpath" . }}/</path>
<tmp_path>{{ printf "%s/tmp/" (include "clickhouse.fullpath" .) }}</tmp_path>
<user_files_path>{{ printf "%s/user_files/" (include "clickhouse.fullpath" .) }}</user_files_path>
<format_schema_path>{{ printf "%s/format_schemas/" (include "clickhouse.fullpath" .) }}</format_schema_path>

<include_from>/etc/clickhouse-server/metrica.d/metrica.xml</include_from>

<users_config>users.xml</users_config>

<display_name>{{ template "clickhouse.fullname" . }}</display_name>
<listen_host>0.0.0.0</listen_host>
<http_port>{{ .Values.clickhouse.http_port | default "8123" }}</http_port>
<tcp_port>{{ .Values.clickhouse.tcp_port | default "9000" }}</tcp_port>
<interserver_http_port>{{ .Values.clickhouse.interserver_http_port | default "9009" }}</interserver_http_port>
<max_connections>{{ .Values.clickhouse.configmap.max_connections | default "4096" }}</max_connections>
<keep_alive_timeout>{{ .Values.clickhouse.configmap.keep_alive_timeout | default "3" }}</keep_alive_timeout>
<max_concurrent_queries>{{ .Values.clickhouse.configmap.max_concurrent_queries | default "100" }}</max_concurrent_queries>
<uncompressed_cache_size>{{ .Values.clickhouse.configmap.uncompressed_cache_size | default "8589934592" }}</uncompressed_cache_size>
<mark_cache_size>{{ .Values.clickhouse.configmap.mark_cache_size | default "5368709120" }}</mark_cache_size>
<timezone>{{ .Values.timezone | default "Asia/Shanghai" }}</timezone>
<umask>{{ .Values.clickhouse.configmap.umask | default "027" }}</umask>
<mlock_executable>{{ .Values.clickhouse.configmap.mlock_executable | default "false" }}</mlock_executable>
<remote_servers incl="clickhouse_remote_servers" optional="true" />
<zookeeper incl="zookeeper-servers" optional="true" />
<macros incl="macros" optional="true" />
<builtin_dictionaries_reload_interval>{{ .Values.clickhouse.configmap.builtin_dictionaries_reload_interval | default "3600" }}</builtin_dictionaries_reload_interval>
<max_session_timeout>{{ .Values.clickhouse.configmap.max_session_timeout | default "3600" }}</max_session_timeout>
<default_session_timeout>{{ .Values.clickhouse.configmap.default_session_timeout | default "60" }}</default_session_timeout>
<disable_internal_dns_cache>{{ .Values.clickhouse.configmap.disable_internal_dns_cache | default "1" }}</disable_internal_dns_cache>

<query_log>
<database>system</database>
<table>query_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_log>

<query_thread_log>
<database>system</database>
<table>query_thread_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_thread_log>

<distributed_ddl>
<path>/clickhouse/task_queue/ddl</path>
</distributed_ddl>

{{- if .Values.clickhouse.configmap.logger }}
<logger>
<level>{{ .Values.clickhouse.configmap.logger.level | default "trace" }}</level>
<log>{{ printf "%s/%s" (include "clickhouse.logpath" .) "clickhouse-server.log" }}</log>
<errorlog>{{ printf "%s/%s" (include "clickhouse.logpath" .) "clickhouse-server.err.log" }}</errorlog>
<size>{{ .Values.clickhouse.configmap.logger.size | default "1000M" }}</size>
<count>{{ .Values.clickhouse.configmap.logger.count | default "10" }}</count>
</logger>
{{- end }}

{{- if .Values.clickhouse.configmap.compression.enabled }}
<compression incl="clickhouse_compression">
{{- range .Values.clickhouse.configmap.compression.cases }}
{{- with . }}
<case>
<min_part_size>{{ .min_part_size }}</min_part_size>
<min_part_size_ratio>{{ .min_part_size_ratio }}</min_part_size_ratio>
<method>{{ .method }}</method>
</case>
{{- end }}
{{- end }}
</compression>
{{- end }}

{{- if .Values.clickhouse.configmap.graphite.enabled }}
{{- range .Values.clickhouse.configmap.graphite.config }}
{{- with . }}
<graphite>
<host>{{ template "clickhouse.fullname" $ }}-graphite.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}</host>
<port>{{ $.Values.clickhouse.graphite.service.port }}</port>
<timeout>{{ .timeout | default "0.1" }}</timeout>
<interval>{{ .interval | default "60" }}</interval>
<root_path>{{ .root_path | default "one_min" }}</root_path>
<metrics>{{ .metrics | default "true" }}</metrics>
<events>{{ .events | default "true" }}</events>
<events_cumulative>{{ .events_cumulative | default "true" }}</events_cumulative>
<asynchronous_metrics>{{ .asynchronous_metrics | default "true" }}</asynchronous_metrics>
</graphite>
{{- end }}
{{- end }}
{{- end }}

{{- if .Values.clickhouse.configmap.max_open_files }}
<max_open_files>{{ .Values.clickhouse.configmap.max_open_files }}</max_open_files>
{{- end }}

{{- if .Values.clickhouse.configmap.interserver_http_host }}
<interserver_http_host>{{ .Values.clickhouse.configmap.interserver_http_host }}</interserver_http_host>
{{- end }}
</yandex>
{{- end }}
77 changes: 77 additions & 0 deletions clickhouse/templates/configmap-metrika.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{{- if .Values.clickhouse.configmap.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "clickhouse.fullname" . }}-metrica
labels:
app.kubernetes.io/name: {{ include "clickhouse.name" . }}-metrica
app.kubernetes.io/instance: {{ .Release.Name }}-metrica
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
metrica.xml: |-
<?xml version="1.0"?>
<yandex>
{{- if .Values.clickhouse.configmap.zookeeper_servers.enabled }}
<zookeeper-servers>
{{- range .Values.clickhouse.configmap.zookeeper_servers.config }}
{{- with . }}
<node index={{ .index | quote }}>
<host>{{ .host }}</host>
<port>{{ .port }}</port>
</node>
{{- end }}
{{- end }}
<session_timeout_ms>{{ .Values.clickhouse.configmap.zookeeper_servers.session_timeout_ms }}</session_timeout_ms>
<operation_timeout_ms>{{ .Values.clickhouse.configmap.zookeeper_servers.operation_timeout_ms }}</operation_timeout_ms>
<root>{{ .Values.clickhouse.configmap.zookeeper_servers.root }}</root>
<identity>{{ .Values.clickhouse.configmap.zookeeper_servers.identity }}</identity>
</zookeeper-servers>
{{- end }}

{{- if .Values.clickhouse.configmap.remote_servers.enabled }}
<clickhouse_remote_servers>
<{{ include "clickhouse.fullname" . }}>
{{- range untilStep 0 (int .Values.clickhouse.replicas) 1 }}
<shard>
<replica>
<internal_replication>{{ $.Values.clickhouse.configmap.remote_servers.internal_replication | default "false" }}</internal_replication>
<host>{{ include "clickhouse.fullname" $ }}-{{ . }}.{{ include "clickhouse.fullname" $ }}-headless.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}</host>
<port>{{ $.Values.clickhouse.tcp_port}}</port>
{{- if $.Values.clickhouse.configmap.remote_servers.replica.user }}
<user>{{ $.Values.clickhouse.configmap.remote_servers.replica.user }}</user>
{{- end }}
{{- if $.Values.clickhouse.configmap.remote_servers.replica.password }}
<password>{{ $.Values.clickhouse.configmap.remote_servers.replica.password }}</password>
{{- end }}
{{- if $.Values.clickhouse.configmap.remote_servers.replica.secure }}
<secure>{{ $.Values.clickhouse.configmap.remote_servers.replica.secure }}</secure>
{{- end }}
{{- if $.Values.clickhouse.configmap.remote_servers.replica.compression }}
<compression>{{ $.Values.clickhouse.configmap.remote_servers.replica.compression }}</compression>
{{- end }}
</replica>
{{- if $.Values.clickhouse.configmap.remote_servers.replica.backup.enabled }}
<replica>
<host>{{ include "clickhouse.fullname" $ }}-replica-{{ . }}.{{ include "clickhouse.fullname" $ }}-replica-headless.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}</host>
<port>{{ $.Values.clickhouse.tcp_port}}</port>
{{- if $.Values.clickhouse.configmap.remote_servers.replica.user }}
<user>{{ $.Values.clickhouse.configmap.remote_servers.replica.user }}</user>
{{- end }}
{{- if $.Values.clickhouse.configmap.remote_servers.replica.password }}
<password>{{ $.Values.clickhouse.configmap.remote_servers.replica.password }}</password>
{{- end }}
{{- if $.Values.clickhouse.configmap.remote_servers.replica.secure }}
<secure>{{ $.Values.clickhouse.configmap.remote_servers.replica.secure }}</secure>
{{- end }}
{{- if $.Values.clickhouse.configmap.remote_servers.replica.compression }}
<compression>{{ $.Values.clickhouse.configmap.remote_servers.replica.compression }}</compression>
{{- end }}
</replica>
{{- end }}
</shard>
{{- end }}
</{{ include "clickhouse.fullname" . }}>
</clickhouse_remote_servers>
{{- end }}
</yandex>
{{- end }}
68 changes: 68 additions & 0 deletions clickhouse/templates/configmap-users.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{- if .Values.clickhouse.configmap.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "clickhouse.fullname" . }}-users
labels:
app.kubernetes.io/name: {{ include "clickhouse.name" . }}-users
app.kubernetes.io/instance: {{ .Release.Name }}-users
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
users.xml: |-
<?xml version="1.0"?>
<yandex>
{{- if .Values.clickhouse.configmap.profiles.enabled }}
<profiles>
{{- range .Values.clickhouse.configmap.profiles.profile }}
{{- with . }}
<{{ .name }}>
{{- range $k_1, $v_1 := .config }}
<{{ $k_1 }}>{{ $v_1 }}</{{ $k_1 }}>
{{- end }}
</{{ .name }}>
{{- end }}
{{- end }}
</profiles>
{{- end }}

{{- if .Values.clickhouse.configmap.users.enabled }}
<users>
{{- range $key, $value := .Values.clickhouse.configmap.users.user }}
{{- with . }}
<{{ .name }}>
{{- range $k_1, $v_1 := .config }}
{{- if (eq "networks" $k_1) }}
<networks incl="networks" replace="replace">
{{- range $v_1 }}
{{- with .}}
<ip>{{ . }}</ip>
{{- end }}
{{- end }}
</networks>
{{- else }}
<{{ $k_1 }}>{{ $v_1 }}</{{ $k_1 }}>
{{- end }}
{{- end }}
</{{ .name }}>
{{- end }}
{{- end }}
</users>
{{- end }}

{{- if .Values.clickhouse.configmap.quotas.enabled }}
<quotas>
{{- range $key, $value := .Values.clickhouse.configmap.quotas.quota }}
{{- with . }}
<{{ .name }}>
{{- range $val := .config }}
{{- range $k_1, $v_1 := $val }}
<{{ $k_1 }}>{{ $v_1 }}</{{ $k_1 }}>
{{- end }}
{{- end }}
</{{ .name }}>
{{- end }}
{{- end }}
</quotas>
{{- end }}
</yandex>
{{- end }}
Loading