Skip to content

Commit

Permalink
upgrade altinity-clickhouse-operator
Browse files Browse the repository at this point in the history
  • Loading branch information
slamdev committed Nov 14, 2021
1 parent c060fa1 commit 574b1b3
Show file tree
Hide file tree
Showing 17 changed files with 1,233 additions and 600 deletions.
4 changes: 2 additions & 2 deletions charts/altinity-clickhouse-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ description: |-
Refer to operator repo for additional information.
type: application
version: 0.0.10
appVersion: 0.16.0
version: 0.0.11
appVersion: 0.16.1
home: https://github.com/slamdev/helm-charts/tree/master/charts/altinity-clickhouse-operator
icon: https://artifacthub.io/image/2d6aa29c-c74f-4bff-bede-ba7e6e0315a7@2x
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion charts/altinity-clickhouse-operator/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# altinity-clickhouse-operator

![Version: 0.0.10](https://img.shields.io/badge/Version-0.0.10-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.16.0](https://img.shields.io/badge/AppVersion-0.16.0-informational?style=flat-square)
![Version: 0.0.11](https://img.shields.io/badge/Version-0.0.11-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.16.1](https://img.shields.io/badge/AppVersion-0.16.1-informational?style=flat-square)

Helm chart to deploy [altinity-clickhouse-operator](https://github.com/Altinity/clickhouse-operator).

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Template Parameters:
#
# NONE
#
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand All @@ -19,12 +23,12 @@ spec:
- name: namespaces
type: string
description: Watch namespaces
priority: 0
priority: 0 # show in standard view
jsonPath: .status
schema:
openAPIV3Schema:
type: object
description: allows customize `clickhouse-operator` settings, need restart clickhouse-operator pod after adding, more details https://github.com/Altinity/clickhouse-operator/blob/master/docs/operator_configuration.md
description: "allows customize `clickhouse-operator` settings, need restart clickhouse-operator pod after adding, more details https://github.com/Altinity/clickhouse-operator/blob/master/docs/operator_configuration.md"
x-kubernetes-preserve-unknown-fields: true
properties:
status:
Expand All @@ -40,27 +44,27 @@ spec:
properties:
watchNamespaces:
type: array
description: List of namespaces where clickhouse-operator watches for events.
description: "List of namespaces where clickhouse-operator watches for events."
items:
type: string
chCommonConfigsPath:
type: string
description: Path to folder where ClickHouse configuration files common for all instances within CHI are located. Default - config.d
description: "Path to folder where ClickHouse configuration files common for all instances within CHI are located. Default - config.d"
chHostConfigsPath:
type: string
description: Path to folder where ClickHouse configuration files unique for each instance (host) within CHI are located. Default - conf.d
description: "Path to folder where ClickHouse configuration files unique for each instance (host) within CHI are located. Default - conf.d"
chUsersConfigsPath:
type: string
description: Path to folder where ClickHouse configuration files with users settings are located. Files are common for all instances within CHI
description: "Path to folder where ClickHouse configuration files with users settings are located. Files are common for all instances within CHI"
chiTemplatesPath:
type: string
description: Path to folder where ClickHouseInstallation .yaml manifests are located.
description: "Path to folder where ClickHouseInstallation .yaml manifests are located."
statefulSetUpdateTimeout:
type: integer
description: How many seconds to wait for created/updated StatefulSet to be Ready
description: "How many seconds to wait for created/updated StatefulSet to be Ready"
statefulSetUpdatePollPeriod:
type: integer
description: How many seconds to wait between checks for created/updated StatefulSet status
description: "How many seconds to wait between checks for created/updated StatefulSet status"
onStatefulSetCreateFailureAction:
type: string
description: |
Expand All @@ -79,47 +83,47 @@ spec:
3. ignore - ignore error, pretend nothing happened and move on to the next StatefulSet.
chConfigUserDefaultProfile:
type: string
description: ClickHouse server configuration `<profile>...</profile>` for any <user>
description: "ClickHouse server configuration `<profile>...</profile>` for any <user>"
chConfigUserDefaultQuota:
type: string
description: ClickHouse server configuration `<quota>...</quota>` for any <user>
description: "ClickHouse server configuration `<quota>...</quota>` for any <user>"
chConfigUserDefaultNetworksIP:
type: array
description: ClickHouse server configuration `<networks><ip>...</ip></netrworks>` for any <user>
description: "ClickHouse server configuration `<networks><ip>...</ip></networks>` for any <user>"
items:
type: string
chConfigUserDefaultPassword:
description: ClickHouse server configuration `<password>...</password>` for any <user>
description: "ClickHouse server configuration `<password>...</password>` for any <user>"
type: string
chConfigNetworksHostRegexpTemplate:
description: ClickHouse server configuration `<host_regexp>...</host_regexp>` for any <user>
description: "ClickHouse server configuration `<host_regexp>...</host_regexp>` for any <user>"
type: string
chUsername:
type: string
description: ClickHouse username to be used by operator to connect to ClickHouse instances, deprecated, use chCredentialsSecretName
description: "ClickHouse username to be used by operator to connect to ClickHouse instances, deprecated, use chCredentialsSecretName"
chPassword:
type: string
description: ClickHouse password to be used by operator to connect to ClickHouse instances, deprecated, use chCredentialsSecretName
description: "ClickHouse password to be used by operator to connect to ClickHouse instances, deprecated, use chCredentialsSecretName"
chCredentialsSecretNamespace:
type: string
description: Location of k8s Secret with username and password to be used by operator to connect to ClickHouse instances
description: "Location of k8s Secret with username and password to be used by operator to connect to ClickHouse instances"
chCredentialsSecretName:
type: string
description: Name of k8s Secret with username and password to be used by operator to connect to ClickHouse instances
description: "Name of k8s Secret with username and password to be used by operator to connect to ClickHouse instances"
chPort:
type: integer
minimum: 1
maximum: 65535
description: Name of k8s Secret with username and password to be used by operator to connect to ClickHouse instances
description: "Name of k8s Secret with username and password to be used by operator to connect to ClickHouse instances"
logtostderr:
type: string
description: boolean, allows logs to stderr
description: "boolean, allows logs to stderr"
alsologtostderr:
type: string
description: booleanm allows logs to stderr and files both
description: "boolean allows logs to stderr and files both"
v:
type: string
description: verbosity level of clickhouse-operator log, default - 1 max - 9
description: "verbosity level of clickhouse-operator log, default - 1 max - 9"
stderrthreshold:
type: string
vmodule:
Expand All @@ -128,7 +132,7 @@ spec:
type: string
reconcileThreadsNumber:
type: integer
description: how much goroutines will use to reconcile in parallel, 10 by default
description: "how much goroutines will use to reconcile in parallel, 10 by default"
minimum: 1
maximum: 65535
reconcileWaitExclude:
Expand All @@ -144,8 +148,9 @@ spec:
type: string
appendScopeLabels:
type: string
description: Whether to append *Scope* labels to StatefulSet and Pod
description: "Whether to append *Scope* labels to StatefulSet and Pod"
enum:
# List StringBoolXXX constants from model
- ""
- "0"
- "1"
Expand All @@ -161,21 +166,21 @@ spec:
- "off"
- "On"
- "on"
- Disable
- disable
- Enable
- enable
- Disabled
- disabled
- Enabled
- enabled
- LabelShardScopeIndex
- LabelReplicaScopeIndex
- LabelCHIScopeIndex
- LabelCHIScopeCycleSize
- LabelCHIScopeCycleIndex
- LabelCHIScopeCycleOffset
- LabelClusterScopeIndex
- LabelClusterScopeCycleSize
- LabelClusterScopeCycleIndex
- LabelClusterScopeCycleOffset
- "Disable"
- "disable"
- "Enable"
- "enable"
- "Disabled"
- "disabled"
- "Enabled"
- "enabled"
- "LabelShardScopeIndex"
- "LabelReplicaScopeIndex"
- "LabelCHIScopeIndex"
- "LabelCHIScopeCycleSize"
- "LabelCHIScopeCycleIndex"
- "LabelCHIScopeCycleOffset"
- "LabelClusterScopeIndex"
- "LabelClusterScopeCycleSize"
- "LabelClusterScopeCycleIndex"
- "LabelClusterScopeCycleOffset"
88 changes: 41 additions & 47 deletions charts/altinity-clickhouse-operator/hacks/sync-yamls.sh
Original file line number Diff line number Diff line change
@@ -1,64 +1,58 @@
#!/bin/bash
#!/usr/bin/env bash

#
# Script downloads manifest from altinity repo, splits it to separate files
# and puts to the corresponding folders
# NOTE: yq ( https://mikefarah.gitbook.io/yq/ ) > v4.14.x is required
#
# Usage: ./sync.sh
#

set -o errexit
set -o nounset
set -o pipefail

CHART_PATH=../
BUILD_PATH="${CHART_PATH}/../../build"

APP_VERSION=$(cat "${CHART_PATH}/Chart.yaml" | grep appVersion | cut -d : -f 2 | xargs)

if [ "${APP_VERSION}" = "latest" ]; then
APP_VERSION="master"
fi

REPO_URL="https://raw.githubusercontent.com/Altinity/clickhouse-operator/${APP_VERSION}/deploy/operator"

function extract_resources() {
local url=$1
local dest=$2
readonly repo_url="https://raw.githubusercontent.com/Altinity/clickhouse-operator"
readonly crds_dir="../crds"
readonly templates_dir="../templates/generated"
readonly manifest_path="deploy/operator/clickhouse-operator-install-bundle.yaml"
readonly chart_def="../Chart.yaml"

local resources
resources=$(curl -s "${url}" | yq e -j -N | jq . -c)
function main() {
readonly manifest_url="${repo_url}/$(detect_version)/${manifest_path}"
local tmpdir
tmpdir=$(mktemp -d)

OLDIFS=$IFS
IFS=$'\n'
for r in ${resources}; do
local kind
kind=$(echo "${r}" | jq .kind -r)
# shellcheck disable=SC2016
(cd "${tmpdir}" && curl -s "${manifest_url}" 2>&1 | yq e --no-doc -s '$index')

local name
name=$(echo "${r}" | jq .metadata.name -r)

echo "${r}" | yq e -P - >"${dest}/${kind}-${name}.yaml"
for f in "${tmpdir}"/*.yml; do
process "${f}"
done
IFS=$OLDIFS
}

rm -rf "${CHART_PATH}/crds" "${CHART_PATH}/templates/generated"
mkdir "${CHART_PATH}/crds" "${CHART_PATH}/templates/generated"
function process() {
local file="${1}"

extract_resources "${REPO_URL}/clickhouse-operator-install-crd.yaml" "${CHART_PATH}/crds"
extract_resources "${REPO_URL}/clickhouse-operator-install-deployment.yaml" "${CHART_PATH}/templates/generated"
extract_resources "${REPO_URL}/clickhouse-operator-install-service.yaml" "${CHART_PATH}/templates/generated"
local kind
kind=$(yq e '.kind' "${file}")

exit 1
local name
name=$(yq e '.metadata.name' "${file}")

wget -O ${BUILD_PATH}/repo.zip ${REPO_URL}
unzip -n "${BUILD_PATH}/repo.zip" -d ${BUILD_PATH}
rm "${BUILD_PATH}/repo.zip"
local processed_file="${kind}-${name}.yaml"

REPO_PATH="${BUILD_PATH}/external-secrets-operator-${APP_VERSION}"
if [[ "${kind}" == "CustomResourceDefinition" ]]; then
processed_file="${crds_dir}/${processed_file}"
else
processed_file="${templates_dir}/${processed_file}"
fi

cp -R "${REPO_PATH}/config/samples/" "${CHART_PATH}/examples/"
mv "${file}" "${processed_file}"
}

rm -rf xx* && csplit -s -k ${REPO_PATH}/k8s/k8s.yaml '/^---/' '{99}' || true
function detect_version() {
yq e '.appVersion' ${chart_def}
}

for f in xx*; do
name="$(yq r "${f}" 'kind' | tr '[:upper:]' '[:lower:]')-$(yq r "${f}" 'metadata.name' | tr '[:upper:]' '[:lower:]')"
if [[ "${name}" == "namespace"* ]]; then
rm "${f}"
continue
fi
mv "${f}" "${CHART_PATH}/templates/${name}.yaml"
done
main
Loading

0 comments on commit 574b1b3

Please sign in to comment.