Skip to content

Commit

Permalink
Merge pull request #827 from Altinity/0.17.0
Browse files Browse the repository at this point in the history
0.17.0
  • Loading branch information
sunsingerus authored Dec 2, 2021
2 parents 5013472 + 9731c23 commit dc6cdc6
Show file tree
Hide file tree
Showing 195 changed files with 6,669 additions and 1,754 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
vendor/
docs/
.vagrant/
.idea/
*.log
./tests/image/cache/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ dockerfile/actions
# python virtualenv
venv

# Tests cached files
tests/image/cache

# Skip tmp folder
/tmp/
17 changes: 7 additions & 10 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Vagrant.configure(2) do |config|
end

if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
config.vbguest.auto_update = true
end

if Vagrant.has_plugin?("vagrant-timezone")
Expand Down Expand Up @@ -104,7 +104,7 @@ Vagrant.configure(2) do |config|
apt-get install --no-install-recommends -y clickhouse-client
# golang
export GOLANG_VERSION=1.16
export GOLANG_VERSION=1.17
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6BC817356A3D45E
add-apt-repository ppa:longsleep/golang-backports
apt-get install --no-install-recommends -y golang-${GOLANG_VERSION}-go
Expand Down Expand Up @@ -140,7 +140,7 @@ Vagrant.configure(2) do |config|
# MINIKUBE_VERSION=1.18.1
# MINIKUBE_VERSION=1.19.0
# MINIKUBE_VERSION=1.20.0
MINIKUBE_VERSION=1.22.0
MINIKUBE_VERSION=1.23.2
wget -c --progress=bar:force:noscroll -O /usr/local/bin/minikube https://github.com/kubernetes/minikube/releases/download/v${MINIKUBE_VERSION}/minikube-linux-amd64
chmod +x /usr/local/bin/minikube
# required for k8s 1.18+
Expand All @@ -157,7 +157,7 @@ Vagrant.configure(2) do |config|
# https://github.com/kubernetes/kubeadm/issues/2395
# K8S_VERSION=${K8S_VERSION:-1.20.10}
# K8S_VERSION=${K8S_VERSION:-1.21.4}
K8S_VERSION=${K8S_VERSION:-1.22.1}
K8S_VERSION=${K8S_VERSION:-1.22.2}
export VALIDATE_YAML=true
killall kubectl || true
Expand Down Expand Up @@ -211,6 +211,8 @@ EOF
# kubectl krew install debug
chown -R vagrant:vagrant /home/vagrant/.krew
export NO_WAIT=1
cd /vagrant/
git_branch=$(git rev-parse --abbrev-ref HEAD)
Expand Down Expand Up @@ -275,12 +277,7 @@ EOF
pip3 install -r /vagrant/tests/requirements.txt
python3 /vagrant/tests/test_metrics_alerts.py
python3 /vagrant/tests/test_zookeeper.py
python3 /vagrant/tests/test_backup_alerts.py
python3 /vagrant/tests/test_examples.py
python3 /vagrant/tests/test_metrics_exporter.py
python3 /vagrant/tests/test.py
python3 /vagrant/tests/regression.py --native
# audit2rbac
kubectl logs kube-apiserver-minikube -n kube-system | grep audit.k8s.io/v1 > /tmp/audit2rbac.log
Expand Down
28 changes: 23 additions & 5 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,35 @@ reconcileThreadsNumber: 10
reconcileWaitExclude: true
reconcileWaitInclude: false

################################################
##
## Annotations management parameters
##
################################################

# Applied when:
# 1. Propagating annotations from the CHI's `metadata.annotations` to child objects' `metadata.annotations`,
# 2. Propagating annotations from the CHI Template's `metadata.annotations` to CHI's `metadata.annotations`,
# Include annotations from the following list:
# Applied only when not empty. Empty list means "include all, no selection"
includeIntoPropagationAnnotations: []
# Exclude annotations from the following list:
excludeFromPropagationAnnotations: []

################################################
##
## Labels management parameters
##
################################################

