diff --git a/addons-cluster/zookeeper/templates/cluster.yaml b/addons-cluster/zookeeper/templates/cluster.yaml index 1dfd887db..3ab617b9d 100644 --- a/addons-cluster/zookeeper/templates/cluster.yaml +++ b/addons-cluster/zookeeper/templates/cluster.yaml @@ -9,6 +9,7 @@ spec: {{- include "kblib.affinity" . | indent 2 }} componentSpecs: - name: zookeeper + ## TODO: use regex pattern when cluster validation supported componentDef: zookeeper replicas: {{ .Values.replicas }} serviceAccountName: {{ include "kblib.serviceAccountName" . }} @@ -17,9 +18,9 @@ spec: {{- include "kblib.componentResources" . | indent 6 }} env: - name: ZOOKEEPER_IMAGE_VERSION - value: "{{ .Values.serviceVersion }}" + value: "{{ .Values.version }}" volumeClaimTemplates: - - name: data # ref clusterDefinition components.containers.volumeMounts.name + - name: data spec: accessModes: - ReadWriteOnce diff --git a/addons-cluster/zookeeper/values.yaml b/addons-cluster/zookeeper/values.yaml index 5df310152..57f191520 100644 --- a/addons-cluster/zookeeper/values.yaml +++ b/addons-cluster/zookeeper/values.yaml @@ -27,7 +27,11 @@ memory: 2 # cpu: 1 # memory: 1 - +## @param storage, the unit is Gi storage: 10 -logStorage: 2 \ No newline at end of file +## @param log storage, the unit is Gi +logStorage: 2 + +## sc for log and data +storageClassName: \ No newline at end of file diff --git a/addons/zookeeper/scripts-ut-spec/roleprobe_spec.sh b/addons/zookeeper/scripts-ut-spec/roleprobe_spec.sh new file mode 100644 index 000000000..baa274ee0 --- /dev/null +++ b/addons/zookeeper/scripts-ut-spec/roleprobe_spec.sh @@ -0,0 +1,106 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 + +# validate_shell_type_and_version defined in shellspec/spec_helper.sh used to validate the expected shell type and version this script needs to run. +if ! validate_shell_type_and_version "bash" 4 &>/dev/null; then + echo "roleprobe_spec.sh skip cases because dependency bash version 4 or higher is not installed." + exit 0 +fi + +Describe "ZooKeeper Startup Bash Script Tests" + # load the scripts to be tested and dependencies + Include ../scripts/roleprobe.sh + + init() { + zk_env_file="./zkEnv.sh" + ut_mode="true" + } + BeforeAll "init" + + cleanup() { + rm -f $zk_env_file; + } + AfterAll 'cleanup' + + Describe "get_zookeeper_mode()" + It "returns standalone mode" + java() { + echo "Mode: standalone" + } + + When call get_zookeeper_mode + The output should eq "standalone" + End + + It "returns leader mode" + java() { + echo "Mode: leader" + } + + When call get_zookeeper_mode + The output should eq "leader" + End + + It "returns follower mode" + java() { + echo "Mode: follower" + } + + When call get_zookeeper_mode + The output should eq "follower" + End + End + + Describe "load_zk_env()" + setup() { + touch $zk_env_file + echo "#!/bin/bash" > $zk_env_file + echo "export ZOO_LOG_DIR=/var/log/zookeeper" >> $zk_env_file + echo "export ZOO_LOG4J_PROP=INFO,ROLLINGFILE" >> $zk_env_file + chmod +x $zk_env_file + } + Before "setup" + + un_setup() { + rm -rf $zk_env_file + unset ZOO_LOG_DIR + unset ZOO_LOG4J_PROP + } + After "un_setup" + + It "loads zkEnv.sh and sets environment variables" + When call load_zk_env + The variable ZOO_LOG_DIR should eq "/var/log/zookeeper" + The variable ZOO_LOG4J_PROP should eq "INFO,ROLLINGFILE" + End + End + + Describe "get_zk_role()" + It "returns leader when mode is standalone" + get_zookeeper_mode() { + echo "standalone" + } + + When call get_zk_role + The output should eq "leader" + End + + It "returns leader when mode is leader" + get_zookeeper_mode() { + echo "leader" + } + + When call get_zk_role + The output should eq "leader" + End + + It "returns follower when mode is follower" + get_zookeeper_mode() { + echo "follower" + } + + When call get_zk_role + The output should eq "follower" + End + End +End \ No newline at end of file diff --git a/addons/zookeeper/scripts-ut-spec/startup_spec.sh b/addons/zookeeper/scripts-ut-spec/startup_spec.sh new file mode 100644 index 000000000..dfda38ac5 --- /dev/null +++ b/addons/zookeeper/scripts-ut-spec/startup_spec.sh @@ -0,0 +1,149 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 + +# validate_shell_type_and_version defined in shellspec/spec_helper.sh used to validate the expected shell type and version this script needs to run. +if ! validate_shell_type_and_version "bash" 4 &>/dev/null; then + echo "startup_spec.sh skip cases because dependency bash version 4 or higher is not installed." + exit 0 +fi + +Describe "ZooKeeper Startup Bash Script Tests" + # load the scripts to be tested and dependencies + Include ../scripts/startup.sh + + init() { + myid_file="./myid" + ut_mode="true" + } + BeforeAll "init" + + cleanup() { + rm -f $myid_file; + } + AfterAll 'cleanup' + + Describe "set_zookeeper_server_id()" + Context "when myid_file exists" + setup() { + echo "1" > $myid_file + } + Before "setup" + + un_setup() { + rm -rf $myid_file + } + After "un_setup" + + It "sets ZOO_SERVER_ID from $myid_file" + When call set_zookeeper_server_id + The variable ZOO_SERVER_ID should eq "1" + End + End + + Context "when $myid_file does not exist" + setup() { + rm -rf $myid_file + export CURRENT_POD_NAME="zookeeper-2" + } + Before "setup" + + un_setup() { + unset CURRENT_POD_NAME + } + After "un_setup" + + It "sets ZOO_SERVER_ID from CURRENT_POD_NAME and creates $myid_file" + When call set_zookeeper_server_id + The variable ZOO_SERVER_ID should eq "2" + The contents of file "$myid_file" should eq "2" + End + End + End + + Describe "compare_version()" + It "returns true when v1 > v2" + When call compare_version "gt" "3.5.0" "3.4.0" + The status should be success + End + + It "returns false when v1 <= v2" + When call compare_version "gt" "3.4.0" "3.5.0" + The status should be failure + End + + It "returns true when v1 <= v2" + When call compare_version "le" "3.4.0" "3.5.0" + The status should be success + End + + It "returns false when v1 > v2" + When call compare_version "le" "3.5.0" "3.4.0" + The status should be failure + End + + It "returns true when v1 < v2" + When call compare_version "lt" "3.4.0" "3.5.0" + The status should be success + End + + It "returns false when v1 >= v2" + When call compare_version "lt" "3.5.0" "3.4.0" + The status should be failure + End + + It "returns true when v1 >= v2" + When call compare_version "ge" "3.5.0" "3.4.0" + The status should be success + End + + It "returns false when v1 < v2" + When call compare_version "ge" "3.4.0" "3.5.0" + The status should be failure + End + End + + Describe "set_scripts_path()" + Context "when ZOOKEEPER_IMAGE_VERSION is not set" + It "sets scripts_path to /opt/bitnami/scripts/zookeeper" + When call set_scripts_path + The variable scripts_path should eq "/opt/bitnami/scripts/zookeeper" + End + End + + Context "when ZOOKEEPER_IMAGE_VERSION is set" + Context "when ZOOKEEPER_IMAGE_VERSION < 3.6.0" + setup() { + export ZOOKEEPER_IMAGE_VERSION="3.5.0" + } + Before "setup" + + un_setup() { + unset ZOOKEEPER_IMAGE_VERSION + } + After "un_setup" + + It "sets scripts_path to /opt/bitnami/scripts/zookeeper" + When call set_scripts_path + The variable scripts_path should eq "/opt/bitnami/scripts/zookeeper" + End + End + + Context "when ZOOKEEPER_IMAGE_VERSION >= 3.6.0" + setup() { + export ZOOKEEPER_IMAGE_VERSION="3.6.0" + } + Before "setup" + + un_setup() { + unset ZOOKEEPER_IMAGE_VERSION + } + After "un_setup" + + It "sets scripts_path to empty string" + When call set_scripts_path + The variable scripts_path should eq "" + End + End + End + End +End \ No newline at end of file diff --git a/addons/zookeeper/scripts/roleprobe.sh b/addons/zookeeper/scripts/roleprobe.sh new file mode 100644 index 000000000..99abb0d30 --- /dev/null +++ b/addons/zookeeper/scripts/roleprobe.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +zk_env_file="$ZOOBINDIR"/zkEnv.sh + +load_zk_env() { + # shellcheck source=$ZOOBINDIR"/zkEnv.sh + source "$zk_env_file" > /dev/null +} + +get_zookeeper_mode() { + local stat + stat=$(java -cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain localhost 2181 srvr 2> /dev/null | grep Mode) + echo "$stat" | awk -F': ' '{print $2}' | tr -d '[:space:]\n' +} + +get_zk_role() { + local mode + mode=$(get_zookeeper_mode) + if [[ "$mode" == "standalone" ]]; then + printf "leader" + else + printf "%s" "$mode" + 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_zk_env +get_zk_role \ No newline at end of file diff --git a/addons/zookeeper/scripts/startup.sh b/addons/zookeeper/scripts/startup.sh index 58b648da3..de7033b66 100644 --- a/addons/zookeeper/scripts/startup.sh +++ b/addons/zookeeper/scripts/startup.sh @@ -1,26 +1,56 @@ #!/bin/bash -# Execute entrypoint as usual after obtaining ZOO_SERVER_ID -# check ZOO_SERVER_ID in persistent volume via myid -# if not present, set based on POD hostname -if [[ -f "/bitnami/zookeeper/data/myid" ]]; then - export ZOO_SERVER_ID="$(cat /bitnami/zookeeper/data/myid)" -else - SERVICE_ID=${CURRENT_POD_NAME##*-} - export ZOO_SERVER_ID=$SERVICE_ID - echo $ZOO_SERVER_ID > /bitnami/zookeeper/data/myid -fi - -function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; } -function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; } -function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; } -function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } - - -if [ -z "${ZOOKEEPER_IMAGE_VERSION}" ] || version_lt "3.6.0" "${ZOOKEEPER_IMAGE_VERSION%%-*}" ; then - scripts_path="/opt/bitnami/scripts/zookeeper" -else - scripts_path="" -fi - -exec ${scripts_path}/entrypoint.sh ${scripts_path}/run.sh \ No newline at end of file +myid_file="/bitnami/zookeeper/data/myid" + +# Execute entrypoint as usual after obtaining ZOO_SERVER_ID, check ZOO_SERVER_ID in persistent volume via myid, if not present, set based on POD hostname +set_zookeeper_server_id() { + if [[ -f "$myid_file" ]]; then + ZOO_SERVER_ID="$(cat $myid_file)" + export ZOO_SERVER_ID + else + SERVICE_ID="${CURRENT_POD_NAME##*-}" + ZOO_SERVER_ID="$SERVICE_ID" + export ZOO_SERVER_ID + echo "$ZOO_SERVER_ID" > $myid_file + fi +} + +compare_version() { + local op=$1 + local v1=$2 + local v2=$3 + local result + + result=$(echo -e "$v1\n$v2" | sort -V | head -n 1) + + case $op in + gt) [[ "$result" != "$v1" ]];; + le) [[ "$result" == "$v1" ]];; + lt) [[ "$result" != "$v2" ]];; + ge) [[ "$result" == "$v2" ]];; + esac +} + +set_scripts_path() { + if [[ -z "${ZOOKEEPER_IMAGE_VERSION}" ]] || compare_version "lt" "${ZOOKEEPER_IMAGE_VERSION%%-*}" "3.6.0"; then + scripts_path="/opt/bitnami/scripts/zookeeper" + else + scripts_path="" + fi +} + +start() { + set_zookeeper_server_id + set_scripts_path + exec "${scripts_path}/entrypoint.sh" "${scripts_path}/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 +start "$@" \ No newline at end of file diff --git a/addons/zookeeper/templates/_helpers.tpl b/addons/zookeeper/templates/_helpers.tpl index c4e420f29..8d529166f 100644 --- a/addons/zookeeper/templates/_helpers.tpl +++ b/addons/zookeeper/templates/_helpers.tpl @@ -49,3 +49,57 @@ Selector labels app.kubernetes.io/name: {{ include "zookeeper.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} + +{{/* +Common annotations +*/}} +{{- define "zookeeper.annotations" -}} +helm.sh/resource-policy: keep +{{- end }} + + +{{- define "zoocreeper.image" -}} +{{ .Values.zoocreeperImage.registry | default (.Values.zoocreeperImage.registry | default "docker.io") }}/{{ .Values.zoocreeperImage.repository }}:{{ .Values.zoocreeperImage.tag }} +{{- end }}} + +{{/* +Define zookeeper component definition name +*/}} +{{- define "zookeeper.cmpdName" -}} +zookeeper-{{ .Chart.Version }} +{{- end -}} + +{{/* +Define zookeeper component definition regular expression name prefix +*/}} +{{- define "zookeeper.cmpdRegexpPattern" -}} +^zookeeper- +{{- end -}} + +{{/* +Define zookeeper scripts template name +*/}} +{{- define "zookeeper.scriptsTplName" -}} +zookeeper-scripts +{{- end -}} + +{{/* +Define zookeeper config template name +*/}} +{{- define "zookeeper.configTplName" -}} +zookeeper-config-template +{{- end -}} + +{{/* +Define zookeeper config constraint name +*/}} +{{- define "zookeeper.configConstraintName" -}} +zookeeper-config-constraints +{{- end -}} + +{{/* +Define zookeeper log config template name +*/}} +{{- define "zookeeper.logConfigTplName" -}} +zookeeper-log-config-template +{{- end -}} diff --git a/addons/zookeeper/templates/backupactionset.yaml b/addons/zookeeper/templates/backupactionset.yaml index 4533bd960..ce2c957a7 100644 --- a/addons/zookeeper/templates/backupactionset.yaml +++ b/addons/zookeeper/templates/backupactionset.yaml @@ -8,7 +8,7 @@ spec: backupType: Full backup: backupData: - image: {{ .Values.images.zoocreeper.registry | default (.Values.images.registry | default "docker.io") }}/{{ .Values.images.zoocreeper.repository }}:{{ .Values.images.zoocreeper.tag }} + image: {{ include "zoocreeper.image" . }} runOnTargetPodNode: true command: - sh @@ -22,7 +22,7 @@ spec: restore: postReady: - job: - image: {{ .Values.images.zoocreeper.registry | default (.Values.images.registry | default "docker.io") }}/{{ .Values.images.zoocreeper.repository }}:{{ .Values.images.zoocreeper.tag }} + image: {{ include "zoocreeper.image" . }} runOnTargetPodNode: true command: - sh diff --git a/addons/zookeeper/templates/backuppolicytemplate.yaml b/addons/zookeeper/templates/backuppolicytemplate.yaml index 844af2ab8..5c289331d 100644 --- a/addons/zookeeper/templates/backuppolicytemplate.yaml +++ b/addons/zookeeper/templates/backuppolicytemplate.yaml @@ -6,7 +6,8 @@ metadata: {{- include "zookeeper.labels" . | nindent 4 }} spec: serviceKind: Zookeeper - compDefs: [zookeeper] + compDefs: + - {{ include "zookeeper.cmpdRegexpPattern" . }} target: role: follower fallbackRole: leader diff --git a/addons/zookeeper/templates/cmpd.yaml b/addons/zookeeper/templates/cmpd.yaml index f74a803f7..0848dd85f 100644 --- a/addons/zookeeper/templates/cmpd.yaml +++ b/addons/zookeeper/templates/cmpd.yaml @@ -1,9 +1,11 @@ apiVersion: apps.kubeblocks.io/v1 kind: ComponentDefinition metadata: - name: zookeeper + name: {{ include "zookeeper.cmpdName" . }} labels: {{- include "zookeeper.labels" . | nindent 4 }} + annotations: + {{- include "zookeeper.annotations" . | nindent 4 }} spec: provider: ApeCloud description: {{ .Chart.Description }} @@ -29,7 +31,6 @@ spec: port: 2888 - name: admin port: 8080 - roles: - name: leader serviceable: true @@ -43,27 +44,65 @@ spec: serviceable: false writable: false votable: false + updateStrategy: BestEffortParallel + vars: + - name: ZOOKEEPER_POD_FQDN_LIST + valueFrom: + componentVarRef: + optional: false + podFQDNs: Required + - name: ZOOKEEPER_METRICS_MONITOR + value: {{ .Values.metrics.enabled | quote }} + - name: ZOOKEEPER_METRICS_PORT + value: {{ .Values.metrics.port | quote }} + - name: ZOOKEEPER_DATA_DIR + value: {{ .Values.zookeeper.dataDir }} + - name: ZOOKEEPER_DATA_LOG_DIR + value: {{ .Values.zookeeper.dataLogDir }} + - name: ZOOBINDIR + value: "/opt/bitnami/zookeeper/bin" + ## this var is used in the ZkServer.sh of bitnami image version 3.4 + - name: ZOOBIN + value: "/opt/bitnami/zookeeper/bin" + - name: ZOO_ENABLE_AUTH + value: "yes" + ## this var needs to be preserved as Gemini will utilize this variable + - name: SERVICE_PORT + value: {{ .Values.metrics.port | quote }} + - name: ZOO_LOG4J_PROP + value: "INFO,ROLLINGFILE,TRACEFILE,CONSOLE" + scripts: + - name: zookeeper-scripts + templateRef: {{ include "zookeeper.scriptsTplName" . }} + volumeName: scripts + namespace: {{ .Release.Namespace }} + defaultMode: 0755 + configs: + - name: zookeeper-config + namespace: {{ .Release.Namespace }} + templateRef: {{ include "zookeeper.configTplName" . }} + constraintRef: {{ include "zookeeper.configConstraintName" . }} + volumeName: config + defaultMode: 0755 + reRenderResourceTypes: + - hscale + - name: zookeeper-log + namespace: {{ .Release.Namespace }} + templateRef: {{ include "zookeeper.logConfigTplName" . }} + volumeName: config-log lifecycleActions: roleProbe: exec: + container: zookeeper command: - /bin/bash - -c - | - . "$ZOOBINDIR"/zkEnv.sh > /dev/null - STAT=$(java -cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain \ - localhost 2181 srvr 2> /dev/null | grep Mode) - mode=$(echo "$STAT" | awk -F': ' '{print $2}' | awk '{RS=""; ORS=""; print}' ) - if [[ "$mode" == "standalone" ]]; then - echo -n "leader" - else - echo -n ${mode} - fi + /kubeblocks/scripts/roleprobe.sh runtime: volumes: - name: snapshot-log emptyDir: {} - securityContext: fsGroup: 0 runAsGroup: 0 @@ -78,16 +117,6 @@ spec: - | /kubeblocks/scripts/startup.sh env: - - name: ZOOBINDIR - value: "/opt/bitnami/zookeeper/bin" - - name: ZOOBIN - value: "/opt/bitnami/zookeeper/bin" - - name: ZOO_ENABLE_AUTH - value: "yes" - - name: SERVICE_PORT - value: {{ .Values.metrics.port | quote }} - - name: ZOO_LOG4J_PROP - value: "INFO,ROLLINGFILE,TRACEFILE,CONSOLE" - name: CURRENT_POD_NAME valueFrom: fieldRef: @@ -159,39 +188,3 @@ spec: subPath: log4j.properties - name: scripts mountPath: /kubeblocks/scripts - vars: - - name: ZOOKEEPER_POD_FQDN_LIST - valueFrom: - componentVarRef: - optional: false - podFQDNs: Required - - name: ZOOKEEPER_METRICS_MONITOR - value: {{ .Values.metrics.enabled | quote }} - - name: ZOOKEEPER_METRICS_PORT - value: {{ .Values.metrics.port | quote }} - - name: ZOOKEEPER_DATA_DIR - value: {{ .Values.zookeeper.dataDir }} - - name: ZOOKEEPER_DATA_LOG_DIR - value: {{ .Values.zookeeper.dataLogDir }} - - scripts: - - name: zookeeper-scripts - templateRef: {{ include "zookeeper.name" . }}-scripts - volumeName: scripts - namespace: {{ .Release.Namespace }} - defaultMode: 0755 - - configs: - - name: zookeeper-config - namespace: {{ .Release.Namespace }} - templateRef: {{ include "zookeeper.name" . }}-config-template - constraintRef: {{ include "zookeeper.name" . }}-config-constraints - volumeName: config - defaultMode: 0755 - reRenderResourceTypes: - - hscale - - name: zookeeper-log - namespace: {{ .Release.Namespace }} - templateRef: {{ include "zookeeper.name" . }}-configmap - volumeName: config-log - updateStrategy: BestEffortParallel diff --git a/addons/zookeeper/templates/cmpv.yaml b/addons/zookeeper/templates/cmpv.yaml index be14a6cf4..3621c46a0 100644 --- a/addons/zookeeper/templates/cmpv.yaml +++ b/addons/zookeeper/templates/cmpv.yaml @@ -13,25 +13,30 @@ spec: - 3.8.4 - 3.9.2 compDefs: - - zookeeper + - {{ include "zookeeper.cmpdRegexpPattern" . }} releases: - name: 3.4.14 serviceVersion: 3.4.14 images: zookeeper: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.4.14 + roleprobe: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.4.14 - name: 3.6.4 serviceVersion: 3.6.4 images: zookeeper: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.6.4 + roleprobe: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.6.4 - name: 3.7.2 serviceVersion: 3.7.2 images: zookeeper: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.7.2 + roleprobe: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.7.2 - name: 3.8.4 serviceVersion: 3.8.4 images: zookeeper: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.8.4 + roleprobe: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.8.4 - name: 3.9.2 serviceVersion: 3.9.2 images: zookeeper: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.9.2 + roleprobe: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:3.9.2 diff --git a/addons/zookeeper/templates/config-configmap.yaml b/addons/zookeeper/templates/config-configmap.yaml index 08c50202a..4048d453a 100644 --- a/addons/zookeeper/templates/config-configmap.yaml +++ b/addons/zookeeper/templates/config-configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "zookeeper.name" . }}-config-template + name: {{ include "zookeeper.configTplName" . }} labels: {{- include "zookeeper.labels" . | nindent 4 }} data: diff --git a/addons/zookeeper/templates/configconstraint.yaml b/addons/zookeeper/templates/configconstraint.yaml index 372b814e7..78cce4b2d 100644 --- a/addons/zookeeper/templates/configconstraint.yaml +++ b/addons/zookeeper/templates/configconstraint.yaml @@ -2,7 +2,7 @@ apiVersion: apps.kubeblocks.io/v1beta1 kind: ConfigConstraint metadata: - name: {{ include "zookeeper.name" . }}-config-constraints + name: {{ include "zookeeper.configConstraintName" . }} labels: {{- include "zookeeper.labels" . | nindent 4 }} spec: diff --git a/addons/zookeeper/templates/comfigmap.yaml b/addons/zookeeper/templates/log-config-configmap.yaml similarity index 83% rename from addons/zookeeper/templates/comfigmap.yaml rename to addons/zookeeper/templates/log-config-configmap.yaml index 142278196..ceed9286a 100644 --- a/addons/zookeeper/templates/comfigmap.yaml +++ b/addons/zookeeper/templates/log-config-configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "zookeeper.name" . }}-configmap + name: {{ include "zookeeper.logConfigTplName" . }} labels: {{- include "zookeeper.labels" . | nindent 4 }} data: diff --git a/addons/zookeeper/templates/scripts.yaml b/addons/zookeeper/templates/scripts.yaml index 5b990d685..31fc7d089 100644 --- a/addons/zookeeper/templates/scripts.yaml +++ b/addons/zookeeper/templates/scripts.yaml @@ -1,9 +1,11 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "zookeeper.name" . }}-scripts + name: {{ include "zookeeper.scriptsTplName" . }} labels: {{- include "zookeeper.labels" . | nindent 4 }} data: startup.sh: |- - {{- .Files.Get "scripts/startup.sh" | nindent 4 }} \ No newline at end of file + {{- .Files.Get "scripts/startup.sh" | nindent 4 }} + roleprobe.sh: |- + {{- .Files.Get "scripts/roleprobe.sh" | nindent 4 }} \ No newline at end of file diff --git a/addons/zookeeper/values.yaml b/addons/zookeeper/values.yaml index e44e15345..62a22d4fd 100644 --- a/addons/zookeeper/values.yaml +++ b/addons/zookeeper/values.yaml @@ -2,17 +2,21 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +nameOverride: "" + +fullnameOverride: "" + images: registry: docker.io repository: bitnami/zookeeper pullPolicy: IfNotPresent - tag: 3.7.2 - # refer: addons/zookeeper/zoocreeper/Dockerfile - zoocreeper: - registry: "" - repository: apecloud/zoocreeper - tag: 1.0.1 + +# refer: addons/zookeeper/zoocreeper/Dockerfile +zoocreeperImage: + registry: "" + repository: apecloud/zoocreeper + tag: 1.0.1 metrics: enabled: true