Skip to content

Commit a8af85a

Browse files
authored
Merge pull request #197 from Altinity/0.7.0
0.7.0
2 parents 185a43b + b81cf16 commit a8af85a

File tree

65 files changed

+3017
-586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3017
-586
lines changed

.circleci/config.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
version: 2
22
jobs:
3-
build:
3+
build_release:
44
machine:
55
enabled: true
66
steps:
77
- checkout
88
- run:
99
name: Building Docker images
1010
command: |
11-
echo 'export CHO_RELEASE=$(cat release)' >> $BASH_ENV
1211
docker build -f dockerfile/operator/Dockerfile -t clickhouse-operator:latest .
1312
docker build -f dockerfile/metrics-exporter/Dockerfile -t metrics-exporter:latest .
14-
deploy_release:
15-
machine:
16-
enabled: true
17-
steps:
1813
- run:
1914
name: Pushing Docker image
2015
command: |
@@ -30,40 +25,38 @@ jobs:
3025
docker push $COMPANY_REPO/clickhouse-operator:$CHO_RELEASE
3126
docker push $COMPANY_REPO/metrics-exporter:latest
3227
docker push $COMPANY_REPO/metrics-exporter:$CHO_RELEASE
33-
deploy_dev:
28+
build_dev:
3429
machine:
3530
enabled: true
3631
steps:
32+
- checkout
33+
- run:
34+
name: Building Docker images
35+
command: |
36+
docker build -f dockerfile/operator/Dockerfile -t clickhouse-operator:dev .
37+
docker build -f dockerfile/metrics-exporter/Dockerfile -t metrics-exporter:dev .
3738
- run:
38-
requires: build
3939
name: Pushing Docker image
4040
command: |
41-
docker tag clickhouse-operator:latest $COMPANY_REPO/clickhouse-operator:dev
42-
docker tag metrics-exporter:latest $COMPANY_REPO/metrics-exporter:dev
41+
docker tag clickhouse-operator:dev $COMPANY_REPO/clickhouse-operator:dev
42+
docker tag metrics-exporter:dev $COMPANY_REPO/metrics-exporter:dev
4343
4444
docker login -u $DOCKER_USER -p $DOCKER_PASS
4545
4646
docker push $COMPANY_REPO/clickhouse-operator:dev
4747
docker push $COMPANY_REPO/metrics-exporter:dev
4848
workflows:
4949
version: 2
50-
deploy:
50+
build_and_deploy:
5151
jobs:
52-
- build:
53-
filters:
54-
branches:
55-
ignore:
56-
- vladislav-dev
57-
- deploy_release:
58-
requires:
59-
- build
52+
- build_release:
6053
filters:
6154
branches:
6255
only: master
63-
- deploy_dev:
64-
requires:
65-
- build
56+
- build_dev:
6657
filters:
6758
branches:
6859
ignore:
6960
- master
61+
- /.*dev.*/
62+

