-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from Altinity/release-0.2.2
Release 0.2.2
- Loading branch information
Showing
41 changed files
with
1,808 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ | |
|
||
# Skip log folder | ||
log | ||
dev/log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# Build clickhouse-operator | ||
# Do not forget to update version | ||
|
||
source ./binary_build_config.sh | ||
|
||
#CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ${CUR_DIR}/clickhouse-operator ${SRC_ROOT}/cmd/clickhouse-operator | ||
CGO_ENABLED=0 go build -o ${OPERATOR_BIN} ${SRC_ROOT}/cmd/clickhouse-operator | ||
|
||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# Build configuration options | ||
|
||
CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
SRC_ROOT=$(realpath ${CUR_DIR}/..) | ||
OPERATOR_BIN=${CUR_DIR}/clickhouse-operator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# Delete clickhouse-operator | ||
# Do not forget to update version | ||
|
||
source ./binary_build_config.sh | ||
|
||
rm -f ${OPERATOR_BIN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Production docker image builder | ||
|
||
# Externally configurable build-dependent options | ||
TAG="${TAG:-altinity/clickhouse-operator:dev}" | ||
DOCKERHUB_LOGIN="${DOCKERHUB_LOGIN:-altinitybuilds}" | ||
DOCKERHUB_PUBLISH="${DOCKERHUB_PUBLISH:-yes}" | ||
MINIKUBE="${MINIKUBE:-no}" | ||
|
||
TAG="${TAG}" \ | ||
DOCKERHUB_LOGIN="${DOCKERHUB_LOGIN}" \ | ||
DOCKERHUB_PUBLISH="${DOCKERHUB_PUBLISH}" \ | ||
MINIKUBE="${MINIKUBE}" \ | ||
./image_build_universal.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Dev docker image builder | ||
|
||
# Externally configurable build-dependent options | ||
TAG="${TAG:-sunsingerus/clickhouse-operator:dev}" | ||
DOCKERHUB_LOGIN="${DOCKERHUB_LOGIN:-sunsingerus}" | ||
DOCKERHUB_PUBLISH="${DOCKERHUB_PUBLISH:-yes}" | ||
MINIKUBE="${MINIKUBE:-no}" | ||
|
||
TAG="${TAG}" \ | ||
DOCKERHUB_LOGIN="${DOCKERHUB_LOGIN}" \ | ||
DOCKERHUB_PUBLISH="${DOCKERHUB_PUBLISH}" \ | ||
MINIKUBE="${MINIKUBE}" \ | ||
./image_build_universal.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Universal docker image builder | ||
|
||
# Externally configurable build-dependent options | ||
TAG="${TAG:-sunsingerus/clickhouse-operator:dev}" | ||
DOCKERHUB_LOGIN="${DOCKERHUB_LOGIN:-sunsingerus}" | ||
DOCKERHUB_PUBLISH="${DOCKERHUB_PUBLISH:-yes}" | ||
MINIKUBE="${MINIKUBE:-no}" | ||
|
||
# Source-dependent options | ||
CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
SRC_ROOT="$(realpath ${CUR_DIR}/..)" | ||
DOCKERFILE_DIR="${SRC_ROOT}" | ||
DOCKERFILE="${DOCKERFILE_DIR}/Dockerfile" | ||
|
||
# Build image with Docker | ||
if [[ "${MINIKUBE}" == "yes" ]]; then | ||
# We'd like to build for minikube | ||
eval $(minikube docker-env) | ||
fi | ||
cat "${DOCKERFILE}" | envsubst | docker build -t "${TAG}" "${SRC_ROOT}" | ||
|
||
# Publish image | ||
if [[ "${DOCKERHUB_PUBLISH}" == "yes" ]]; then | ||
docker login -u "${DOCKERHUB_LOGIN}" | ||
docker push "${TAG}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Table of Contents | ||
1. [architecture.md](./architecture.md) - architecture overview | ||
1. [chi_update_add_replication.md](./chi_update_add_replication.md) - how to add replication | ||
1. [chi_update_clickhouse_version.md](./chi_update_clickhouse_version.md) - how to update version | ||
1. [clickhouse_config_errors_handling.md](./clickhouse_config_errors_handling.md) - how operator handles ClickHouse's config errors | ||
1. [custom_resource_explained.md](./custom_resource_explained.md) - explain Custom Resource Definition in details | ||
1. [grafana_setup.md](./grafana_setup.md) - how to setup Grafana | ||
1. [introduction.md](./introduction.md) - general introduction | ||
1. [k8s_cluster_access.md](./k8s_cluster_access.md) - how to setup cluster access | ||
1. [operator_build_from_sources.md](./operator_build_from_sources.md) - how to build operator from sources | ||
1. [operator_configuration.md](./operator_configuration.md) - operator configuration in details | ||
1. [operator_installation_details.md](./operator_installation_details.md) - how to install operator in details | ||
1. [operator_upgrade.md](./operator_upgrade.md) - how to upgrade operator to the different version | ||
1. [prometheus_setup.md](./prometheus_setup.md) - how to setup Prometheus | ||
1. [quick-start.md](./quick-start.md) - quick start | ||
1. [replication_setup.md](./replication_setup.md) - how to setup replication | ||
1. [schema_migration.md](./schema_migration.md) - how operator migrates shena during cluster resize | ||
1. [storage.md](./storage.md) - storage explained | ||
1. [zookeeper_setup.md](./zookeeper_setup.md) - how to setup zookeeper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# ClickHouse Configuration Errors Handling | ||
|
||
When operator performs rolling update and create procedures, it monitors health of the updated/created StatefulSets. | ||
Operator polls StatefulSet status and wait for some configurable time for StatefulSet to report **Ready** status reached. | ||
In case StatefulSet successfully reports **Ready** status, all is good and operator can move on to the next StatefulSet. | ||
However, in case ClickHouse configuration is incorrect or due to any other reason ClickHouse is unable to start, StatefulSet would not reach **Ready** status. | ||
In tis case, operator has to do something and decide what to do regarding the following questions: | ||
1. What to do with current failed StatefulSet? | ||
1. Should operator continue with rolling update? | ||
|
||
Regarding failed StatefulSet, operator can either do nothing and leave the situation to admin to solve or can try to rollback StatefulSet to previous state. | ||
In case of newly created StatefulSet, rollback means *to delete StatefulSet* | ||
This behavior is configured with the following operator configuration options: | ||
```yaml | ||
# What to do in case created StatefulSet is not in Ready after `statefulSetUpdateTimeout` seconds | ||
# Possible options: | ||
# 1. abort - do nothing, just break the process and wait for admin | ||
# 2. delete - delete newly created problematic StatefulSet | ||
onStatefulSetCreateFailureAction: delete | ||
|
||
# What to do in case updated StatefulSet is not in Ready after `statefulSetUpdateTimeout` seconds | ||
# Possible options: | ||
# 1. abort - do nothing, just break the process and wait for admin | ||
# 2. rollback - delete Pod and rollback StatefulSet to previous Generation. | ||
# Pod would be recreated by StatefulSet based on rollback-ed configuration | ||
onStatefulSetUpdateFailureAction: rollback | ||
``` | ||
|
||
Regarding should operator continue with rolling update/create in case of failed StatefulSet it met - current behavior is to abort rolling process and let admin to decide how to proceed with current situation. | ||
|
||
# Plans and discussion | ||
Interesting question is what to do with StatefulSets that were already successfully updated on the same run, before failed StatefulSet met. | ||
Available options are: | ||
1. Do nothing. In this case ClickHouse cluster may be in some inconsistent state, because some replicas may be updated and some not. | ||
1. try to rollback the whole cluster to some **previous** state. What this **previous** state be is a matter of discussion. | ||
Currently operator goes with 'do nothing' approach. |
58 changes: 58 additions & 0 deletions
58
docs/examples-withstand-errors/01-incorrect-image-create.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
apiVersion: "clickhouse.altinity.com/v1" | ||
kind: "ClickHouseInstallation" | ||
metadata: | ||
name: "incorrect-image-create" | ||
spec: | ||
configuration: | ||
clusters: | ||
- name: adv | ||
layout: | ||
type: Advanced | ||
shards: | ||
- definitionType: Replicas | ||
replicas: | ||
- deployment: | ||
podTemplate: clickhouse:19.3.5 | ||
- deployment: | ||
podTemplate: clickhouse:19.3.100 | ||
- deployment: | ||
podTemplate: clickhouse:19.3.7 | ||
|
||
templates: | ||
podTemplates: | ||
- name: clickhouse:19.3.5 | ||
containers: | ||
- name: clickhouse-pod | ||
image: yandex/clickhouse-server:19.3.5 | ||
ports: | ||
- name: http | ||
containerPort: 8123 | ||
- name: client | ||
containerPort: 9000 | ||
- name: interserver | ||
containerPort: 9009 | ||
|
||
- name: clickhouse:19.3.7 | ||
containers: | ||
- name: clickhouse-pod | ||
image: yandex/clickhouse-server:19.3.7 | ||
ports: | ||
- name: http | ||
containerPort: 8123 | ||
- name: client | ||
containerPort: 9000 | ||
- name: interserver | ||
containerPort: 9009 | ||
|
||
# Incorrect image | ||
- name: clickhouse:19.3.100 | ||
containers: | ||
- name: clickhouse-pod | ||
image: yandex/clickhouse-server:19.3.100 | ||
ports: | ||
- name: http | ||
containerPort: 8123 | ||
- name: client | ||
containerPort: 9000 | ||
- name: interserver | ||
containerPort: 9009 |
32 changes: 32 additions & 0 deletions
32
docs/examples-withstand-errors/02-incorrect-image-update-01-initial-position.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: "clickhouse.altinity.com/v1" | ||
kind: "ClickHouseInstallation" | ||
metadata: | ||
name: "incorrect-image-version-update" | ||
spec: | ||
configuration: | ||
clusters: | ||
- name: update | ||
deployment: | ||
podTemplate: clickhouse:19.1.10 | ||
layout: | ||
type: Advanced | ||
shards: | ||
- definitionType: Replicas | ||
replicas: | ||
- port: 9000 | ||
- port: 9000 | ||
- port: 9000 | ||
|
||
templates: | ||
podTemplates: | ||
- name: clickhouse:19.1.10 | ||
containers: | ||
- name: clickhouse-pod | ||
image: yandex/clickhouse-server:19.1.10 | ||
ports: | ||
- name: http | ||
containerPort: 8123 | ||
- name: client | ||
containerPort: 9000 | ||
- name: interserver | ||
containerPort: 9009 |
Oops, something went wrong.