Skip to content

Commit 97f52e8

Browse files
committed
build: add clickhouse integration testing
1 parent 653d019 commit 97f52e8

File tree

9 files changed

+246
-0
lines changed

9 files changed

+246
-0
lines changed

.github/workflows/integration-test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
matrix:
1212
cluster:
1313
- elasticsearch
14+
- clickhouse
1415

1516
steps:
1617
- name: Checkout

integration-test/clickhouse/cluster.sh

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
apiVersion: "clickhouse.altinity.com/v1"
3+
kind: "ClickHouseInstallation"
4+
metadata:
5+
name: "clickhouse"
6+
spec:
7+
configuration:
8+
clusters:
9+
- name: "openedx-demo"
10+
layout:
11+
shardsCount: 1 # Shards have not been tested with Aspects and we don't recommend it.
12+
replicasCount: 1 # Scale as you need/can
13+
templates:
14+
podTemplate: server
15+
volumeClaimTemplate: storage
16+
users:
17+
test/networks/ip:
18+
- "::/0"
19+
test/profile: default
20+
test/password: change_me
21+
test/quota: default
22+
# Default permissions needed for user creation
23+
test/access_management: 1
24+
test/named_collection_control: 1
25+
test/show_named_collections: 1
26+
test/show_named_collections_secrets: 1
27+
zookeeper:
28+
nodes:
29+
- host: chk-clickhouse-keeper-openedx-demo-0-0
30+
- host: chk-clickhouse-keeper-openedx-demo-0-1
31+
- host: chk-clickhouse-keeper-openedx-demo-0-2
32+
files:
33+
# Enable user replication
34+
users-replication.xml: |
35+
<clickhouse>
36+
<user_directories replace="replace">
37+
<users_xml>
38+
<path>/etc/clickhouse-server/users.xml</path>
39+
</users_xml>
40+
<replicated>
41+
<zookeeper_path>/clickhouse/access/</zookeeper_path>
42+
</replicated>
43+
</user_directories>
44+
</clickhouse>
45+
# Enable function replication
46+
functions-replication.xml: |
47+
<clickhouse>
48+
<user_defined_zookeeper_path>/udf</user_defined_zookeeper_path>
49+
</clickhouse>
50+
templates:
51+
podTemplates:
52+
- name: server
53+
spec:
54+
containers:
55+
- name: clickhouse
56+
image: clickhouse/clickhouse-server:24.8
57+
# If you are running a dedicated node group for ClickHouse (and you should)
58+
# make sure to add it tolerations.
59+
# tolerations:
60+
# - key: "clickhouseInstance"
61+
# operator: "Exists"
62+
# effect: "NoSchedule"
63+
# Optional: set the nodegroup name
64+
# nodeSelector:
65+
# eks.amazonaws.com/nodegroup: clickhouse_worker
66+
volumeClaimTemplates:
67+
- name: storage
68+
# Do not delete PV if installation is deleted. If a new ClickHouseInstallation is created
69+
# data will be re-used, allowing recovery of data
70+
reclaimPolicy: Retain
71+
spec:
72+
accessModes:
73+
- ReadWriteOnce
74+
resources:
75+
requests:
76+
storage: 50Gi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
apiVersion: "clickhouse-keeper.altinity.com/v1"
2+
kind: "ClickHouseKeeperInstallation"
3+
metadata:
4+
name: clickhouse-keeper
5+
spec:
6+
configuration:
7+
clusters:
8+
- name: "openedx-demo"
9+
layout:
10+
# ClickHouseKeeper needs at least tree pods to form a Quorum for high
11+
# availability.
12+
replicasCount: 3
13+
settings:
14+
logger/level: "trace"
15+
logger/console: "true"
16+
listen_host: "0.0.0.0"
17+
keeper_server/storage_path: /var/lib/clickhouse-keeper
18+
keeper_server/tcp_port: "2181"
19+
keeper_server/four_letter_word_white_list: "*"
20+
keeper_server/coordination_settings/raft_logs_level: "information"
21+
keeper_server/raft_configuration/server/port: "9444"
22+
prometheus/endpoint: "/metrics"
23+
prometheus/port: "7000"
24+
prometheus/metrics: "true"
25+
prometheus/events: "true"
26+
prometheus/asynchronous_metrics: "true"
27+
prometheus/status_info: "false"
28+
templates:
29+
podTemplates:
30+
- name: default
31+
spec:
32+
# affinity removed to allow use in single node test environment
33+
# affinity:
34+
# podAntiAffinity:
35+
# requiredDuringSchedulingIgnoredDuringExecution:
36+
# - labelSelector:
37+
# matchExpressions:
38+
# - key: "app"
39+
# operator: In
40+
# values:
41+
# - clickhouse-keeper
42+
# topologyKey: "kubernetes.io/hostname"
43+
containers:
44+
- name: clickhouse-keeper
45+
imagePullPolicy: IfNotPresent
46+
# Make sure to keep this up to date with the ClickHouse compatible version
47+
image: "clickhouse/clickhouse-keeper:24.8-alpine"
48+
resources:
49+
requests:
50+
memory: "256M"
51+
cpu: "0.25"
52+
limits:
53+
memory: "1Gi"
54+
cpu: "1"
55+
priorityClassName: clickhouse-priority
56+
volumeClaimTemplates:
57+
- name: default
58+
spec:
59+
accessModes:
60+
- ReadWriteOnce
61+
resources:
62+
requests:
63+
storage: 10Gi
64+
- name: snapshot-storage-path
65+
spec:
66+
accessModes:
67+
- ReadWriteOnce
68+
resources:
69+
requests:
70+
storage: 10Gi
71+
- name: log-storage-path
72+
spec:
73+
accessModes:
74+
- ReadWriteOnce
75+
resources:
76+
requests:
77+
storage: 10Gi
78+
79+
---
80+
apiVersion: scheduling.k8s.io/v1
81+
kind: PriorityClass
82+
metadata:
83+
name: clickhouse-priority
84+
value: 1000000
85+
globalDefault: false
86+
description: "This priority class should be used for ClickHouse service pods only."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
ENABLE_HTTPS: true
2+
ENABLE_WEB_PROXY: false
3+
K8S_HARMONY_NAMESPACE: openedx-harmony
4+
K8S_NAMESPACE: openedx-demo
5+
LMS_HOST: local.openedx.io
6+
PLUGINS:
7+
- k8s_harmony
8+
- mfe
9+
- aspects
10+
DOCKER_IMAGE_OPENEDX: edunext/openedx-aspects:1.2.0
11+
PLUGIN_INDEXES:
12+
- https://overhang.io/tutor/main
13+
14+
# Aspects settings
15+
CLICKHOUSE_ADMIN_PASSWORD: change_me
16+
CLICKHOUSE_ADMIN_USER: test
17+
CLICKHOUSE_CLUSTER_NAME: openedx-demo
18+
# Set the first ClickHouse node as the DDL node.
19+
CLICKHOUSE_CLUSTER_DDL_NODE_HOST: chi-clickhouse-{{CLICKHOUSE_CLUSTER_NAME}}-0-0.{{K8S_HARMONY_NAMESPACE}}
20+
CLICKHOUSE_HOST: clickhouse-clickhouse.{{K8S_HARMONY_NAMESPACE}}
21+
CLICKHOUSE_SECURE_CONNECTION: false
22+
RUN_CLICKHOUSE: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Run any arbitrary commands necessary to verify the installation is working
2+
echo "Make sure to change this script to verify your installation is tested correctly"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export HARMONY_NAMESPACE=$(tutor config printvalue K8S_HARMONY_NAMESPACE)
2+
kubectl apply -f clickhouse-keeper.yml -n "$K8S_HARMONY_NAMESPACE" --wait
3+
kubectl apply -f clickhouse-installation.yml -n "$K8S_HARMONY_NAMESPACE" --wait
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
../../../tutor-contrib-harmony-plugin
2+
tutor<19
3+
tutor-contrib-aspects==1.2.0
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Disable HTTPS cert provisioning for testing with minikube
2+
cert-manager:
3+
enabled: false
4+
5+
ingress-nginx:
6+
# Use ingress-nginx as a default controller.
7+
enabled: true
8+
controller:
9+
# All these needed for local development
10+
service:
11+
type: NodePort
12+
hostPort:
13+
enabled: true
14+
publishService:
15+
enabled: false
16+
extraArgs:
17+
publish-status-address: localhost
18+
19+
clusterDomain: harmony.test
20+
21+
elasticsearch:
22+
enabled: false
23+
24+
# TODO: move this to a separate PR
25+
# Permit co-located instances for solitary minikube virtual machines.
26+
antiAffinity: "soft"
27+
28+
volumeClaimTemplate:
29+
resources:
30+
requests:
31+
storage: 8Gi
32+
replicas: 1
33+
34+
opensearch:
35+
enabled: false
36+
37+
# Permit co-located instances for solitary minikube virtual machines.
38+
antiAffinity: "soft"
39+
40+
persistence:
41+
size: 8Gi
42+
43+
prometheusstack:
44+
enabled: true
45+
46+
k8sdashboard:
47+
enabled: false
48+
49+
openfaas:
50+
enabled: false
51+
52+
clickhouse-operator:
53+
enabled: true

0 commit comments

Comments
 (0)