From 9ae5a1938d9026a3ea67cec2a06bbdcaeb2411a1 Mon Sep 17 00:00:00 2001 From: Y-Rookie Date: Tue, 10 Dec 2024 15:26:06 +0800 Subject: [PATCH 1/5] upgrade orielodb addon to v1.0 API --- addons/orioledb/Chart.yaml | 9 +- addons/orioledb/config/etcd-serve-config.tpl | 18 - .../orioledb/scripts/generate_patroni_yaml.py | 118 ++++++ addons/orioledb/scripts/pgbouncer-setup.sh | 50 +++ addons/orioledb/scripts/postgres-pre-setup.sh | 32 ++ addons/orioledb/scripts/postgres-setup.sh | 73 ++++ addons/orioledb/scripts/switchover.sh | 90 ++++ addons/orioledb/templates/NOTES.txt | 6 - addons/orioledb/templates/_helpers.tpl | 81 ++++ ...l => agamotto-configuration-template.yaml} | 2 +- addons/orioledb/templates/cmpd.yaml | 386 +++++++++++------- addons/orioledb/templates/cmpv.yaml | 23 ++ .../orioledb/templates/configconstraint.yaml | 4 +- addons/orioledb/templates/etcd-configmap.yaml | 10 - ...ml => metrics-configuration-template.yaml} | 2 +- ...l => orioledb-configuration-template.yaml} | 2 +- .../templates/orioledb-scripts-template.yaml | 50 +++ ...ml => patroni-reload-script-template.yaml} | 2 +- ... => pgbouncer-configuration-template.yaml} | 2 +- addons/orioledb/templates/scripts.yaml | 270 ------------ addons/orioledb/values.yaml | 49 +-- 21 files changed, 771 insertions(+), 508 deletions(-) delete mode 100644 addons/orioledb/config/etcd-serve-config.tpl create mode 100755 addons/orioledb/scripts/generate_patroni_yaml.py create mode 100755 addons/orioledb/scripts/pgbouncer-setup.sh create mode 100755 addons/orioledb/scripts/postgres-pre-setup.sh create mode 100755 addons/orioledb/scripts/postgres-setup.sh create mode 100644 addons/orioledb/scripts/switchover.sh delete mode 100644 addons/orioledb/templates/NOTES.txt rename addons/orioledb/templates/{agamotto-configmap.yaml => agamotto-configuration-template.yaml} (95%) create mode 100644 addons/orioledb/templates/cmpv.yaml delete mode 100644 addons/orioledb/templates/etcd-configmap.yaml rename addons/orioledb/templates/{metrics-configmap-14.yaml => metrics-configuration-template.yaml} (99%) rename addons/orioledb/templates/{configmap.yaml => orioledb-configuration-template.yaml} (94%) create mode 100644 addons/orioledb/templates/orioledb-scripts-template.yaml rename addons/orioledb/templates/{patroni-reload.yaml => patroni-reload-script-template.yaml} (85%) rename addons/orioledb/templates/{pgbouncer-configmap.yaml => pgbouncer-configuration-template.yaml} (73%) delete mode 100644 addons/orioledb/templates/scripts.yaml diff --git a/addons/orioledb/Chart.yaml b/addons/orioledb/Chart.yaml index 5e3a166e4..793c8a165 100644 --- a/addons/orioledb/Chart.yaml +++ b/addons/orioledb/Chart.yaml @@ -19,7 +19,14 @@ maintainers: - name: 1aal url: https://github.com/apecloud/kubeblocks/ +# Add a dependency to the kubeblocks definition library chart +dependencies: + - name: kblib + version: 0.1.0 + repository: file://../kblib + alias: extra + annotations: - addon.kubeblocks.io/kubeblocks-version: ">=0.9.0" + addon.kubeblocks.io/kubeblocks-version: ">=1.0.0" addon.kubeblocks.io/model: "RDBMS" addon.kubeblocks.io/provider: "community" diff --git a/addons/orioledb/config/etcd-serve-config.tpl b/addons/orioledb/config/etcd-serve-config.tpl deleted file mode 100644 index fc1f30a7c..000000000 --- a/addons/orioledb/config/etcd-serve-config.tpl +++ /dev/null @@ -1,18 +0,0 @@ -{{- $clusterName := $.cluster.metadata.name }} -{{- $namespace := $.cluster.metadata.namespace }} -{{- $orioledb_etcd_from_service_ref := fromJson "{}" }} -{{- if index $.component "serviceReferences" }} - {{- range $i, $e := $.component.serviceReferences }} - {{- if eq $i "etcdService" }} - {{- $orioledb_etcd_from_service_ref = $e }} - {{- break }} - {{- end }} - {{- end }} -{{- end }} -{{- $etcd_server := "" }} -{{- if $orioledb_etcd_from_service_ref }} - {{- if (index $orioledb_etcd_from_service_ref.spec "endpoint") }} - {{- $etcd_server = printf "%s" $orioledb_etcd_from_service_ref.spec.endpoint.value }} - {{- end }} -{{- end }} -export PATRONI_ETCD3_HOST={{ $etcd_server }} \ No newline at end of file diff --git a/addons/orioledb/scripts/generate_patroni_yaml.py b/addons/orioledb/scripts/generate_patroni_yaml.py new file mode 100755 index 000000000..5e308eb41 --- /dev/null +++ b/addons/orioledb/scripts/generate_patroni_yaml.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import os +import sys +import yaml + + +def write_file(config, filename, overwrite): + if not overwrite and os.path.exists(filename): + pass + else: + with open(filename, 'w') as f: + f.write(config) + + +def read_file_lines(file): + ret = [] + for line in file.readlines(): + line = line.strip() + if line and not line.startswith('#'): + ret.append(line) + return ret + + +def postgresql_conf_to_dict(file_path): + with open(file_path, 'r') as f: + content = f.read() + lines = content.splitlines() + result = {} + for line in lines: + if line.startswith('#'): + continue + if '=' not in line: + continue + key, value = line.split('=', 1) + result[key.strip()] = value.strip().strip("'") + return result + + +def main(filename): + restore_dir = os.environ.get('RESTORE_DATA_DIR', '') + local_config = yaml.safe_load( + os.environ.get('SPILO_CONFIGURATION', os.environ.get('PATRONI_CONFIGURATION', ''))) or {} + pod_ip = os.environ.get('POD_IP') + # scope + local_config['scope'] = os.environ.get('SCOPE') + # name + local_config['name'] = os.environ.get('CURRENT_POD_NAME') + # etcd3 + local_config['etcd3'] = { + 'host': os.environ.get('PATRONI_DCS_ETCD_SERVICE_ENDPOINT') + } + # restapi + local_config['restapi'] = { + 'listen': f'{pod_ip}:8008', + 'connect_address': f'{pod_ip}:8008', + } + # postgresql + if 'postgresql' not in local_config: + local_config['postgresql'] = {} + postgresql = local_config['postgresql'] + postgresql['data_dir'] = os.environ.get('PGDATA') + postgresql['config_dir'] = '/home/postgres/pgdata/conf' + postgresql['custom_conf'] = '/home/postgres/conf/postgresql.conf' + postgresql['authentication'] = {} + postgresql['listen'] = '0.0.0.0:5432' + postgresql['connect_address'] = f'{pod_ip}:5432' + authentication = postgresql['authentication'] + authentication['superuser'] = {"username": os.environ.get('PGUSER_SUPERUSER'), + 'password': os.environ.get('PGPASSWORD_SUPERUSER')} + authentication['replication'] = {'username': os.environ.get('PGUSER_SUPERUSER'), + 'password': os.environ.get('POSTGRES_PASSWORD')} + + # add pg_hba.conf + with open('/home/postgres/conf/pg_hba.conf', 'r') as f: + lines = read_file_lines(f) + if lines: + postgresql['pg_hba'] = lines + + if restore_dir and os.path.isfile(os.path.join(restore_dir, 'kb_restore.signal')): + if 'bootstrap' not in local_config: + local_config['bootstrap'] = {} + with open('/home/postgres/conf/kb_restore.conf', 'r') as f: + local_config['bootstrap'].update(yaml.safe_load(f)) + + local_config['bootstrap'] = {} + bootstrap = local_config['bootstrap'] + bootstrap['dcs'] = { + 'postgresql': { + 'parameters': {'listen_addresses': "0.0.0.0", "port": 5432} + } + } + # point in time recovery(PITR) + if os.path.isfile("/home/postgres/pgdata/conf/recovery.conf"): + with open('/home/postgres/conf/kb_pitr.conf', 'r') as f: + pitr_config = yaml.safe_load(f) + re_config = postgresql_conf_to_dict("/home/postgres/pgdata/conf/recovery.conf") + pitr_config[pitr_config['method']]['recovery_conf'].update(re_config) + local_config['bootstrap'].update(pitr_config) + + # patroni parameters + if 'bootstrap' not in local_config: + local_config['bootstrap'] = {} + if 'dcs' not in local_config['bootstrap']: + local_config['bootstrap']['dcs'] = {} + if os.path.exists('/home/postgres/conf/patroni.yaml'): + with open('/home/postgres/conf/patroni.yaml', 'r') as f: + local_config['bootstrap']['dcs'].update(yaml.safe_load(f)) + else: + print('patroni.yaml not found') + + # bootstrap + write_file(yaml.dump(local_config, default_flow_style=False), filename, True) + + +if __name__ == '__main__': + main(sys.argv[1]) diff --git a/addons/orioledb/scripts/pgbouncer-setup.sh b/addons/orioledb/scripts/pgbouncer-setup.sh new file mode 100755 index 000000000..00e66bdb8 --- /dev/null +++ b/addons/orioledb/scripts/pgbouncer-setup.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +pgbouncer_template_conf_file="/home/pgbouncer/conf/pgbouncer.ini" +pgbouncer_conf_dir="/opt/bitnami/pgbouncer/conf/" +pgbouncer_log_dir="/opt/bitnami/pgbouncer/logs/" +pgbouncer_tmp_dir="/opt/bitnami/pgbouncer/tmp/" +pgbouncer_conf_file="/opt/bitnami/pgbouncer/conf/pgbouncer.ini" +pgbouncer_user_list_file="/opt/bitnami/pgbouncer/conf/userlist.txt" + +load_common_library() { + # the common.sh scripts is mounted to the same path which is defined in the cmpd.spec.scripts + common_library_file="/kb-scripts/common.sh" + # shellcheck disable=SC1090 + source "${common_library_file}" +} + +build_pgbouncer_conf() { + if is_empty "$POSTGRESQL_USERNAME" || is_empty "$POSTGRESQL_PASSWORD" || is_empty "$CURRENT_POD_IP"; then + echo "POSTGRESQL_USERNAME, POSTGRESQL_PASSWORD or CURRENT_POD_IP is not set. Exiting..." + exit 1 + fi + + mkdir -p $pgbouncer_conf_dir $pgbouncer_log_dir $pgbouncer_tmp_dir + cp $pgbouncer_template_conf_file $pgbouncer_conf_dir + echo "\"$POSTGRESQL_USERNAME\" \"$POSTGRESQL_PASSWORD\"" > $pgbouncer_user_list_file + # shellcheck disable=SC2129 + echo -e "\\n[databases]" >> $pgbouncer_conf_file + echo "postgres=host=$CURRENT_POD_IP port=5432 dbname=postgres" >> $pgbouncer_conf_file + echo "*=host=$CURRENT_POD_IP port=5432" >> $pgbouncer_conf_file + chmod 777 $pgbouncer_conf_file + chmod 777 $pgbouncer_user_list_file + useradd pgbouncer + chown -R pgbouncer:pgbouncer $pgbouncer_conf_dir $pgbouncer_log_dir $pgbouncer_tmp_dir +} + +start_pgbouncer() { + /opt/bitnami/scripts/pgbouncer/run.sh +} + +# This is magic for shellspec ut framework. +# Sometime, functions are defined in a single shell script. +# You will want to test it. but you do not want to run the script. +# When included from shellspec, __SOURCED__ variable defined and script +# end here. The script path is assigned to the __SOURCED__ variable. +${__SOURCED__:+false} : || return 0 + +# main +load_common_library +build_pgbouncer_conf +start_pgbouncer diff --git a/addons/orioledb/scripts/postgres-pre-setup.sh b/addons/orioledb/scripts/postgres-pre-setup.sh new file mode 100755 index 000000000..8a3877ba1 --- /dev/null +++ b/addons/orioledb/scripts/postgres-pre-setup.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +postgres_template_conf_file="/home/postgres/conf/postgresql.conf" +postgres_conf_dir="/home/postgres/pgdata/conf/" +postgres_conf_file="/home/postgres/pgdata/conf/postgresql.conf" +postgres_log_dir="/home/postgres/pgdata/logs/" +postgres_scripts_log_file="${postgres_log_dir}/scripts.log" + +build_real_postgres_conf() { + mkdir -p "$postgres_conf_dir" + chmod -R 777 "$postgres_conf_dir" + cp "$postgres_template_conf_file" "$postgres_conf_dir" + chmod 777 "$postgres_conf_file" +} + +init_postgres_log() { + mkdir -p "$postgres_log_dir" + chmod -R 777 "$postgres_log_dir" + touch "$postgres_scripts_log_file" + chmod 666 "$postgres_scripts_log_file" +} + +# This is magic for shellspec ut framework. +# Sometime, functions are defined in a single shell script. +# You will want to test it. but you do not want to run the script. +# When included from shellspec, __SOURCED__ variable defined and script +# end here. The script path is assigned to the __SOURCED__ variable. +${__SOURCED__:+false} : || return 0 + +# main +build_real_postgres_conf +init_postgres_log diff --git a/addons/orioledb/scripts/postgres-setup.sh b/addons/orioledb/scripts/postgres-setup.sh new file mode 100755 index 000000000..d67934b0c --- /dev/null +++ b/addons/orioledb/scripts/postgres-setup.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +tmp_patroni_yaml="tmp_patroni.yaml" + +load_common_library() { + # the common.sh scripts is mounted to the same path which is defined in the cmpd.spec.scripts + common_library_file="/kb-scripts/common.sh" + # shellcheck disable=SC1090 + source "${common_library_file}" +} + +init_etcd_dcs_config_if_needed() { + if ! is_empty "$PATRONI_DCS_ETCD_SERVICE_ENDPOINT"; then + echo "PATRONI_DCS_ETCD_SERVICE_ENDPOINT is set. Use etcd as DCS backend and unset DCS_ENABLE_KUBERNETES_API" + export ETCDCTL_API=${PATRONI_DCS_ETCD_VERSION:-'2'} + export DCS_ENABLE_KUBERNETES_API="" + if [ "$ETCDCTL_API" = "3" ]; then + export ETCD3_HOSTS=$PATRONI_DCS_ETCD_SERVICE_ENDPOINT + else + export ETCD_HOSTS=$PATRONI_DCS_ETCD_SERVICE_ENDPOINT + fi + fi +} + +regenerate_spilo_configuration_and_start_postgres() { + if [ -d "/home/postgres/pgdata/conf" ]; then + chmod 750 /home/postgres/pgdata/pgroot/data + else + mkdir -p /home/postgres/pgdata/conf + chmod 777 -R /home/postgres/pgdata + cp /home/postgres/conf/postgresql.conf /home/postgres/pgdata/conf + chmod 777 -R /home/postgres/pgdata/conf + fi + + IFS='-' read -ra parts <<< "$CURRENT_POD_NAME" + if [ ${parts[-1]} != '0' ]; then + MAX_RETRIES=30 + WAIT_INTERVAL=5 + retries=0 + while [ $retries -lt $MAX_RETRIES ]; do + POD_0_FQDN="$POSTGRES_COMPONENT_NAME-0-$POSTGRES_COMPONENT_NAME-headless.$CLUSTER_NAMESPACE.svc.cluster.local" + pg_isready -h $POD_0_FQDN + status=$? + if [ $status -eq 0 ]; then + echo "PostgreSQL is ready!" + break + else + echo "PostgreSQL is not ready yet. Retrying in $WAIT_INTERVAL seconds..." + sleep $WAIT_INTERVAL + retries=$((retries + 1)) + fi + done + else + cp /kb-scripts/init.sql /docker-entrypoint-initdb.d + bash /usr/local/bin/docker-entrypoint.sh postgres + fi + + python3 /kb-scripts/generate_patroni_yaml.py /var/lib/postgresql/tmp_patroni.yaml + chmod 777 /var/lib/postgresql/tmp_patroni.yaml + su - postgres -c "patroni /var/lib/postgresql/tmp_patroni.yaml" +} + +# This is magic for shellspec ut framework. +# Sometime, functions are defined in a single shell script. +# You will want to test it. but you do not want to run the script. +# When included from shellspec, __SOURCED__ variable defined and script +# end here. The script path is assigned to the __SOURCED__ variable. +${__SOURCED__:+false} : || return 0 + +# main +load_common_library +init_etcd_dcs_config_if_needed +regenerate_spilo_configuration_and_start_postgres diff --git a/addons/orioledb/scripts/switchover.sh b/addons/orioledb/scripts/switchover.sh new file mode 100644 index 000000000..2e9dea96a --- /dev/null +++ b/addons/orioledb/scripts/switchover.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +# This is magic for shellspec ut framework. "test" is a `test [expression]` well known as a shell command. +# Normally test without [expression] returns false. It means that __() { :; } +# function is defined if this script runs directly. +# +# shellspec overrides the test command and returns true *once*. It means that +# __() function defined internally by shellspec is called. +# +# In other words. If not in test mode, __ is just a comment. If test mode, __ +# is a interception point. +# you should set ut_mode="true" when you want to run the script in shellspec file. +# shellcheck disable=SC2034 +ut_mode="false" +test || __() { + # when running in non-unit test mode, set the options "set -ex". + set -ex; +} + +load_common_library() { + # the common.sh scripts is mounted to the same path which is defined in the cmpd.spec.scripts + common_library_file="/kb-scripts/common.sh" + # shellcheck disable=SC1090 + source "${common_library_file}" +} + +switchover_with_candidate() { + local current_pod_fqdn=$1 + local current_primary_pod_name=$2 + # shellcheck disable=SC2034 + local candidate_pod_name=$3 + # TODO: check the role in kernel before switchover + curl -s "http://${current_pod_fqdn}:8008/switchover" -XPOST -d "{\"leader\":\"${current_primary_pod_name}\",\"candidate\":\"${candidate_pod_name}\"}" + # TODO: check switchover result +} + +switchover_without_candidate() { + local current_pod_fqdn=$1 + # shellcheck disable=SC2034 + local current_primary_pod_name=$2 + # TODO: check the role in kernel before switchover + curl -s "http://${current_pod_fqdn}:8008/switchover" -XPOST -d "{\"leader\":\"${current_primary_pod_name}\"}" + # TODO: check switchover result +} + +switchover() { + # CURRENT_POD_NAME defined in the switchover action env and POSTGRES_PRIMARY_POD_NAME defined in the cmpd.spec.vars + if is_empty "$CURRENT_POD_NAME" || is_empty "$POSTGRES_PRIMARY_POD_NAME"; then + echo "CURRENT_POD_NAME or POSTGRES_PRIMARY_POD_NAME is not set. Exiting..." + exit 1 + fi + + # shellcheck disable=SC2207 + primary_pod_name_list=($(split "$POSTGRES_PRIMARY_POD_NAME" ",")) + # if primary_pod_name_list length is not 1, it means the primary pod is not unique. + if [ "${#primary_pod_name_list[@]}" -ne 1 ]; then + echo "Error: POSTGRES_PRIMARY_POD_NAME should be a unique pod name. Exiting." + exit 1 + fi + + # POSTGRES_POD_NAME_LIST and POSTGRES_POD_FQDN_LIST defined in the cmpd.spec.vars + if is_empty "$POSTGRES_POD_NAME_LIST" || is_empty "$POSTGRES_POD_FQDN_LIST" ; then + echo "POSTGRES_POD_NAME_LIST or POSTGRES_POD_FQDN_LIST is not set. Exiting..." + exit 1 + fi + + current_pod_fqdn=$(get_target_pod_fqdn_from_pod_fqdn_vars "$POSTGRES_POD_FQDN_LIST" "$CURRENT_POD_NAME") + if is_empty "$current_pod_fqdn"; then + echo "Error: Failed to get current pod: $CURRENT_POD_NAME fqdn from postgres pod fqdn list: $POSTGRES_POD_FQDN_LIST. Exiting." + exit 1 + fi + + # KB_SWITCHOVER_CANDIDATE_NAME is built-in env in the switchover action injected by the KubeBlocks controller + if ! is_empty "$KB_SWITCHOVER_CANDIDATE_NAME"; then + switchover_with_candidate "$current_pod_fqdn" "$POSTGRES_PRIMARY_POD_NAME" "$KB_SWITCHOVER_CANDIDATE_NAME" + else + switchover_without_candidate "$current_pod_fqdn" "$POSTGRES_PRIMARY_POD_NAME" + fi +} + +# This is magic for shellspec ut framework. +# Sometime, functions are defined in a single shell script. +# You will want to test it. but you do not want to run the script. +# When included from shellspec, __SOURCED__ variable defined and script +# end here. The script path is assigned to the __SOURCED__ variable. +${__SOURCED__:+false} : || return 0 + +# main +load_common_library +switchover \ No newline at end of file diff --git a/addons/orioledb/templates/NOTES.txt b/addons/orioledb/templates/NOTES.txt deleted file mode 100644 index 4361e255f..000000000 --- a/addons/orioledb/templates/NOTES.txt +++ /dev/null @@ -1,6 +0,0 @@ -KubeBlocks Orioledb 14.7.2-beta1 - -orioledb cluster in KubeBlocks relies on an etcd component named 'etcd'. - -So you need to create an etcd cluster in KubeBlocks by `kbcli cluster create etcd --cluster-definition etcd` first - diff --git a/addons/orioledb/templates/_helpers.tpl b/addons/orioledb/templates/_helpers.tpl index 5717672c0..436c5e3d3 100644 --- a/addons/orioledb/templates/_helpers.tpl +++ b/addons/orioledb/templates/_helpers.tpl @@ -54,6 +54,7 @@ app.kubernetes.io/instance: {{ .Release.Name }} Common annotations */}} {{- define "orioledb.annotations" -}} +helm.sh/resource-policy: keep {{ include "orioledb.apiVersion" . }} {{- end }} @@ -63,3 +64,83 @@ API version annotation {{- define "orioledb.apiVersion" -}} kubeblocks.io/crd-api-version: apps.kubeblocks.io/v1 {{- end }} + +{{/* +Define orioledb component definition name +*/}} +{{- define "orioledb.cmpdName" -}} +orioledb-{{ .Chart.Version }} +{{- end -}} + +{{/* +Define orioledb component version name +*/}} +{{- define "orioledb.cmpvName" -}} +orioledb +{{- end -}} + +{{/* +Define orioledb component definition regex pattern +*/}} +{{- define "orioledb.cmpdRegexPattern" -}} +^orioledb- +{{- end -}} + +{{/* +Define orioledb component configuration template name +*/}} +{{- define "orioledb.configurationTemplate" -}} +orioledb-configuration-{{ .Chart.Version }} +{{- end -}} + +{{/* +Define orioledb component config constraint name +*/}} +{{- define "orioledb.configConstraint" -}} +orioledb-cc-{{ .Chart.Version }} +{{- end -}} + +{{/* +Define orioledb pgbouncer configuration template name +*/}} +{{- define "orioledb-pgbouncer.configurationTemplate" -}} +orioledb-pgbouncer-configuration-{{ .Chart.Version }} +{{- end -}} + +{{/* +Define orioledb scripts configMap template name +*/}} +{{- define "orioledb.scriptsTemplate" -}} +orioledb-scripts-{{ .Chart.Version }} +{{- end -}} + +{{/* +Define orioledb patroni reload scripts template name +*/}} +{{- define "orioledb.patroniReloadScriptsTemplate" -}} +orioledb-patroni-reload-scripts-{{ .Chart.Version }} +{{- end -}} + +{{/* +Define orioledb component metrice configuration name +*/}} +{{- define "orioledb.metricsConfiguration" -}} +orioledb-custom-metrics +{{- end -}} + +{{/* +Define orioledb component agamotto configuration name +*/}} +{{- define "orioledb.agamottoConfiguration" -}} +orioledb-agamotto-configuration +{{- end -}} + +{{/* +Generate scripts configmap +*/}} +{{- define "orioledb.extend.scripts" -}} +{{- range $path, $_ := $.Files.Glob "scripts/**" }} +{{ $path | base }}: |- +{{- $.Files.Get $path | nindent 2 }} +{{- end }} +{{- end }} diff --git a/addons/orioledb/templates/agamotto-configmap.yaml b/addons/orioledb/templates/agamotto-configuration-template.yaml similarity index 95% rename from addons/orioledb/templates/agamotto-configmap.yaml rename to addons/orioledb/templates/agamotto-configuration-template.yaml index 56d7ce45c..c3479217d 100644 --- a/addons/orioledb/templates/agamotto-configmap.yaml +++ b/addons/orioledb/templates/agamotto-configuration-template.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: orioledb-agamotto-configuration + name: {{ include "orioledb.agamottoConfiguration" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} data: diff --git a/addons/orioledb/templates/cmpd.yaml b/addons/orioledb/templates/cmpd.yaml index cd0551312..09b4fbaae 100644 --- a/addons/orioledb/templates/cmpd.yaml +++ b/addons/orioledb/templates/cmpd.yaml @@ -1,7 +1,7 @@ apiVersion: apps.kubeblocks.io/v1 kind: ComponentDefinition metadata: - name: orioledb-{{ .Chart.Version }} + name: {{ include "orioledb.cmpdName" }} labels: {{- include "orioledb.labels" . | nindent 4 }} annotations: @@ -11,11 +11,214 @@ spec: description: {{ .Chart.Description }} serviceKind: {{ .Chart.Name }} serviceVersion: {{ .Chart.AppVersion }} + services: + - name: default + spec: + ports: + - name: tcp-orioledb + port: 5432 + targetPort: tcp-orioledb + - name: tcp-pgbouncer + port: 6432 + targetPort: tcp-pgbouncer + configs: + - name: orioledb-configuration + templateRef: {{ include "orioledb.configurationTemplate" . }} + constraintRef: {{ include "orioledb.configConstraint" . }} + keys: + - postgresql.conf + namespace: {{ .Release.Namespace }} + volumeName: postgresql-config + defaultMode: 0777 + - name: orioledb-pgbouncer-configuration + templateRef: {{ include "orioledb-pgbouncer.configurationTemplate" . }} + keys: + - pgbouncer.ini + namespace: {{ .Release.Namespace }} + volumeName: pgbouncer-config + defaultMode: 0777 + - name: orioledb-custom-metrics + templateRef: {{ include "orioledb.metricsConfiguration" . }} + namespace: {{ .Release.Namespace }} + volumeName: postgresql-custom-metrics + defaultMode: 0777 + - name: agamotto-configuration + templateRef: {{ include "orioledb.agamottoConfiguration" . }} + namespace: {{ .Release.Namespace }} + volumeName: agamotto-configuration + defaultMode: 0777 + scripts: + - name: orioledb-scripts + templateRef: {{ include "orioledb.scriptsTemplate" . }} + namespace: {{ .Release.Namespace }} + volumeName: scripts + defaultMode: 0777 + logConfigs: + {{- range $name,$pattern := .Values.logConfigs }} + - name: {{ $name }} + filePathPattern: {{ $pattern }} + {{- end }} + systemAccounts: + - name: postgres + initAccount: true + passwordGenerationPolicy: + length: 10 + numDigits: 5 + numSymbols: 0 + letterCase: MixedCases + - name: kbadmin + statement: CREATE USER ${KB_ACCOUNT_NAME} SUPERUSER PASSWORD '${KB_ACCOUNT_PASSWORD}'; + passwordGenerationPolicy: &defaultPasswdGenerationPolicy + length: 10 + numDigits: 5 + numSymbols: 0 + letterCase: MixedCases + - name: kbdataprotection + statement: CREATE USER ${KB_ACCOUNT_NAME} SUPERUSER PASSWORD '${KB_ACCOUNT_PASSWORD}'; + passwordGenerationPolicy: *defaultPasswdGenerationPolicy + - name: kbprobe + statement: CREATE USER ${KB_ACCOUNT_NAME} WITH PASSWORD '${KB_ACCOUNT_PASSWORD}'; GRANT pg_monitor TO ${KB_ACCOUNT_NAME}; + passwordGenerationPolicy: *defaultPasswdGenerationPolicy + - name: kbmonitoring + statement: CREATE USER ${KB_ACCOUNT_NAME} WITH PASSWORD '${KB_ACCOUNT_PASSWORD}'; GRANT pg_monitor TO ${KB_ACCOUNT_NAME}; + passwordGenerationPolicy: *defaultPasswdGenerationPolicy + - name: kbreplicator + statement: CREATE USER ${KB_ACCOUNT_NAME} WITH REPLICATION PASSWORD '${KB_ACCOUNT_PASSWORD}'; + passwordGenerationPolicy: *defaultPasswdGenerationPolicy + tls: + volumeName: tls + mountPath: /etc/pki/tls + caFile: ca.pem + certFile: cert.pem + keyFile: key.pem + serviceRefDeclarations: + - name: etcd + serviceRefDeclarationSpecs: + - serviceKind: etcd + serviceVersion: "^*" + optional: true + vars: + - name: CLUSTER_NAME + valueFrom: + clusterVarRef: + clusterName: Required + - name: CLUSTER_NAMESPACE + valueFrom: + clusterVarRef: + namespace: Required + - name: POSTGRES_COMPONENT_NAME + valueFrom: + componentVarRef: + optional: false + componentName: Required + - name: POSTGRES_COMPONENT_SHORT_NAME + valueFrom: + componentVarRef: + optional: false + shortName: Required + - name: POSTGRES_USER + valueFrom: + credentialVarRef: + name: postgres + optional: false + username: Required + - name: POSTGRES_PASSWORD + valueFrom: + credentialVarRef: + name: postgres + optional: false + password: Required + - name: POSTGRES_POD_NAME_LIST + valueFrom: + componentVarRef: + optional: false + podNames: Required + - name: POSTGRES_POD_FQDN_LIST + valueFrom: + componentVarRef: + optional: false + podFQDNs: Required + - name: POSTGRES_PRIMARY_POD_NAME + valueFrom: + componentVarRef: + optional: true + podNamesForRole: + role: primary + option: Optional + - name: PATRONI_DCS_ETCD_VERSION + value: "3" + - name: PATRONI_DCS_ETCD_SERVICE_ENDPOINT + valueFrom: + serviceRefVarRef: + name: etcd + endpoint: Required + optional: true + - name: TLS_ENABLED + valueFrom: + tlsVarRef: + enabled: Optional + volumes: + - name: data + needSnapshot: true + lifecycleActions: + switchover: + exec: + image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} + container: postgresql + command: [ "/kb-scripts/switchover.sh" ] + env: + - name: CURRENT_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + accountProvision: + exec: + image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} + container: postgresql + command: + - bash + - -c + - | + eval statement=\"${KB_ACCOUNT_STATEMENT}\" + psql -h 127.0.0.1 -c "${statement}" + env: + - name: PGUSER + value: $(POSTGRES_USER) + - name: PGPASSWORD + value: $(POSTGRES_PASSWORD) + targetPodSelector: Role + matchingKey: primary runtime: securityContext: runAsUser: 0 fsGroup: 103 runAsGroup: 103 + initContainers: + - name: pg-init-container + image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }} + command: + - /kb-scripts/postgres-pre-setup.sh + volumeMounts: + - name: data + mountPath: /home/postgres/pgdata + - name: postgresql-config + mountPath: /home/postgres/conf + - name: scripts + mountPath: /kb-scripts + - command: + - cp + - -r + - /bin/dbctl + - /config + - /tools/ + image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.dbctl.repository }}:{{ .Values.image.dbctl.tag }} + imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }} + name: init-dbctl + volumeMounts: + - mountPath: /tools + name: tools containers: - name: postgresql image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} @@ -23,7 +226,7 @@ spec: command: - bin/bash - -c - - /kb-scripts/setup.sh + - /kb-scripts/postgres-setup.sh securityContext: runAsUser: 0 readinessProbe: @@ -49,24 +252,24 @@ spec: mountPath: /home/postgres/conf - name: scripts mountPath: /kb-scripts - - name: pod-info - mountPath: /kb-podinfo - - name: patroni-dependency - mountPath: /dependency ports: - name: tcp-orioledb containerPort: 5432 - name: patroni containerPort: 8008 env: ## refer https://github.com/zalando/spilo/blob/master/ENVIRONMENT.rst - - name: PGROOT - value: /home/postgres/pgdata/pgroot + - name: DCS_ENABLE_KUBERNETES_API + value: "true" + - name: KUBERNETES_USE_CONFIGMAPS + value: "true" - name: SCOPE - value: "$(KB_CLUSTER_NAME)-$(KB_COMP_NAME)-patroni$(KB_CLUSTER_UID_POSTFIX_8)" + value: $(POSTGRES_COMPONENT_NAME) - name: KUBERNETES_SCOPE_LABEL value: "apps.kubeblocks.postgres.patroni/scope" - name: KUBERNETES_ROLE_LABEL value: "apps.kubeblocks.postgres.patroni/role" + - name: KUBERNETES_LABELS + value: '{"app.kubernetes.io/managed-by":"kubeblocks","app.kubernetes.io/instance":"$(CLUSTER_NAME)","apps.kubeblocks.io/component-name":"$(POSTGRES_COMPONENT_SHORT_NAME)","apps.kubeblocks.postgres.patroni/scope":"$(POSTGRES_COMPONENT_NAME)"}' - name: RESTORE_DATA_DIR value: /home/postgres/pgdata/kb_restore - name: KB_PG_CONFIG_PATH @@ -77,6 +280,11 @@ spec: value: /home/postgres/pgdata/pgroot - name: PGDATA value: /home/postgres/pgdata/pgroot/data + - name: CURRENT_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name - name: POD_IP valueFrom: fieldRef: @@ -115,7 +323,7 @@ spec: - name: scripts mountPath: /kb-scripts command: - - /kb-scripts/pgbouncer_setup.sh + - /kb-scripts/pgbouncer-setup.sh livenessProbe: failureThreshold: 3 initialDelaySeconds: 15 @@ -150,6 +358,21 @@ spec: value: "6432" - name: PGBOUNCER_BIND_ADDRESS value: "0.0.0.0" + - name: CURRENT_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: CURRENT_POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + - name: CURRENT_POD_HOST_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP - name: metrics image: {{ .Values.metrics.image.registry | default ( .Values.image.registry | default "docker.io" ) }}/{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }} imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} @@ -179,145 +402,4 @@ spec: medium: Memory {{- with .Values.shmVolume.sizeLimit }} sizeLimit: {{ . }} - {{- end }} - - name: pod-info - downwardAPI: - items: - - path: "pod-role" - fieldRef: - fieldPath: metadata.labels['kubeblocks.io/role'] - - path: "primary-pod" - fieldRef: - fieldPath: metadata.annotations['rs.apps.kubeblocks.io/primary'] - - path: "component-replicas" - fieldRef: - fieldPath: metadata.annotations['apps.kubeblocks.io/component-replicas'] - vars: - - name: POSTGRES_USER - value: postgres - - name: POSTGRES_PASSWORD - valueFrom: - credentialVarRef: - name: postgres - optional: false - password: Required - - name: TLS_ENABLED - valueFrom: - tlsVarRef: - enabled: Optional - volumes: - - name: data - needSnapshot: true - services: - - name: default - spec: - ports: - - name: tcp-orioledb - port: 5432 - targetPort: tcp-orioledb - - name: tcp-pgbouncer - port: 6432 - targetPort: tcp-pgbouncer - configs: - - name: orioledb-configuration - templateRef: orioledb-configuration - constraintRef: orioledb-cc - keys: - - postgresql.conf - namespace: {{ .Release.Namespace }} - volumeName: postgresql-config - defaultMode: 0777 - - name: orioledb-pgbouncer-configuration - templateRef: orioledb-pgbouncer-configuration - keys: - - pgbouncer.ini - namespace: {{ .Release.Namespace }} - volumeName: pgbouncer-config - defaultMode: 0777 - - name: orioledb-custom-metrics - templateRef: orioledb-custom-metrics - namespace: {{ .Release.Namespace }} - volumeName: postgresql-custom-metrics - defaultMode: 0777 - - name: agamotto-configuration - templateRef: orioledb-agamotto-configuration - namespace: {{ .Release.Namespace }} - volumeName: agamotto-configuration - defaultMode: 0777 - - name: etcd-env - templateRef: etcd-env - namespace: {{ .Release.Namespace }} - volumeName: patroni-dependency - defaultMode: 0777 - scripts: - - name: orioledb-scripts - templateRef: orioledb-scripts - namespace: {{ .Release.Namespace }} - volumeName: scripts - defaultMode: 0777 - logConfigs: - {{- range $name,$pattern := .Values.logConfigs }} - - name: {{ $name }} - filePathPattern: {{ $pattern }} - {{- end }} - systemAccounts: - - username: postgres - initAccount: true - passwordGenerationPolicy: &defaultPasswordGenerationPolicy - length: 10 - numDigits: 5 - numSymbols: 0 - letterCase: MixedCases - - name: kbadmin - statement: CREATE USER $(USERNAME) SUPERUSER PASSWORD '$(PASSWD)'; - passwordGenerationPolicy: *defaultPasswordGenerationPolicy - - name: kbdataprotection - statement: CREATE USER $(USERNAME) SUPERUSER PASSWORD '$(PASSWD)'; - passwordGenerationPolicy: *defaultPasswordGenerationPolicy - - name: kbprobe - statement: CREATE USER $(USERNAME) WITH PASSWORD '$(PASSWD)'; GRANT pg_monitor TO $(USERNAME); - passwordGenerationPolicy: *defaultPasswordGenerationPolicy - - name: kbmonitoring - statement: CREATE USER $(USERNAME) WITH PASSWORD '$(PASSWD)'; GRANT pg_monitor TO $(USERNAME); - passwordGenerationPolicy: *defaultPasswordGenerationPolicy - - name: kbreplicator - statement: CREATE USER $(USERNAME) WITH REPLICATION PASSWORD '$(PASSWD)'; - passwordGenerationPolicy: *defaultPasswordGenerationPolicy - tls: - volumeName: tls - mountPath: /etc/pki/tls - caFile: ca.pem - certFile: cert.pem - keyFile: key.pem - serviceRefDeclarations: - - name: etcdService - serviceRefDeclarationSpecs: - - serviceKind: etcd - serviceVersion: ^v3.\d...d$ - lifecycleActions: - switchover: - exec: - image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} - command: - - /bin/bash - - -c - - | - if [ -z "${KB_SWITCHOVER_CANDIDATE_NAME}" ]; then - curl -s http://$(KB_LEADER_POD_FQDN):8008/switchover -XPOST -d '{"leader":"$(KB_REPLICATION_PRIMARY_POD_NAME)"}' - else - curl -s http://$(KB_LEADER_POD_FQDN):8008/switchover -XPOST -d '{"leader":"$(KB_LEADER_POD_NAME)","candidate":"$(KB_SWITCHOVER_CANDIDATE_NAME)"}' - fi - accountProvision: - exec: - image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} - command: - - psql - args: - - -h$(KB_ACCOUNT_ENDPOINT) - - -c - - $(KB_ACCOUNT_STATEMENT) - env: - - name: PGUSER - value: $(POSTGRES_USER) - - name: PGPASSWORD - value: $(POSTGRES_PASSWORD) + {{- end }} \ No newline at end of file diff --git a/addons/orioledb/templates/cmpv.yaml b/addons/orioledb/templates/cmpv.yaml new file mode 100644 index 000000000..21f609577 --- /dev/null +++ b/addons/orioledb/templates/cmpv.yaml @@ -0,0 +1,23 @@ +apiVersion: apps.kubeblocks.io/v1 +kind: ComponentVersion +metadata: + name: {{ include "orioledb.cmpvName" . }} + labels: + {{- include "orioledb.labels" . | nindent 4 }} + annotations: + {{- include "orioledb.apiVersion" . | nindent 4 }} +spec: + compatibilityRules: + - compDefs: + - {{ include "orioledb.cmpdRegexPattern" . }} + releases: + - 14.7.2-beta1 + releases: + - name: 14.7.2-beta1 + changes: + serviceVersion: 14.7.2 + images: + pg-init-container: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:beta1 + init-dbctl: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.dbctl.repository }}:0.1.5 + postgresql: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:beta1 + pgbouncer: {{ .Values.pgbouncer.image.registry | default ( .Values.image.registry | default "docker.io" ) }}/{{ .Values.pgbouncer.image.repository }}:1.19.0 \ No newline at end of file diff --git a/addons/orioledb/templates/configconstraint.yaml b/addons/orioledb/templates/configconstraint.yaml index 50852eed9..b9725ea03 100644 --- a/addons/orioledb/templates/configconstraint.yaml +++ b/addons/orioledb/templates/configconstraint.yaml @@ -2,14 +2,14 @@ apiVersion: apps.kubeblocks.io/v1beta1 kind: ConfigConstraint metadata: - name: orioledb-cc + name: {{ include "orioledb.configConstraint" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} spec: reloadAction: tplScriptTrigger: sync: false - scriptConfigMapRef: orioledb-patroni-reload-script + scriptConfigMapRef: {{ include "orioledb.patroniReloadScriptsTemplate" . }} namespace: {{ .Release.Namespace }} # update patroni master targetPodSelector: diff --git a/addons/orioledb/templates/etcd-configmap.yaml b/addons/orioledb/templates/etcd-configmap.yaml deleted file mode 100644 index 2fc3f26bf..000000000 --- a/addons/orioledb/templates/etcd-configmap.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: etcd-env - labels: - {{- include "orioledb.labels" . | nindent 4 }} -data: - conf: |- - {{- .Files.Get "config/etcd-serve-config.tpl" | nindent 4 }} - diff --git a/addons/orioledb/templates/metrics-configmap-14.yaml b/addons/orioledb/templates/metrics-configuration-template.yaml similarity index 99% rename from addons/orioledb/templates/metrics-configmap-14.yaml rename to addons/orioledb/templates/metrics-configuration-template.yaml index f9600e744..05034d8a7 100644 --- a/addons/orioledb/templates/metrics-configmap-14.yaml +++ b/addons/orioledb/templates/metrics-configuration-template.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: orioledb-custom-metrics + name: {{ include "orioledb.metricsConfiguration" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} data: diff --git a/addons/orioledb/templates/configmap.yaml b/addons/orioledb/templates/orioledb-configuration-template.yaml similarity index 94% rename from addons/orioledb/templates/configmap.yaml rename to addons/orioledb/templates/orioledb-configuration-template.yaml index 92c5deee4..98331ac05 100644 --- a/addons/orioledb/templates/configmap.yaml +++ b/addons/orioledb/templates/orioledb-configuration-template.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: orioledb-configuration + name: {{ include "orioledb.configurationTemplate" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} data: diff --git a/addons/orioledb/templates/orioledb-scripts-template.yaml b/addons/orioledb/templates/orioledb-scripts-template.yaml new file mode 100644 index 000000000..1777fb79d --- /dev/null +++ b/addons/orioledb/templates/orioledb-scripts-template.yaml @@ -0,0 +1,50 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "orioledb.scriptsTemplate" . }} + labels: + {{- include "orioledb.labels" . | nindent 4 }} +data: + init.sql: | + CREATE EXTENSION pg_stat_statements; + backup-log-collector.sh: | + #!/bin/bash + set -o errexit + set -o nounset + SHOW_START_TIME=$1 + LOG_START_TIME="" + LOG_STOP_TIME="" + if [ "$SHOW_START_TIME" == "false" ]; then + latest_done_wal=$(ls -t ${PGDATA}/pg_wal/archive_status/|grep ".done"|head -n 1) + if [ "${latest_done_wal}" != "" ]; then + LOG_STOP_TIME=$(pg_waldump ${latest_done_wal%.*} --rmgr=Transaction 2>/dev/null |tail -n 1|awk -F ' COMMIT ' '{print $2}'|awk -F ';' '{print $1}') + fi + [[ "${LOG_STOP_TIME}" != "" ]] && printf "{\"stopTime\": \"$(date -d "$LOG_STOP_TIME" -u '+%Y-%m-%dT%H:%M:%SZ')\"}" || printf "{}" + else + LOG_START_TIME=$(pg_waldump $(ls -Ftr $PGDATA/pg_wal/ | grep '[[:xdigit:]]$\|.partial$'|head -n 1) --rmgr=Transaction 2>/dev/null |head -n 1|awk -F ' COMMIT ' '{print $2}'|awk -F ';' '{print $1}') + for i in $(ls -Ft $PGDATA/pg_wal/ | grep '[[:xdigit:]]$\|.partial$'); do LOG_STOP_TIME=$(pg_waldump $i --rmgr=Transaction 2>/dev/null|tail -n 1); [[ "$LOG_STOP_TIME" != "" ]] && break; done + LOG_STOP_TIME=$(echo $LOG_STOP_TIME |awk -F ' COMMIT ' '{print $2}'|awk -F ';' '{print $1}') + if [ "${LOG_START_TIME}" == "" ]; then LOG_START_TIME=${LOG_STOP_TIME}; fi + LOG_START_TIME=$(date -d "$LOG_START_TIME" -u '+%Y-%m-%dT%H:%M:%SZ') + LOG_STOP_TIME=$(date -d "$LOG_STOP_TIME" -u '+%Y-%m-%dT%H:%M:%SZ') + printf "{\"startTime\": \"$LOG_START_TIME\" ,\"stopTime\": \"$LOG_STOP_TIME\"}" + fi + filesize-collector.sh: | + #!/bin/bash + set -e; + function getProperty() { + file=$1; key=$2; + echo $(grep "${key}: " ${file} | awk -F ': ' '{print $2}') + } + filename=$1 + fileinfo=${PGDATA}/${filename} + if [ -f ${fileinfo} ]; then + TOTAL_SIZE=$(getProperty ${fileinfo} "TOTAL SIZE") + rm -f ${fileinfo} + printf "{\"totalSize\":\"${TOTAL_SIZE}\",\"manifests\":{\"backupTool\":{\"uploadTotalSize\":\"${TOTAL_SIZE}\"}}}" + else + printf "{}" + fi + {{- with include "orioledb.extend.scripts" . }} + {{- . | nindent 2 }} + {{- end }} \ No newline at end of file diff --git a/addons/orioledb/templates/patroni-reload.yaml b/addons/orioledb/templates/patroni-reload-script-template.yaml similarity index 85% rename from addons/orioledb/templates/patroni-reload.yaml rename to addons/orioledb/templates/patroni-reload-script-template.yaml index 3a1e0398b..3e2543ae7 100644 --- a/addons/orioledb/templates/patroni-reload.yaml +++ b/addons/orioledb/templates/patroni-reload-script-template.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: orioledb-patroni-reload-script + name: {{ include "orioledb.patroniReloadScriptsTemplate" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} data: diff --git a/addons/orioledb/templates/pgbouncer-configmap.yaml b/addons/orioledb/templates/pgbouncer-configuration-template.yaml similarity index 73% rename from addons/orioledb/templates/pgbouncer-configmap.yaml rename to addons/orioledb/templates/pgbouncer-configuration-template.yaml index de9213a20..a6bbaa8a9 100644 --- a/addons/orioledb/templates/pgbouncer-configmap.yaml +++ b/addons/orioledb/templates/pgbouncer-configuration-template.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: orioledb-pgbouncer-configuration + name: {{ include "orioledb-pgbouncer.configurationTemplate" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} data: diff --git a/addons/orioledb/templates/scripts.yaml b/addons/orioledb/templates/scripts.yaml deleted file mode 100644 index e55a4997e..000000000 --- a/addons/orioledb/templates/scripts.yaml +++ /dev/null @@ -1,270 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: orioledb-scripts - labels: - {{- include "orioledb.labels" . | nindent 4 }} -data: -{{/* init_container.sh: |*/}} -{{/* #!/bin/bash*/}} -{{/* set -o errexit*/}} -{{/* set -e*/}} -{{/* #mkdir -p /home/postgres/pgdata/conf*/}} -{{/* chmod 750 -R /home/postgres/pgdata*/}} -{{/* mkdir -p /var/lib/postgresql/conf*/}} -{{/* cp /home/postgres/conf/postgresql.conf /var/lib/postgresql/conf*/}} -{{/* chmod 777 -R /var/lib/postgresql/conf*/}} -{{/* cp /home/postgres/conf/postgresql.conf /home/postgres/pgdata/conf*/}} - {{/* chmod 777 /home/postgres/pgdata/conf/postgresql.conf*/}} - generate_patroni_yaml.py: | - #!/usr/bin/env python3 - # -*- coding: utf-8 -*- - import os - import sys - import yaml - def write_file(config, filename, overwrite): - if not overwrite and os.path.exists(filename): - pass - else: - with open(filename, 'w') as f: - f.write(config) - def read_file_lines(file): - ret = [] - for line in file.readlines(): - line = line.strip() - if line and not line.startswith('#'): - ret.append(line) - return ret - def postgresql_conf_to_dict(file_path): - with open(file_path, 'r') as f: - content = f.read() - lines = content.splitlines() - result = {} - for line in lines: - if line.startswith('#'): - continue - if '=' not in line: - continue - key, value = line.split('=', 1) - result[key.strip()] = value.strip().strip("'") - return result - def main(filename): - restore_dir = os.environ.get('RESTORE_DATA_DIR', '') - local_config = yaml.safe_load( - os.environ.get('SPILO_CONFIGURATION', os.environ.get('PATRONI_CONFIGURATION', ''))) or {} - podip = os.environ.get('POD_IP') - # scope - local_config['scope'] = os.environ.get('SCOPE') - # name - local_config['name'] = os.environ.get('KB_POD_NAME') - # etcd3 - local_config['etcd3'] = { - 'host':os.environ.get('PATRONI_ETCD3_HOST') - } - # restapi - local_config['restapi'] = { - 'listen': f'{podip}:8008', - 'connect_address': f'{podip}:8008', - } - # postgresql - if not 'postgresql' in local_config: - local_config['postgresql'] = {} - postgresql = local_config['postgresql'] - postgresql['data_dir'] = os.environ.get('PGDATA') - postgresql['config_dir'] = '/home/postgres/pgdata/conf' - postgresql['custom_conf'] = '/home/postgres/conf/postgresql.conf' - postgresql['authentication'] = {} - postgresql['listen'] = '0.0.0.0:5432' - postgresql['connect_address'] = f'{podip}:5432' - authentication = postgresql['authentication'] - authentication['superuser'] = {"username": os.environ.get('PGUSER_SUPERUSER'), - 'password': os.environ.get('PGPASSWORD_SUPERUSER')} - authentication['replication'] = {'username':os.environ.get('PGUSER_SUPERUSER'), - 'password':os.environ.get('POSTGRES_PASSWORD')} - - # add pg_hba.conf - with open('/home/postgres/conf/pg_hba.conf', 'r') as f: - lines = read_file_lines(f) - if lines: - postgresql['pg_hba'] = lines - - if restore_dir and os.path.isfile(os.path.join(restore_dir, 'kb_restore.signal')): - if not 'bootstrap' in local_config: - local_config['bootstrap'] = {} - with open('/home/postgres/conf/kb_restore.conf', 'r') as f: - local_config['bootstrap'].update(yaml.safe_load(f)) - - local_config['bootstrap'] = {} - bootstrap = local_config['bootstrap'] - bootstrap['dcs'] = { - 'postgresql':{ - 'parameters':{'listen_addresses':"0.0.0.0","port":5432} - } - } - # point in time recovery(PITR) - data_dir = os.environ.get('PGDATA', '') - if os.path.isfile("/home/postgres/pgdata/conf/recovery.conf"): - with open('/home/postgres/conf/kb_pitr.conf', 'r') as f: - pitr_config = yaml.safe_load(f) - re_config = postgresql_conf_to_dict("/home/postgres/pgdata/conf/recovery.conf") - pitr_config[pitr_config['method']]['recovery_conf'].update(re_config) - local_config['bootstrap'].update(pitr_config) - # bootstrap -{{/* if 'bootstrap' not in local_config.keys():*/}} -{{/* local_config['bootstrap'] = {*/}} -{{/* }*/}} - write_file(yaml.dump(local_config, default_flow_style=False), filename, True) - if __name__ == '__main__': - main(sys.argv[1]) - init.sql: | - CREATE EXTENSION pg_stat_statements; - setup.sh: | - if [ -d "/home/postgres/pgdata/conf" ]; then - chmod 750 /home/postgres/pgdata/pgroot/data - else - mkdir -p /home/postgres/pgdata/conf - chmod 777 -R /home/postgres/pgdata - cp /home/postgres/conf/postgresql.conf /home/postgres/pgdata/conf - chmod 777 -R /home/postgres/pgdata/conf - fi - source /dependency/conf - -{{/* chmod 750 -R /home/postgres/pgdata*/}} -{{/* mkdir -p /var/lib/postgresql/conf*/}} - #cp /home/postgres/conf/postgresql.conf /var/lib/postgresql/conf - #chmod 777 -R /var/lib/postgresql/conf - #su - postgres -c "" - IFS='-' read -ra parts <<< "$KB_POD_NAME" - if [ ${parts[-1]} != '0' ]; then - MAX_RETRIES=30 - WAIT_INTERVAL=5 - retries=0 - while [ $retries -lt $MAX_RETRIES ]; do - pg_isready -h $KB_ORIOLEDB_0_HOSTNAME - if [ $? -eq 0 ]; then - echo "PostgreSQL is ready!" - break - else - echo "PostgreSQL is not ready yet. Retrying in $WAIT_INTERVAL seconds..." - sleep $WAIT_INTERVAL - retries=$((retries + 1)) - fi - done - else - cp /kb-scripts/init.sql /docker-entrypoint-initdb.d - bash /usr/local/bin/docker-entrypoint.sh postgres - fi - #sleep 10000 - python3 /kb-scripts/generate_patroni_yaml.py /var/lib/postgresql/tmp_patroni.yaml -{{/* python3 /kb-scripts/generate_patroni_yaml.py /var/lib/postgresql/user2.yaml*/}} -{{/* #python3 /kb-scripts/generate_patroni_yaml.py /var/lib/postgresql/user2.yaml*/}} - chmod 777 /var/lib/postgresql/tmp_patroni.yaml - #sleep 10000 - su - postgres -c "patroni /var/lib/postgresql/tmp_patroni.yaml" - - -{{/* target_data_dir=/home/postgres/pgdata*/}} -{{/* ln -s $target_data_dir $PGDATA*/}} -{{/* su - postgres*/}} -{{/* postgres --config-file /var/lib/postgresql/data/pgdata/conf*/}} -{{/* sudo systemctl stop postgresql*/}} -{{/* #!/bin/bash*/}} -{{/* set -o errexit*/}} -{{/* set -ex*/}} - -{{/* # Waiting for primary pod information from the DownwardAPI annotation to be available, with a maximum of 5 attempts*/}} -{{/* attempt=1*/}} -{{/* max_attempts=5*/}} -{{/* while [ $attempt -le $max_attempts ] && [ -z "$(cat /kb-podinfo/primary-pod)" ]; do*/}} -{{/* sleep 5*/}} -{{/* attempt=$((attempt + 1))*/}} -{{/* done*/}} - -{{/* primary=$(cat /kb-podinfo/primary-pod)*/}} -{{/* echo "DownwardAPI get primary=$primary" >> /home/postgres/pgdata/.kb_set_up.log*/}} -{{/* echo "KB_POD_NAME=$KB_POD_NAME" >> /home/postgres/pgdata/.kb_set_up.log*/}} -{{/* if [ -z "$primary" ]; then*/}} -{{/* echo "Primary pod information not available. Exiting..."*/}} -{{/* exit 1*/}} -{{/* fi*/}} - -{{/* # usage: retry */}} -{{/* # e.g. retry pg_isready -U postgres -h $primary_fqdn -p 5432*/}} -{{/* function retry {*/}} -{{/* local max_attempts=10*/}} -{{/* local attempt=1*/}} -{{/* until "$@" || [ $attempt -eq $max_attempts ]; do*/}} -{{/* echo "Command '$*' failed. Attempt $attempt of $max_attempts. Retrying in 5 seconds..."*/}} -{{/* attempt=$((attempt + 1))*/}} -{{/* sleep 5*/}} -{{/* done*/}} -{{/* if [ $attempt -eq $max_attempts ]; then*/}} -{{/* echo "Command '$*' failed after $max_attempts attempts. Exiting..."*/}} -{{/* exit 1*/}} -{{/* fi*/}} -{{/* }*/}} -{{/* if [ "$primary" != "$KB_POD_NAME" ]; then*/}} -{{/* primary_fqdn="$primary.$KB_CLUSTER_NAME-$KB_COMP_NAME-headless.$KB_NAMESPACE.svc"*/}} -{{/* echo "primary_fqdn=$primary_fqdn" >> /home/postgres/pgdata/.kb_set_up.log*/}} -{{/* # waiting for the primary to be ready, if the wait time exceeds the maximum number of retries, then the script will fail and exit.*/}} -{{/* retry pg_isready -U {{ default "postgres" | quote }} -h $primary_fqdn -p 5432*/}} -{{/* fi*/}} - -{{/* if [ -f ${RESTORE_DATA_DIR}/kb_restore.signal ]; then*/}} -{{/* chown -R postgres ${RESTORE_DATA_DIR}*/}} -{{/* fi*/}} -{{/* python3 /kb-scripts/generate_patroni_yaml.py tmp_patroni.yaml*/}} -{{/* export SPILO_CONFIGURATION=$(cat tmp_patroni.yaml)*/}} - {{/* exec /launch.sh init*/}} - pgbouncer_setup.sh: | - #!/bin/bash - set -o errexit - set -ex - mkdir -p /opt/bitnami/pgbouncer/conf/ /opt/bitnami/pgbouncer/logs/ /opt/bitnami/pgbouncer/tmp/ - cp /home/pgbouncer/conf/pgbouncer.ini /opt/bitnami/pgbouncer/conf/ - echo "\"$POSTGRESQL_USERNAME\" \"$POSTGRESQL_PASSWORD\"" > /opt/bitnami/pgbouncer/conf/userlist.txt - echo -e "\\n[databases]" >> /opt/bitnami/pgbouncer/conf/pgbouncer.ini - echo "postgres=host=$KB_POD_IP port=5432 dbname=postgres" >> /opt/bitnami/pgbouncer/conf/pgbouncer.ini - chmod 777 /opt/bitnami/pgbouncer/conf/pgbouncer.ini - chmod 777 /opt/bitnami/pgbouncer/conf/userlist.txt - useradd pgbouncer - chown -R pgbouncer:pgbouncer /opt/bitnami/pgbouncer/conf/ /opt/bitnami/pgbouncer/logs/ /opt/bitnami/pgbouncer/tmp/ - /opt/bitnami/scripts/pgbouncer/run.sh - backup-log-collector.sh: | - #!/bin/bash - set -o errexit - set -o nounset - SHOW_START_TIME=$1 - LOG_START_TIME="" - LOG_STOP_TIME="" - if [ "$SHOW_START_TIME" == "false" ]; then - latest_done_wal=$(ls -t ${PGDATA}/pg_wal/archive_status/|grep ".done"|head -n 1) - if [ "${latest_done_wal}" != "" ]; then - LOG_STOP_TIME=$(pg_waldump ${latest_done_wal%.*} --rmgr=Transaction 2>/dev/null |tail -n 1|awk -F ' COMMIT ' '{print $2}'|awk -F ';' '{print $1}') - fi - [[ "${LOG_STOP_TIME}" != "" ]] && printf "{\"stopTime\": \"$(date -d "$LOG_STOP_TIME" -u '+%Y-%m-%dT%H:%M:%SZ')\"}" || printf "{}" - else - LOG_START_TIME=$(pg_waldump $(ls -Ftr $PGDATA/pg_wal/ | grep '[[:xdigit:]]$\|.partial$'|head -n 1) --rmgr=Transaction 2>/dev/null |head -n 1|awk -F ' COMMIT ' '{print $2}'|awk -F ';' '{print $1}') - for i in $(ls -Ft $PGDATA/pg_wal/ | grep '[[:xdigit:]]$\|.partial$'); do LOG_STOP_TIME=$(pg_waldump $i --rmgr=Transaction 2>/dev/null|tail -n 1); [[ "$LOG_STOP_TIME" != "" ]] && break; done - LOG_STOP_TIME=$(echo $LOG_STOP_TIME |awk -F ' COMMIT ' '{print $2}'|awk -F ';' '{print $1}') - if [ "${LOG_START_TIME}" == "" ]; then LOG_START_TIME=${LOG_STOP_TIME}; fi - LOG_START_TIME=$(date -d "$LOG_START_TIME" -u '+%Y-%m-%dT%H:%M:%SZ') - LOG_STOP_TIME=$(date -d "$LOG_STOP_TIME" -u '+%Y-%m-%dT%H:%M:%SZ') - printf "{\"startTime\": \"$LOG_START_TIME\" ,\"stopTime\": \"$LOG_STOP_TIME\"}" - fi - filesize-collector.sh: | - #!/bin/bash - set -e; - function getProperty() { - file=$1; key=$2; - echo $(grep "${key}: " ${file} | awk -F ': ' '{print $2}') - } - filename=$1 - fileinfo=${PGDATA}/${filename} - if [ -f ${fileinfo} ]; then - TOTAL_SIZE=$(getProperty ${fileinfo} "TOTAL SIZE") - rm -f ${fileinfo} - printf "{\"totalSize\":\"${TOTAL_SIZE}\",\"manifests\":{\"backupTool\":{\"uploadTotalSize\":\"${TOTAL_SIZE}\"}}}" - else - printf "{}" - fi diff --git a/addons/orioledb/values.yaml b/addons/orioledb/values.yaml index b2e4b74dc..8c8ce1e42 100644 --- a/addons/orioledb/values.yaml +++ b/addons/orioledb/values.yaml @@ -6,41 +6,12 @@ image: repository: apecloud/orioledb tag: beta1 pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. -## -auth: - ## @param auth.postgresPassword Password for the "postgres" admin user, leave empty - ## for random generated password. - ## - postgresPassword: - ## @param auth.database Name for a custom database to create - ## - database: "custom_db" -## Audit settings -## @param audit.logHostname Log client hostnames -## @param audit.logConnections Add client log-in operations to the log file -## @param audit.logDisconnections Add client log-outs operations to the log file -## @param audit.pgAuditLog Add operations to log using the pgAudit extension -## @param audit.pgAuditLogCatalog Log catalog using pgAudit -## @param audit.clientMinMessages Message log level to share with the user -## @param audit.logLinePrefix Template for log line prefix (default if not set) -## @param audit.logTimezone Timezone for the log timestamps -## -audit: - logHostname: false - logConnections: false - logDisconnections: false - pgAuditLog: "" - pgAuditLogCatalog: "off" - clientMinMessages: error - logLinePrefix: "" - logTimezone: "" + # refer: https://github.com/apecloud/dbctl/blob/main/docker/Dockerfile + dbctl: + repository: apecloud/dbctl + tag: "0.1.5" -## Set PostgreSQL preload extension shared libraries. -## @param postgresqlSharedPreloadLibraries Shared preload libraries (comma-separated list) -## -postgresqlSharedPreloadLibraries: "pg_stat_statements, auto_explain" ## Start PostgreSQL pod(s) without limitations on shm memory. ## By default, docker and containerd (and possibly other container runtimes) limit `/dev/shm` to `64M` ## @@ -55,14 +26,6 @@ shmVolume: ## sizeLimit: "" -## @section PostgreSQL Primary parameters -## -primary: - ## @param primary.name Name of the primary database (eg primary, master, leader, ...) - ## - name: primary - ## configEnabled: true - ## @section Metrics Parameters metrics: ## @param metrics.image.registry PostgreSQL Prometheus Exporter image registry @@ -92,6 +55,4 @@ pgbouncer: pullPolicy: IfNotPresent logConfigs: - running: /home/postgres/pgdata/pgroot/data/log/postgresql-* -# /var/lib/postgresql/data/postgresql.auto.conf -# /var/lib/postgresql/data/postgresql.conf \ No newline at end of file + running: /home/postgres/pgdata/pgroot/data/log/postgresql-* \ No newline at end of file From 926e5eabe7ba4562c7a9f3fd9e500011f7a73ef8 Mon Sep 17 00:00:00 2001 From: Y-Rookie Date: Tue, 10 Dec 2024 16:40:21 +0800 Subject: [PATCH 2/5] upgrade orielodb addon to v1.0 API --- addons-cluster/orioledb/Chart.yaml | 7 +- .../orioledb/templates/_helpers.tpl | 55 ++++++++++++- .../orioledb/templates/cluster.yaml | 22 +++--- .../etcd-service-descriptor-example.yaml | 12 +++ addons-cluster/orioledb/templates/rbac.yaml | 1 - addons-cluster/orioledb/values.schema.json | 18 +---- addons-cluster/orioledb/values.yaml | 30 ++++--- addons/orioledb/Chart.yaml | 6 +- addons/orioledb/config/patroni-parameter.yaml | 4 + addons/orioledb/config/patroni-reload.tpl | 27 +++++++ addons/orioledb/config/patroni-yaml.tpl | 6 ++ addons/orioledb/config/restart-parameter.yaml | 78 +++++++++++++++++++ addons/orioledb/scripts/patroni-reload.tpl | 19 ----- addons/orioledb/templates/_helpers.tpl | 7 ++ .../orioledb/templates/clusterdefinition.yaml | 15 ++++ addons/orioledb/templates/cmpd.yaml | 2 +- .../orioledb/templates/configconstraint.yaml | 2 + .../orioledb-configuration-template.yaml | 2 + .../templates/orioledb-scripts-template.yaml | 9 +++ .../patroni-reload-script-template.yaml | 8 +- .../pgbouncer-configuration-template.yaml | 2 + 21 files changed, 259 insertions(+), 73 deletions(-) create mode 100644 addons-cluster/orioledb/templates/etcd-service-descriptor-example.yaml delete mode 100644 addons-cluster/orioledb/templates/rbac.yaml create mode 100644 addons/orioledb/config/patroni-parameter.yaml create mode 100644 addons/orioledb/config/patroni-reload.tpl create mode 100644 addons/orioledb/config/patroni-yaml.tpl create mode 100644 addons/orioledb/config/restart-parameter.yaml delete mode 100644 addons/orioledb/scripts/patroni-reload.tpl create mode 100644 addons/orioledb/templates/clusterdefinition.yaml diff --git a/addons-cluster/orioledb/Chart.yaml b/addons-cluster/orioledb/Chart.yaml index 3a6440846..ea7cbf7b7 100644 --- a/addons-cluster/orioledb/Chart.yaml +++ b/addons-cluster/orioledb/Chart.yaml @@ -23,8 +23,5 @@ type: application # Versions are expected to follow Semantic Versioning (https://semver.org/) version: 1.0.0-alpha.0 -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "14.7.2-beta1" + +appVersion: "14.7.2" diff --git a/addons-cluster/orioledb/templates/_helpers.tpl b/addons-cluster/orioledb/templates/_helpers.tpl index 03ef14453..4abc71de0 100644 --- a/addons-cluster/orioledb/templates/_helpers.tpl +++ b/addons-cluster/orioledb/templates/_helpers.tpl @@ -9,4 +9,57 @@ replicas: 1 {{- else if eq .Values.mode "replication" }} replicas: {{ max .Values.replicas 2 }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} + +{{/* +Define postgresql ComponentSpec with ComponentDefinition. +*/}} +{{- define "orioledb-cluster.componentSpec" }} + clusterDef: orioledb + topology: replication + componentSpecs: + - name: {{ include "orioledb-cluster.component-name" . }} + serviceVersion: {{ .Values.version }} + labels: + {{- include "orioledb-cluster.patroni-scope-label" . | indent 8 }} + {{- include "kblib.componentMonitor" . | indent 6 }} + {{- include "orioledb-cluster.replicaCount" . | indent 6 }} + {{- include "kblib.componentResources" . | indent 6 }} + {{- include "kblib.componentStorages" . | indent 6 }} + {{- if .Values.etcd.enabled }} + serviceRefs: + {{ include "orioledb-cluster.serviceRef" . | indent 6 }} + {{- end }} +{{- end }} + +{{- define "orioledb-cluster.serviceRef" }} +- name: etcd + namespace: {{ .Release.Namespace }} + {{- if eq .Values.etcd.meta.mode "incluster" }} + clusterServiceSelector: + cluster: {{ .Values.etcd.meta.serviceRef.cluster.name }} + service: + component: {{ .Values.etcd.meta.serviceRef.cluster.component }} + service: {{ .Values.etcd.meta.serviceRef.cluster.service }} + port: {{ .Values.etcd.meta.serviceRef.cluster.port }} + credential: + component: {{ .Values.etcd.meta.serviceRef.cluster.component }} + name: {{ .Values.etcd.meta.serviceRef.cluster.credential }} + {{- else }} + serviceDescriptor: {{ .Values.etcd.meta.serviceRef.serviceDescriptor }} + {{- end }} +{{- end -}} + +{{/* +Define orioledb componentName +*/}} +{{- define "orioledb-cluster.component-name" -}} +orioledb +{{- end }} + +{{/* +Define patroni scope label which postgresql cluster depends on, the named pattern is `apps.kubeblocks.postgres.patroni/scope: -` +*/}} +{{- define "orioledb-cluster.patroni-scope-label" }} +apps.kubeblocks.postgres.patroni/scope: {{ include "kblib.clusterName" . }}-{{ include "orioledb-cluster.component-name" . }} +{{- end -}} diff --git a/addons-cluster/orioledb/templates/cluster.yaml b/addons-cluster/orioledb/templates/cluster.yaml index f1d0bc327..c8c327084 100644 --- a/addons-cluster/orioledb/templates/cluster.yaml +++ b/addons-cluster/orioledb/templates/cluster.yaml @@ -1,13 +1,9 @@ -{{- include "kblib.clusterCommon" . }} - componentSpecs: - - name: orioledb - componentDef: orioledb - serviceRefs: - - name: etcdService - cluster: {{ .Values.etcd.cluster | default "etcd" }} - namespace: {{ .Values.etcd.namespace | default "default" }} - {{- include "kblib.componentMonitor" . | indent 6 }} - {{- include "orioledb-cluster.replicaCount" . | indent 6 }} - serviceAccountName: {{ include "kblib.serviceAccountName" . }} - {{- include "kblib.componentResources" . | indent 6 }} - {{- include "kblib.componentStorages" . | indent 6 }} \ No newline at end of file +apiVersion: apps.kubeblocks.io/v1 +kind: Cluster +metadata: + name: {{ include "kblib.clusterName" . }} + namespace: {{ .Release.Namespace }} + labels: {{ include "kblib.clusterLabels" . | nindent 4 }} +spec: + terminationPolicy: {{ .Values.terminationPolicy }} + {{- include "orioledb-cluster.componentSpec" . }} \ No newline at end of file diff --git a/addons-cluster/orioledb/templates/etcd-service-descriptor-example.yaml b/addons-cluster/orioledb/templates/etcd-service-descriptor-example.yaml new file mode 100644 index 000000000..4d3502935 --- /dev/null +++ b/addons-cluster/orioledb/templates/etcd-service-descriptor-example.yaml @@ -0,0 +1,12 @@ +{{- if and .Values.etcd.enabled (eq .Values.etcd.meta.mode "serviceref") }} +apiVersion: apps.kubeblocks.io/v1 +kind: ServiceDescriptor +metadata: + name: orioledb-etcd-descriptor + namespace: {{ .Release.Namespace }} +spec: + serviceKind: etcd + serviceVersion: 3.5.6 + endpoint: + value: "etcd-cluster-etcd.default.svc.cluster.local:2379" # etcd service endpoint +{{- end }} diff --git a/addons-cluster/orioledb/templates/rbac.yaml b/addons-cluster/orioledb/templates/rbac.yaml deleted file mode 100644 index 08875e8bf..000000000 --- a/addons-cluster/orioledb/templates/rbac.yaml +++ /dev/null @@ -1 +0,0 @@ -{{- include "kblib.rbac" . }} \ No newline at end of file diff --git a/addons-cluster/orioledb/values.schema.json b/addons-cluster/orioledb/values.schema.json index 44096d3dc..e4d4086a7 100644 --- a/addons-cluster/orioledb/values.schema.json +++ b/addons-cluster/orioledb/values.schema.json @@ -4,7 +4,7 @@ "properties": { "version": { "type": "string", - "default": "orioledb-beta1" + "default": "14.7.2" }, "mode": { "type": "string", @@ -58,22 +58,6 @@ "title": "Storage Class Name", "description": "Storage class name of the data volume", "type": "string" - }, - "etcd": { - "type": "object", - "title": "The patroni dependency etcd Schema", - "properties": { - "cluster": { - "type": "string", - "default": "etcd", - "description": "The patroni dependency etcd cluster name" - }, - "namespace": { - "type": "string", - "default": "default", - "description": "The patroni dependency etcd cluster namespace" - } - } } } } diff --git a/addons-cluster/orioledb/values.yaml b/addons-cluster/orioledb/values.yaml index ff38d3035..60dea8ebe 100644 --- a/addons-cluster/orioledb/values.yaml +++ b/addons-cluster/orioledb/values.yaml @@ -1,14 +1,18 @@ -# Default values for OrioleDB (with Patroni HA). +# Default values for Orioledb (with Patroni HA). # This is a YAML-formatted file. # Declare variables to be passed into your templates. -## @param version OrioleDB cluster version +## @param terminationPolicy define Cluster termination policy. One of DoNotTerminate, Halt, Delete, WipeOut. ## -version: orioledb-beta1 +terminationPolicy: Delete -## @param mode OrioleDB cluster topology mode, standalone, replication +## @param version, mapping cluster.spec.componentSpec[].serviceVersion which defined in ComponentVersion ## -mode: standalone +version: 14.7.2 + +## @param mode postgresql cluster topology mode, standalone, replication +## +mode: replication ## @param replicas specify cluster replicas ## @@ -33,8 +37,16 @@ requests: ## storage: 20 -## @param patroni etcd cluster name, if not set will use the cluster name "etcd" -## and the cluster must exist, etcd: - cluster: "etcd" - namespace: "default" \ No newline at end of file + enabled: false + meta: + mode: serviceref # optional: incluster, serviceref + serviceRef: + namespace: + cluster: + name: + component: + service: + port: + credential: + serviceDescriptor: orioledb-etcd-descriptor # example: orioledb-etcd-descriptor \ No newline at end of file diff --git a/addons/orioledb/Chart.yaml b/addons/orioledb/Chart.yaml index 793c8a165..27518b994 100644 --- a/addons/orioledb/Chart.yaml +++ b/addons/orioledb/Chart.yaml @@ -9,11 +9,7 @@ type: application # Versions are expected to follow Semantic Versioning (https://semver.org/) version: 1.0.0-alpha.0 -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "14.7.2-beta1" +appVersion: "14.7.2" maintainers: - name: 1aal diff --git a/addons/orioledb/config/patroni-parameter.yaml b/addons/orioledb/config/patroni-parameter.yaml new file mode 100644 index 000000000..fcc76da7e --- /dev/null +++ b/addons/orioledb/config/patroni-parameter.yaml @@ -0,0 +1,4 @@ +- ttl +- loop_wait +- retry_timeouts +- maximum_lag_on_failover \ No newline at end of file diff --git a/addons/orioledb/config/patroni-reload.tpl b/addons/orioledb/config/patroni-reload.tpl new file mode 100644 index 000000000..aa81c3b2f --- /dev/null +++ b/addons/orioledb/config/patroni-reload.tpl @@ -0,0 +1,27 @@ +{{- $restartParams := $.Files.Get "bootstrap.yaml" | fromYamlArray }} +{{- $patroniParamsContent := $.Files.Get "patroni_parameter.yaml" }} +{{- $patroniParams := fromYamlArray (default "" $patroniParamsContent) }} +{{- $command := "reload" }} +{{- $postgresql := dict }} +{{- $patroni := dict }} +{{- range $pk, $val := $.arg0 }} + {{- if has $pk $patroniParams }} + {{- set $patroni $pk ($val | trimAll "'") }} + {{- else }} + {{- /* trim single quotes for value in the pg config file */}} + {{- set $postgresql $pk ($val | trimAll "'") }} + {{- end }} + {{- if has $pk $restartParams }} + {{- $command = "restart" }} + {{- end }} +{{- end }} + +{{- $params := merge $patroni (dict "postgresql" (dict "parameters" $postgresql)) }} +{{- $err := execSql (toJson $params) "config" }} +{{- if $err }} + {{- failed $err }} +{{- end }} +{{- $err := execSql "" $command }} +{{- if $err }} + {{- failed $err }} +{{- end }} diff --git a/addons/orioledb/config/patroni-yaml.tpl b/addons/orioledb/config/patroni-yaml.tpl new file mode 100644 index 000000000..6f57f20c5 --- /dev/null +++ b/addons/orioledb/config/patroni-yaml.tpl @@ -0,0 +1,6 @@ +ttl: 30 +loop_wait: 10 +retry_timeout: 10 +maximum_lag_on_failover: 1048576 +max_timelines_history: 0 +check_timeline: true \ No newline at end of file diff --git a/addons/orioledb/config/restart-parameter.yaml b/addons/orioledb/config/restart-parameter.yaml new file mode 100644 index 000000000..f73fb4e94 --- /dev/null +++ b/addons/orioledb/config/restart-parameter.yaml @@ -0,0 +1,78 @@ +#parameters: +- archive_mode +- autovacuum_freeze_max_age +- autovacuum_max_workers +- autovacuum_multixact_freeze_max_age +- bg_mon.history_buckets +- bonjour +- bonjour_name +- cluster_name +- config_file +- cron.database_name +- cron.enable_superuser_jobs +- cron.host +- cron.log_run +- cron.log_statement +- cron.max_running_jobs +- cron.timezone +- cron.use_background_workers +- data_directory +- data_sync_retry +- dynamic_shared_memory_type +- event_source +- external_pid_file +- hba_file +- hot_standby +- huge_pages +- huge_page_size +- ident_file +- ignore_invalid_pages +- jit_provider +- listen_addresses +- logging_collector +- max_connections +- max_files_per_process +- max_locks_per_transaction +- max_logical_replication_workers +- max_pred_locks_per_transaction +- max_prepared_transactions +- max_replication_slots +- max_wal_senders +- max_worker_processes +- min_dynamic_shared_memory +- old_snapshot_threshold +- pglogical.batch_inserts +- pglogical.synchronous_commit +- pglogical.use_spi +- pg_prewarm.autoprewarm +- pg_stat_statements.max +- port +- postgis.gdal_enabled_drivers +- recovery_init_sync_method +- recovery_target +- recovery_target_action +- recovery_target_inclusive +- recovery_target_lsn +- recovery_target_name +- recovery_target_time +- recovery_target_timeline +- recovery_target_xid +- session_preload_libraries +- shared_buffers +- shared_memory_type +- shared_preload_libraries +- superuser_reserved_connections +- timescaledb.bgw_launcher_poll_time +- timescaledb.max_background_workers +- track_activity_query_size +- track_commit_timestamp +- unix_socket_directories +- unix_socket_group +- unix_socket_permissions +- wal_buffers +- wal_compression +- wal_decode_buffer_size +- wal_level +- wal_log_hints +- wal_keep_segments +- wal_keep_size \ No newline at end of file diff --git a/addons/orioledb/scripts/patroni-reload.tpl b/addons/orioledb/scripts/patroni-reload.tpl deleted file mode 100644 index 0e0380f69..000000000 --- a/addons/orioledb/scripts/patroni-reload.tpl +++ /dev/null @@ -1,19 +0,0 @@ -{{- $bootstrap := $.Files.Get "bootstrap.yaml" | fromYamlArray }} -{{- $command := "reload" }} -{{- $trimParams := dict }} -{{- range $pk, $val := $.arg0 }} - {{- /* trim single quotes for value in the pg config file */}} - {{- set $trimParams $pk ( $val | trimAll "'" ) }} - {{- if has $pk $bootstrap }} - {{- $command = "restart" }} - {{- end }} -{{- end }} -{{ $params := dict "parameters" $trimParams }} -{{- $err := execSql ( dict "postgresql" $params | toJson ) "config" }} -{{- if $err }} - {{- failed $err }} -{{- end }} -{{- $err := execSql "" $command }} -{{- if $err }} - {{- failed $err }} -{{- end }} diff --git a/addons/orioledb/templates/_helpers.tpl b/addons/orioledb/templates/_helpers.tpl index 436c5e3d3..bb529d73e 100644 --- a/addons/orioledb/templates/_helpers.tpl +++ b/addons/orioledb/templates/_helpers.tpl @@ -65,6 +65,13 @@ API version annotation kubeblocks.io/crd-api-version: apps.kubeblocks.io/v1 {{- end }} +{{/* +Define orioledb cluster definition name +*/}} +{{- define "orioledb.cdName" -}} +orioledb +{{- end -}} + {{/* Define orioledb component definition name */}} diff --git a/addons/orioledb/templates/clusterdefinition.yaml b/addons/orioledb/templates/clusterdefinition.yaml new file mode 100644 index 000000000..8a62cc2ed --- /dev/null +++ b/addons/orioledb/templates/clusterdefinition.yaml @@ -0,0 +1,15 @@ +apiVersion: apps.kubeblocks.io/v1 +kind: ClusterDefinition +metadata: + name: {{ include "orioledb.cdName" . }} + labels: + {{- include "orioledb.labels" . | nindent 4 }} + annotations: + {{- include "orioledb.apiVersion" . | nindent 4 }} +spec: + topologies: + - name: replication + components: + - name: orioledb + compDef: {{ include "orioledb.cmpdRegexPattern" . }} + default: true \ No newline at end of file diff --git a/addons/orioledb/templates/cmpd.yaml b/addons/orioledb/templates/cmpd.yaml index 09b4fbaae..8700bbe3c 100644 --- a/addons/orioledb/templates/cmpd.yaml +++ b/addons/orioledb/templates/cmpd.yaml @@ -1,7 +1,7 @@ apiVersion: apps.kubeblocks.io/v1 kind: ComponentDefinition metadata: - name: {{ include "orioledb.cmpdName" }} + name: {{ include "orioledb.cmpdName" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} annotations: diff --git a/addons/orioledb/templates/configconstraint.yaml b/addons/orioledb/templates/configconstraint.yaml index b9725ea03..56ed4ec58 100644 --- a/addons/orioledb/templates/configconstraint.yaml +++ b/addons/orioledb/templates/configconstraint.yaml @@ -5,6 +5,8 @@ metadata: name: {{ include "orioledb.configConstraint" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} + annotations: + {{- include "orioledb.annotations" . | nindent 4 }} spec: reloadAction: tplScriptTrigger: diff --git a/addons/orioledb/templates/orioledb-configuration-template.yaml b/addons/orioledb/templates/orioledb-configuration-template.yaml index 98331ac05..e9caf3924 100644 --- a/addons/orioledb/templates/orioledb-configuration-template.yaml +++ b/addons/orioledb/templates/orioledb-configuration-template.yaml @@ -4,6 +4,8 @@ metadata: name: {{ include "orioledb.configurationTemplate" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} + annotations: + {{- include "orioledb.annotations" . | nindent 4 }} data: postgresql.conf: |- {{- .Files.Get "config/orioledb-config.tpl" | nindent 4 }} diff --git a/addons/orioledb/templates/orioledb-scripts-template.yaml b/addons/orioledb/templates/orioledb-scripts-template.yaml index 1777fb79d..d52a8c78e 100644 --- a/addons/orioledb/templates/orioledb-scripts-template.yaml +++ b/addons/orioledb/templates/orioledb-scripts-template.yaml @@ -4,7 +4,16 @@ metadata: name: {{ include "orioledb.scriptsTemplate" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} + annotations: + {{- include "orioledb.annotations" . | nindent 4 }} data: + common.sh: |- + #!/bin/bash + {{- include "kblib.compvars.get_target_pod_fqdn_from_pod_fqdn_vars" $ | nindent 4 }} + {{- include "kblib.strings.is_empty" $ | nindent 4 }} + {{- include "kblib.strings.split" $ | nindent 4 }} + {{- include "kblib.logs.format_log_content" $ | nindent 4 }} + {{- include "kblib.logs.setup_logging" $ | nindent 4 }} init.sql: | CREATE EXTENSION pg_stat_statements; backup-log-collector.sh: | diff --git a/addons/orioledb/templates/patroni-reload-script-template.yaml b/addons/orioledb/templates/patroni-reload-script-template.yaml index 3e2543ae7..b9540754d 100644 --- a/addons/orioledb/templates/patroni-reload-script-template.yaml +++ b/addons/orioledb/templates/patroni-reload-script-template.yaml @@ -4,11 +4,15 @@ metadata: name: {{ include "orioledb.patroniReloadScriptsTemplate" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} + annotations: + {{- include "orioledb.annotations" . | nindent 4 }} data: patroni_reload.tpl: |- - {{- .Files.Get "scripts/patroni-reload.tpl" | nindent 4 }} + {{- .Files.Get "config/patroni-reload.tpl" | nindent 4 }} bootstrap.yaml: |- - {{- .Files.Get "scripts/restart-parameter.yaml" | nindent 4 }} + {{- .Files.Get "config/restart-parameter.yaml" | nindent 4 }} + patroni_parameter.yaml: |- + {{- .Files.Get "config/patroni-parameter.yaml" | nindent 4 }} reload.yaml: |- scripts: patroni_reload.tpl dataType: patroni diff --git a/addons/orioledb/templates/pgbouncer-configuration-template.yaml b/addons/orioledb/templates/pgbouncer-configuration-template.yaml index a6bbaa8a9..f3bcdbf77 100644 --- a/addons/orioledb/templates/pgbouncer-configuration-template.yaml +++ b/addons/orioledb/templates/pgbouncer-configuration-template.yaml @@ -4,6 +4,8 @@ metadata: name: {{ include "orioledb-pgbouncer.configurationTemplate" . }} labels: {{- include "orioledb.labels" . | nindent 4 }} + annotations: + {{- include "orioledb.annotations" . | nindent 4 }} data: pgbouncer.ini: |- {{- .Files.Get "config/pgbouncer-ini.tpl" | nindent 4 }} \ No newline at end of file From 03a8c5e43654d68a2e560fdc637c35bb0b2faea5 Mon Sep 17 00:00:00 2001 From: Y-Rookie Date: Tue, 10 Dec 2024 17:31:39 +0800 Subject: [PATCH 3/5] upgrade orielodb addon to v1.0 API --- .../orioledb/scripts/generate_patroni_yaml.py | 44 +++---------------- addons/orioledb/templates/cmpd.yaml | 8 ++++ .../orioledb-configuration-template.yaml | 4 +- 3 files changed, 17 insertions(+), 39 deletions(-) diff --git a/addons/orioledb/scripts/generate_patroni_yaml.py b/addons/orioledb/scripts/generate_patroni_yaml.py index 5e308eb41..0ce13fbcf 100755 --- a/addons/orioledb/scripts/generate_patroni_yaml.py +++ b/addons/orioledb/scripts/generate_patroni_yaml.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- - import os import sys import yaml @@ -41,56 +40,28 @@ def postgresql_conf_to_dict(file_path): def main(filename): restore_dir = os.environ.get('RESTORE_DATA_DIR', '') local_config = yaml.safe_load( - os.environ.get('SPILO_CONFIGURATION', os.environ.get('PATRONI_CONFIGURATION', ''))) or {} - pod_ip = os.environ.get('POD_IP') - # scope - local_config['scope'] = os.environ.get('SCOPE') - # name - local_config['name'] = os.environ.get('CURRENT_POD_NAME') - # etcd3 - local_config['etcd3'] = { - 'host': os.environ.get('PATRONI_DCS_ETCD_SERVICE_ENDPOINT') - } - # restapi - local_config['restapi'] = { - 'listen': f'{pod_ip}:8008', - 'connect_address': f'{pod_ip}:8008', - } - # postgresql + os.environ.get('SPILO_CONFIGURATION', + os.environ.get('PATRONI_CONFIGURATION', ''))) or {} + + # set postgresql parameters if 'postgresql' not in local_config: local_config['postgresql'] = {} postgresql = local_config['postgresql'] - postgresql['data_dir'] = os.environ.get('PGDATA') postgresql['config_dir'] = '/home/postgres/pgdata/conf' postgresql['custom_conf'] = '/home/postgres/conf/postgresql.conf' - postgresql['authentication'] = {} - postgresql['listen'] = '0.0.0.0:5432' - postgresql['connect_address'] = f'{pod_ip}:5432' - authentication = postgresql['authentication'] - authentication['superuser'] = {"username": os.environ.get('PGUSER_SUPERUSER'), - 'password': os.environ.get('PGPASSWORD_SUPERUSER')} - authentication['replication'] = {'username': os.environ.get('PGUSER_SUPERUSER'), - 'password': os.environ.get('POSTGRES_PASSWORD')} # add pg_hba.conf with open('/home/postgres/conf/pg_hba.conf', 'r') as f: lines = read_file_lines(f) if lines: postgresql['pg_hba'] = lines - - if restore_dir and os.path.isfile(os.path.join(restore_dir, 'kb_restore.signal')): + if restore_dir and os.path.isfile( + os.path.join(restore_dir, 'kb_restore.signal')): if 'bootstrap' not in local_config: local_config['bootstrap'] = {} with open('/home/postgres/conf/kb_restore.conf', 'r') as f: local_config['bootstrap'].update(yaml.safe_load(f)) - local_config['bootstrap'] = {} - bootstrap = local_config['bootstrap'] - bootstrap['dcs'] = { - 'postgresql': { - 'parameters': {'listen_addresses': "0.0.0.0", "port": 5432} - } - } # point in time recovery(PITR) if os.path.isfile("/home/postgres/pgdata/conf/recovery.conf"): with open('/home/postgres/conf/kb_pitr.conf', 'r') as f: @@ -98,7 +69,6 @@ def main(filename): re_config = postgresql_conf_to_dict("/home/postgres/pgdata/conf/recovery.conf") pitr_config[pitr_config['method']]['recovery_conf'].update(re_config) local_config['bootstrap'].update(pitr_config) - # patroni parameters if 'bootstrap' not in local_config: local_config['bootstrap'] = {} @@ -109,8 +79,6 @@ def main(filename): local_config['bootstrap']['dcs'].update(yaml.safe_load(f)) else: print('patroni.yaml not found') - - # bootstrap write_file(yaml.dump(local_config, default_flow_style=False), filename, True) diff --git a/addons/orioledb/templates/cmpd.yaml b/addons/orioledb/templates/cmpd.yaml index 8700bbe3c..b42234bca 100644 --- a/addons/orioledb/templates/cmpd.yaml +++ b/addons/orioledb/templates/cmpd.yaml @@ -276,6 +276,14 @@ spec: value: /home/postgres/conf/postgresql.conf - name: ALLOW_NOSSL value: "true" + - name: SPILO_CONFIGURATION + value: | ## https://github.com/zalando/patroni#yaml-configuration + bootstrap: + initdb: + - auth-host: md5 + - auth-local: trust + - name: ALLOW_NOSSL + value: "true" - name: PGROOT value: /home/postgres/pgdata/pgroot - name: PGDATA diff --git a/addons/orioledb/templates/orioledb-configuration-template.yaml b/addons/orioledb/templates/orioledb-configuration-template.yaml index e9caf3924..1df053d63 100644 --- a/addons/orioledb/templates/orioledb-configuration-template.yaml +++ b/addons/orioledb/templates/orioledb-configuration-template.yaml @@ -24,4 +24,6 @@ data: kb_restore_from_time: command: bash /home/postgres/pgdata/kb_restore/kb_restore.sh keep_existing_recovery_conf: false - recovery_conf: {} \ No newline at end of file + recovery_conf: {} + patroni.yaml: |- + {{- .Files.Get "config/patroni-yaml.tpl" | nindent 4 }} \ No newline at end of file From b57a5990f2bd75e61ce71a6a490203cdcf0bb814 Mon Sep 17 00:00:00 2001 From: Y-Rookie Date: Wed, 11 Dec 2024 10:42:04 +0800 Subject: [PATCH 4/5] upgrade orielodb addon to v1.0 API --- addons-cluster/orioledb/templates/_helpers.tpl | 2 +- addons-cluster/orioledb/values.yaml | 2 +- addons/orioledb/templates/cmpv.yaml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons-cluster/orioledb/templates/_helpers.tpl b/addons-cluster/orioledb/templates/_helpers.tpl index 4abc71de0..bb3028ab8 100644 --- a/addons-cluster/orioledb/templates/_helpers.tpl +++ b/addons-cluster/orioledb/templates/_helpers.tpl @@ -12,7 +12,7 @@ replicas: {{ max .Values.replicas 2 }} {{- end }} {{/* -Define postgresql ComponentSpec with ComponentDefinition. +Define orioledb ComponentSpec with ComponentDefinition. */}} {{- define "orioledb-cluster.componentSpec" }} clusterDef: orioledb diff --git a/addons-cluster/orioledb/values.yaml b/addons-cluster/orioledb/values.yaml index 60dea8ebe..3da627b66 100644 --- a/addons-cluster/orioledb/values.yaml +++ b/addons-cluster/orioledb/values.yaml @@ -10,7 +10,7 @@ terminationPolicy: Delete ## version: 14.7.2 -## @param mode postgresql cluster topology mode, standalone, replication +## @param mode orioledb cluster topology mode, standalone, replication ## mode: replication diff --git a/addons/orioledb/templates/cmpv.yaml b/addons/orioledb/templates/cmpv.yaml index 21f609577..dcf223108 100644 --- a/addons/orioledb/templates/cmpv.yaml +++ b/addons/orioledb/templates/cmpv.yaml @@ -11,9 +11,9 @@ spec: - compDefs: - {{ include "orioledb.cmpdRegexPattern" . }} releases: - - 14.7.2-beta1 + - 14.7.2 releases: - - name: 14.7.2-beta1 + - name: 14.7.2 changes: serviceVersion: 14.7.2 images: From e80c6e93ef736e433deaf8130495c2bc24f85705 Mon Sep 17 00:00:00 2001 From: Y-Rookie Date: Wed, 11 Dec 2024 02:42:36 +0000 Subject: [PATCH 5/5] chore: auto generated files --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a6ecbb895..28801750e 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ KubeBlocks add-ons. | oceanbase-ce | oceanbase-ce-4.3.0 | OceanBase has served over 400 customers across the globe and has been supporting all mission critical systems in Alipay. | Powerfooi shanshanying | | opensearch | opensearch-2.7.0
opensearch-dashboard-2.7.0 | Open source distributed and RESTful search engine. | iziang | | orchestrator | orchestrator-3.2.6 | Orchestrator is a MySQL high availability and replication management tool, runs as a service and provides command line access, HTTP API and Web interface. | kubeJocker | -| orioledb | orioledb-14.7.2-beta1 | OrioleDB is a new storage engine for PostgreSQL, bringing a modern approach to database capacity, capabilities and performance to the world's most-loved database platform. | 1aal | +| orioledb | orioledb-14.7.2 | OrioleDB is a new storage engine for PostgreSQL, bringing a modern approach to database capacity, capabilities and performance to the world's most-loved database platform. | 1aal | | polardbx | polardbx-v2.3 | PolarDB-X is a cloud native distributed SQL Database designed for high concurrency, massive storage, complex querying scenarios. | Vettal Wu | | postgresql | postgresql-12.14.0
postgresql-12.14.1
postgresql-12.15.0
postgresql-14.7.2
postgresql-14.8.0
postgresql-15.7.0
postgresql-16.4.0 | A PostgreSQL (with Patroni HA) cluster definition Helm chart for Kubernetes | ldming | | pulsar | pulsar-bookies-recovery-2.11.2
pulsar-bookies-recovery-3.0.2
pulsar-bookkeeper-2.11.2
pulsar-bookkeeper-3.0.2
pulsar-broker-2.11.2
pulsar-broker-3.0.2
pulsar-proxy-2.11.2
pulsar-proxy-3.0.2
pulsar-zookeeper-2.11.2
pulsar-zookeeper-3.0.2 | Apache Pulsar is an open-source, distributed messaging and streaming platform built for the cloud. | caiq1nyu |