Zookeeper cluster first version

This commit is contained in:
tompizmor
2018-06-15 13:02:13 +02:00
parent 5611c204e2
commit 5f015059a6
3 changed files with 28 additions and 7 deletions

View File

@@ -52,7 +52,7 @@ The following tables lists the configurable parameters of the Zookeeper chart an
| `image.pullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
| `image.debug` | Specify if debug values should be set | `false` |
| `updateStrategy` | Update strategies | `RollingUpdate` |
| `serverID` | ID of the server in the ensemble | `1` |
| `replicaCount` | Number of ZooKeeper nodes | `1` |
| `tickTime` | Basic time unit in milliseconds used by ZooKeeper for heartbeats | `2000` |
| `initLimit` | Time the ZooKeeper servers in quorum have to connect to a leader | `10` |
| `syncLimit` | How far out of date a server can be from a leader | `5` |

View File

@@ -9,7 +9,7 @@ metadata:
heritage: {{ .Release.Service | quote }}
spec:
serviceName: {{ template "zookeeper.fullname" . }}-headless
replicas: 1
replicas: {{ .Values.replicaCount }}
updateStrategy:
type: {{ .Values.updateStrategy | quote }}
selector:
@@ -50,13 +50,30 @@ spec:
- name: "{{ template "zookeeper.fullname" . }}"
image: "{{ template "zookeeper.image" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
command:
- bash
- -ec
- |
# Execute entrypoint as usual after obtaining ZOO_SERVER_ID based on POD hostname
HOST=`hostname -s`
if [[ $HOST =~ (.*)-([0-9]+)$ ]]; then
ORD=${BASH_REMATCH[2]}
export ZOO_SERVER_ID=$((ORD+1))
else
echo "Failed to get index from hostname $HOST"
exit 1
fi
. /opt/bitnami/base/functions
. /opt/bitnami/base/helpers
print_welcome_page
. /init.sh
nami_initialize zookeeper
exec tini -- /run.sh
resources:
{{ toYaml .Values.Resources | indent 10 }}
env:
- name: ZOO_PORT_NUMBER
value: {{ .Values.service.port | quote }}
- name: ZOO_SERVER_ID
value: {{ .Values.serverID | quote }}
- name: ZOO_TICK_TIME
value: {{ .Values.tickTime | quote }}
- name: ZOO_INIT_LIMIT
@@ -66,7 +83,11 @@ spec:
- name: ZOO_MAX_CLIENT_CNXNS
value: {{ .Values.maxClientCnxns | quote }}
- name: ZOO_SERVERS
value: {{ .Values.servers | quote }}
{{- $replicaCount := int .Values.replicaCount }}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- $zookeeperFullname := printf "%s-%s" .Release.Name $name | trunc 24 }}
{{- $zookeeperHeadlessServiceName := printf "%s-%s" $zookeeperFullname "headless" | trunc 24 }}
value: {{range $i, $e := until $replicaCount }}{{ $zookeeperHostname }}-{{ $e }}.{{ $zookeeperHeadlessServiceName }}:2888:3888 {{ end }}
{{- if .Values.auth.enabled }}
- name: ZOO_ENABLE_AUTH
value: "yes"

View File

@@ -27,9 +27,9 @@ image:
##
updateStrategy: RollingUpdate
## ID of the server in the ensemble
## Number of ZooKeeper nodes
##
serverID: 1
replicaCount: 1
## Basic time unit in milliseconds used by ZooKeeper for heartbeats
##