cmd/operator/app/clickhouse_operator.go

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,26 @@ import (
4242

4343
// Prometheus exporter defaults
4444
const (
45-
defaultMetricsEndpoint = ":8888"
46-
metricsPath = "/metrics"
47-
defaultInformerFactoryResyncPeriod = 10 * time.Second
45+
defaultMetricsEndpoint = ":8888"
46+
metricsPath = "/metrics"
47+
defaultInformerFactoryResyncPeriod = 60 * time.Second
48+
defaultInformerFactoryResyncDebugPeriod = 600 * time.Second
4849
)
4950

50-
// Default number of controller threads running concurrently (used in case no other specified in config)
5151
const (
52-
defaultControllerThreadsNum = 10
52+
// TODO probably this should be added as a CLI/Config param
53+
// Default number of controller threads running concurrently (used in case no other specified in config)
54+
defaultControllerThreadsNum = 1
5355
)
5456

5557
// CLI parameter variables
5658
var (
5759
// versionRequest defines request for clickhouse-operator version report. Operator should exit after version printed
5860
versionRequest bool
5961

62+
// debugRequest defines request for clickhouse-operator debug run
63+
debugRequest bool
64+
6065
// chopConfigFile defines path to clickhouse-operator config file to be used
6166
chopConfigFile string
6267

@@ -81,6 +86,7 @@ var (
8186

8287
func init() {
8388
flag.BoolVar(&versionRequest, "version", false, "Display clickhouse-operator version and exit")
89+
flag.BoolVar(&debugRequest, "debug", false, "Debug run")
8490
flag.StringVar(&chopConfigFile, "config", "", "Path to clickhouse-operator config file.")
8591
flag.StringVar(&kubeConfigFile, "kubeconfig", "", "Path to kubernetes config file. Only required if called outside of the cluster.")
8692
flag.StringVar(&masterURL, "master", "", "The address of the Kubernetes API server. Only required if called outside of the cluster and not being specified in kube config file.")
@@ -143,6 +149,11 @@ func Run() {
143149
os.Exit(0)
144150
}
145151

152+
if debugRequest {
153+
kubeInformerFactoryResyncPeriod = defaultInformerFactoryResyncDebugPeriod
154+
chopInformerFactoryResyncPeriod = defaultInformerFactoryResyncDebugPeriod
155+
}
156+
146157
glog.V(1).Infof("Starting clickhouse-operator. Version:%s GitSHA:%s\n", version.Version, version.GitSHA)
147158

148159
//

config/config-dev.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
################################################
2+
##
3+
## Watch Namespaces Section
4+
##
5+
################################################
6+
7+
# List of namespaces where clickhouse-operator watches for events.
8+
# Concurrently running operators should watch on different namespaces
9+
watchNamespaces:
10+
- dev
11+
# - info
12+
# - onemore
13+
14+
################################################
15+
##
16+
## Additional Configuration Files Section
17+
##
18+
################################################
19+
20+
# Path to folder where ClickHouse configuration files common for all instances within CHI are located.
21+
chCommonConfigsPath: config.d
22+
23+
# Path to folder where ClickHouse configuration files unique for each instance (host) within CHI are located.
24+
chHostConfigsPath: conf.d
25+
26+
# Path to folder where ClickHouse configuration files with users settings are located.
27+
# Files are common for all instances within CHI
28+
chUsersConfigsPath: users.d
29+
30+
# Path to folder where ClickHouseInstallation .yaml manifests are located.
31+
# Manifests are applied in sorted alpha-numeric order
32+
chiTemplatesPath: templates.d
33+
34+
################################################
35+
##
36+
## Cluster Create/Update/Delete Objects Section
37+
##
38+
################################################
39+
40+
# How many seconds to wait for created/updated StatefulSet to be Ready
41+
statefulSetUpdateTimeout: 600
42+
43+
# How many seconds to wait between checks for created/updated StatefulSet status
44+
statefulSetUpdatePollPeriod: 10
45+
46+
# What to do in case created StatefulSet is not in Ready after `statefulSetUpdateTimeout` seconds
47+
# Possible options:
48+
# 1. abort - do nothing, just break the process and wait for admin
49+
# 2. delete - delete newly created problematic StatefulSet
50+
onStatefulSetCreateFailureAction: delete
51+
52+
# What to do in case updated StatefulSet is not in Ready after `statefulSetUpdateTimeout` seconds
53+
# Possible options:
54+
# 1. abort - do nothing, just break the process and wait for admin
55+
# 2. rollback - delete Pod and rollback StatefulSet to previous Generation.
56+
# Pod would be recreated by StatefulSet based on rollback-ed configuration
57+
onStatefulSetUpdateFailureAction: rollback
58+
59+
################################################
60+
##
61+
## ClickHouse Settings Section
62+
##
63+
################################################
64+
65+
# Default values for ClickHouse user configuration
66+
# 1. user/profile - string
67+
# 2. user/quota - string
68+
# 3. user/networks/ip - multiple strings
69+
# 4. user/password - string
70+
chConfigUserDefaultProfile: default
71+
chConfigUserDefaultQuota: default
72+
chConfigUserDefaultNetworksIP:
73+
- "::/0"
74+
chConfigUserDefaultPassword: "default"
75+
76+
################################################
77+
##
78+
## Operator's access to ClickHouse instances
79+
##
80+
################################################
81+
82+
# ClickHouse credentials (username, password and port) to be used by operator to connect to ClickHouse instances for:
83+
# 1. Metrics requests
84+
# 2. Schema maintenance
85+
# 3. DROP DNS CACHE
86+
# User with such credentials credentials can be specified in additional ClickHouse .xml config files,
87+
# located in `chUsersConfigsPath` folder
88+
chUsername: clickhouse_operator
89+
chPassword: clickhouse_operator_password
90+
chPort: 8123

config/templates.d/001-templates.json renamed to config/templates.d/001-templates.json.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"apiVersion": "clickhouse.altinity.com/v1",
3-
"kind": "ClickHouseInstallation",
3+
"kind": "ClickHouseInstallationTemplate",
44
"metadata": {
55
"name": "01-default-volumeclaimtemplate"
66
},
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: "clickhouse.altinity.com/v1"
2+
kind: "ClickHouseInstallationTemplate"
3+
metadata:
4+
name: "default-oneperhost-pod-template"
5+
spec:
6+
templates:
7+
podTemplates:
8+
- name: default-oneperhost-pod-template
9+
distribution: "OnePerHost"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: "clickhouse.altinity.com/v1"
2+
kind: "ClickHouseInstallationTemplate"
3+
metadata:
4+
name: "default-storage-template-2Gi"
5+
spec:
6+
templates:
7+
volumeClaimTemplates:
8+
- name: default-storage-template-2Gi
9+
spec:
10+
accessModes:
11+
- ReadWriteOnce
12+
resources:
13+
requests:
14+
storage: 2Gi

config/templates.d/readme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Templates in this folder are packaged with an operator and available via 'useTemplate'

0 commit comments

Comments
 (0)