bitnami/zookeeper add minServerId variable (#4700)

This commit is contained in:
antonmatsiuk
2020-12-17 09:26:57 +01:00
committed by GitHub
parent fcb97a729e
commit 785a386678
5 changed files with 30 additions and 10 deletions

View File

@@ -21,4 +21,4 @@ name: zookeeper
sources:
- https://github.com/bitnami/bitnami-docker-zookeeper
- https://zookeeper.apache.org/
version: 6.1.0
version: 6.2.0

View File

@@ -101,8 +101,9 @@ The following tables lists the configurable parameters of the ZooKeeper chart an
### Statefulset parameters
| Parameter | Description | Default |
|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|
|:--------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------|
| `replicaCount` | Number of ZooKeeper nodes | `1` |
| `minServerId` | Minimal SERVER_ID value, nodes increment their IDs respectively | `1` |
| `updateStrategy` | Update strategy for the statefulset | `RollingUpdate` |
| `rollingUpdatePartition` | Partition update strategy | `nil` |
| `podManagementPolicy` | Pod management policy | `Parallel` |

View File

@@ -104,14 +104,20 @@ spec:
- bash
- -ec
- |
# Execute entrypoint as usual after obtaining ZOO_SERVER_ID based on POD hostname
HOSTNAME=`hostname -s`
if [[ $HOSTNAME =~ (.*)-([0-9]+)$ ]]; then
ORD=${BASH_REMATCH[2]}
export ZOO_SERVER_ID=$((ORD+1))
# 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
echo "Failed to get index from hostname $HOST"
exit 1
HOSTNAME=`hostname -s`
if [[ $HOSTNAME =~ (.*)-([0-9]+)$ ]]; then
ORD=${BASH_REMATCH[2]}
export ZOO_SERVER_ID=$((ORD + {{ .Values.minServerId }} ))
else
echo "Failed to get index from hostname $HOST"
exit 1
fi
fi
exec /entrypoint.sh /run.sh
{{- if .Values.resources }}
@@ -142,13 +148,14 @@ spec:
value: {{ .Values.maxSessionTimeout | quote }}
- name: ZOO_SERVERS
{{- $replicaCount := int .Values.replicaCount }}
{{- $minServerId := int .Values.minServerId }}
{{- $followerPort := int .Values.service.followerPort }}
{{- $electionPort := int .Values.service.electionPort }}
{{- $releaseNamespace := include "zookeeper.namespace" . }}
{{- $zookeeperFullname := include "common.names.fullname" . }}
{{- $zookeeperHeadlessServiceName := printf "%s-%s" $zookeeperFullname "headless" | trunc 63 }}
{{- $clusterDomain := .Values.clusterDomain }}
value: {{ range $i, $e := until $replicaCount }}{{ $zookeeperFullname }}-{{ $e }}.{{ $zookeeperHeadlessServiceName }}.{{ $releaseNamespace }}.svc.{{ $clusterDomain }}:{{ $followerPort }}:{{ $electionPort }} {{ end }}
value: {{ range $i, $e := until $replicaCount }}{{ $zookeeperFullname }}-{{ $e }}.{{ $zookeeperHeadlessServiceName }}.{{ $releaseNamespace }}.svc.{{ $clusterDomain }}:{{ $followerPort }}:{{ $electionPort }}::{{ add $e $minServerId }} {{ end }}
- name: ZOO_ENABLE_AUTH
value: {{ ternary "yes" "no" .Values.auth.enabled | quote }}
{{- if .Values.auth.enabled }}

View File

@@ -116,6 +116,12 @@ podManagementPolicy: Parallel
##
replicaCount: 3
## Minimal server ID (ZooKeeper myid) value
## servers increment their ID starting at this minimal value.
## E.g., with `minServerId=10` and 3 replicas, server IDs will be 10, 11, 12 for z-0, z-1 and z-2 respectively.
##
minServerId: 1
## Basic time unit in milliseconds used by ZooKeeper for heartbeats
##
tickTime: 2000

View File

@@ -115,6 +115,12 @@ podManagementPolicy: Parallel
##
replicaCount: 1
## Minimal server ID (ZooKeeper myid) value
## servers increment their ID starting at this minimal value.
## E.g., with `minServerId=10` and 3 replicas, server IDs will be 10, 11, 12 for z-0, z-1 and z-2 respectively.
##
minServerId: 1
## Basic time unit in milliseconds used by ZooKeeper for heartbeats
##
tickTime: 2000