# When propagating labels from the chi's `metadata.labels` section to child objects' `metadata.labels`,
# exclude labels from the following list:
#excludeFromPropagationLabels:
# - "labelA"
# - "labelB"
# Applied when:
# 1. Propagating labels from the CHI's `metadata.labels` to child objects' `metadata.labels`,
# 2. Propagating labels from the CHI Template's `metadata.labels` to CHI's `metadata.labels`,
# Include labels from the following list:
# Applied only when not empty. Empty list means "include all, no selection"
includeIntoPropagationLabels: []
# Exclude labels from the following list:
excludeFromPropagationLabels: []

# Whether to append *Scope* labels to StatefulSet and Pod.
# Full list of available *scope* labels check in labeler.go
Expand Down
2 changes: 1 addition & 1 deletion config/templates.d/001-templates.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"containers" : [
{
"name": "clickhouse",
"image": "yandex/clickhouse-server:19.3.7",
"image": "yandex/clickhouse-server:21.3",
"ports": [
{
"name": "http",
Expand Down
33 changes: 31 additions & 2 deletions deploy/builder/build-clickhouse-operator-install-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,47 @@ OPERATOR_NAMESPACE="dev" \
"${CUR_DIR}/cat-clickhouse-operator-install-yaml.s"h > "${MANIFEST_ROOT}/operator/clickhouse-operator-install-dev.yaml"

# Build terraform-templated installation .yaml manifest
cat <<EOF > "${MANIFEST_ROOT}/operator/clickhouse-operator-install-tf.yaml"
#
# Terraform template parameters available:
#
# 1. namespace - namespace to install the operator into and to be watched by the operator.
# 2. password - password of the clickhouse's user, used by the operator.
#
#
EOF
watchNamespaces="\${namespace}" \
password_sha256_hex="\${sha256(password)}" \
chPassword="\${password}" \
OPERATOR_NAMESPACE="\${namespace}" \
MANIFEST_PRINT_RBAC_NAMESPACED=yes \
"${CUR_DIR}/cat-clickhouse-operator-install-yaml.sh" > "${MANIFEST_ROOT}/operator/clickhouse-operator-install-tf.yaml"
"${CUR_DIR}/cat-clickhouse-operator-install-yaml.sh" >> "${MANIFEST_ROOT}/operator/clickhouse-operator-install-tf.yaml"

# Build ansible-templated installation .yaml manifest
cat <<EOF > "${MANIFEST_ROOT}/operator/clickhouse-operator-install-ansible.yaml"
#
# Ansible template parameters available:
#
# 1. namespace - namespace to install the operator into and to be watched by the operator.
# 2. password - password of the clickhouse's user, used by the operator.
#
#
EOF
watchNamespaces="{{ namespace }}" \
password_sha256_hex="{{ password | password_hash('sha256') }}" \
chPassword="{{ password }}" \
OPERATOR_NAMESPACE="{{ namespace }}" \
MANIFEST_PRINT_RBAC_NAMESPACED=yes \
"${CUR_DIR}/cat-clickhouse-operator-install-yaml.sh" > "${MANIFEST_ROOT}/operator/clickhouse-operator-install-ansible.yaml"
"${CUR_DIR}/cat-clickhouse-operator-install-yaml.sh" >> "${MANIFEST_ROOT}/operator/clickhouse-operator-install-ansible.yaml"


# Build partial .yaml manifest(s)
OPERATOR_IMAGE="\${OPERATOR_IMAGE}" \
METRICS_EXPORTER_IMAGE="\${METRICS_EXPORTER_IMAGE}" \
OPERATOR_NAMESPACE="\${OPERATOR_NAMESPACE}" \
MANIFEST_PRINT_CRD="yes" \
MANIFEST_PRINT_RBAC_CLUSTERED="no" \
MANIFEST_PRINT_RBAC_NAMESPACED="no" \
MANIFEST_PRINT_DEPLOYMENT="no" \
MANIFEST_PRINT_SERVICE="no" \
"${CUR_DIR}/cat-clickhouse-operator-install-yaml.sh" > "${MANIFEST_ROOT}/operator/parts/crd.yaml"
75 changes: 43 additions & 32 deletions deploy/builder/cat-clickhouse-operator-install-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,33 @@ if [[ "${MANIFEST_PRINT_CRD}" == "yes" ]]; then
ensure_file "${TEMPLATES_DIR}" "${SECTION_FILE_NAME}" "${REPO_PATH_TEMPLATES_PATH}"
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
KIND="ClickHouseInstallation" \
SINGULAR="clickhouseinstallation" \
PLURAL="clickhouseinstallations" \
SHORT="chi" \
KIND="ClickHouseInstallation" \
SINGULAR="clickhouseinstallation" \
PLURAL="clickhouseinstallations" \
SHORT="chi" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst

# Render CHIT
SECTION_FILE_NAME="clickhouse-operator-install-yaml-template-01-section-crd-01-chi-chit.yaml"
ensure_file "${TEMPLATES_DIR}" "${SECTION_FILE_NAME}" "${REPO_PATH_TEMPLATES_PATH}"
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
KIND="ClickHouseInstallationTemplate" \
KIND="ClickHouseInstallationTemplate" \
SINGULAR="clickhouseinstallationtemplate" \
PLURAL="clickhouseinstallationtemplates" \
SHORT="chit" \
PLURAL="clickhouseinstallationtemplates" \
SHORT="chit" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst

# Render CHOp config
SECTION_FILE_NAME="clickhouse-operator-install-yaml-template-01-section-crd-02-chopconf.yaml"
ensure_file "${TEMPLATES_DIR}" "${SECTION_FILE_NAME}" "${REPO_PATH_TEMPLATES_PATH}"
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
NAMESPACE="${OPERATOR_NAMESPACE}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst
fi

Expand All @@ -135,21 +138,23 @@ if [[ "${MANIFEST_PRINT_RBAC_CLUSTERED}" == "yes" ]]; then
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
COMMENT="$(cut_namespace_for_kubectl "${OPERATOR_NAMESPACE}")" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
NAME="clickhouse-operator" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
NAME="clickhouse-operator" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst

# Render Role
SECTION_FILE_NAME="clickhouse-operator-install-yaml-template-02-section-rbac-02-role.yaml"
ensure_file "${TEMPLATES_DIR}" "${SECTION_FILE_NAME}" "${REPO_PATH_TEMPLATES_PATH}"
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
NAMESPACE="${OPERATOR_NAMESPACE}" \
COMMENT="#" \
ROLE_KIND="ClusterRole" \
ROLE_NAME="clickhouse-operator-${OPERATOR_NAMESPACE}" \
ROLE_BINDING_KIND="ClusterRoleBinding" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
COMMENT="#" \
ROLE_KIND="ClusterRole" \
ROLE_NAME="clickhouse-operator-${OPERATOR_NAMESPACE}" \
ROLE_BINDING_KIND="ClusterRoleBinding" \
ROLE_BINDING_NAME="clickhouse-operator-${OPERATOR_NAMESPACE}" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst
fi

Expand All @@ -160,21 +165,23 @@ if [[ "${MANIFEST_PRINT_RBAC_NAMESPACED}" == "yes" ]]; then
ensure_file "${TEMPLATES_DIR}" "${SECTION_FILE_NAME}" "${REPO_PATH_TEMPLATES_PATH}"
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
NAMESPACE="${OPERATOR_NAMESPACE}" \
NAME="clickhouse-operator" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
NAME="clickhouse-operator" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst

# Render Role
SECTION_FILE_NAME="clickhouse-operator-install-yaml-template-02-section-rbac-02-role.yaml"
ensure_file "${TEMPLATES_DIR}" "${SECTION_FILE_NAME}" "${REPO_PATH_TEMPLATES_PATH}"
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
NAMESPACE="${OPERATOR_NAMESPACE}" \
COMMENT="" \
ROLE_KIND="Role" \
ROLE_NAME="clickhouse-operator" \
ROLE_BINDING_KIND="RoleBinding" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
COMMENT="" \
ROLE_KIND="Role" \
ROLE_NAME="clickhouse-operator" \
ROLE_BINDING_KIND="RoleBinding" \
ROLE_BINDING_NAME="clickhouse-operator" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst
fi

Expand All @@ -196,9 +203,10 @@ function render_configmap_header() {
# Render ConfigMap header template with vars substitution
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
COMMENT="$(cut_namespace_for_kubectl "${OPERATOR_NAMESPACE}")" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
NAME="${CM_NAME}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
NAME="${CM_NAME}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst
}

Expand Down Expand Up @@ -240,9 +248,10 @@ if [[ "${MANIFEST_PRINT_DEPLOYMENT}" == "yes" ]]; then
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
COMMENT="$(cut_namespace_for_kubectl "${OPERATOR_NAMESPACE}")" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
METRICS_EXPORTER_IMAGE="${METRICS_EXPORTER_IMAGE}" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst
else
# Config file specified, render all ConfigMaps and then render deployment
Expand Down Expand Up @@ -318,9 +327,10 @@ if [[ "${MANIFEST_PRINT_DEPLOYMENT}" == "yes" ]]; then
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
COMMENT="$(cut_namespace_for_kubectl "${OPERATOR_NAMESPACE}")" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
METRICS_EXPORTER_IMAGE="${METRICS_EXPORTER_IMAGE}" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst
fi
fi
Expand All @@ -332,7 +342,8 @@ if [[ "${MANIFEST_PRINT_SERVICE}" == "yes" ]]; then
render_separator
cat "${TEMPLATES_DIR}/${SECTION_FILE_NAME}" | \
COMMENT="$(cut_namespace_for_kubectl "${OPERATOR_NAMESPACE}")" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
NAMESPACE="${OPERATOR_NAMESPACE}" \
OPERATOR_IMAGE="${OPERATOR_IMAGE}" \
OPERATOR_VERSION="${OPERATOR_VERSION}" \
envsubst
fi
28 changes: 23 additions & 5 deletions deploy/builder/templates-config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,35 @@ reconcileThreadsNumber: 10
reconcileWaitExclude: true
reconcileWaitInclude: false

################################################
##
## Annotations management parameters
##
################################################

# Applied when:
# 1. Propagating annotations from the CHI's `metadata.annotations` to child objects' `metadata.annotations`,
# 2. Propagating annotations from the CHI Template's `metadata.annotations` to CHI's `metadata.annotations`,
# Include annotations from the following list:
# Applied only when not empty. Empty list means "include all, no selection"
includeIntoPropagationAnnotations: []
# Exclude annotations from the following list:
excludeFromPropagationAnnotations: []

################################################
##
## Labels management parameters
##
################################################

# When propagating labels from the chi's `metadata.labels` section to child objects' `metadata.labels`,
# exclude labels from the following list:
#excludeFromPropagationLabels:
# - "labelA"
# - "labelB"
# Applied when:
# 1. Propagating labels from the CHI's `metadata.labels` to child objects' `metadata.labels`,
# 2. Propagating labels from the CHI Template's `metadata.labels` to CHI's `metadata.labels`,
# Include labels from the following list:
# Applied only when not empty. Empty list means "include all, no selection"
includeIntoPropagationLabels: []
# Exclude labels from the following list:
excludeFromPropagationLabels: []

# Whether to append *Scope* labels to StatefulSet and Pod.
# Full list of available *scope* labels check in labeler.go
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"containers" : [
{
"name": "clickhouse",
"image": "yandex/clickhouse-server:19.3.7",
"image": "yandex/clickhouse-server:21.3",
"ports": [
{
"name": "http",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: ${PLURAL}.clickhouse.altinity.com
labels:
clickhouse.altinity.com/chop: ${OPERATOR_VERSION}
spec:
group: clickhouse.altinity.com
scope: Namespaced
Expand Down
Loading

0 comments on commit dc6cdc6

Please sign in to comment.