Skip to content

Commit

Permalink
DX-41560: Change Zookeeper to use official Zookeeper images
Browse files Browse the repository at this point in the history
- Changes Dremio v2 Helm chart to utilize the official Zookeeper image.
  ** Note: Using the old previous version of Zookeeper with this chart
  change is not supported. **
- Updates to allow 3.8.0+ Zookeeper versions to be used.
- Adds a check to fail when using an older, unsupported ZK image.
- For the latest Zookeeper image available, see:
  https://hub.docker.com/_/zookeeper

Change-Id: I4a9f26c83036ec17ae47992553edcec224816d51
  • Loading branch information
skeswani authored and ryantse committed Jun 17, 2022
1 parent a63cb11 commit e545345
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 30 deletions.
11 changes: 11 additions & 0 deletions charts/dremio_v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,14 @@ $ kubectl get services dremio-client
If you want to change the expose port on the load balancer, change the value of the setting `coordinator.flight.port` in the file `values.local.yaml`.
* If the value in the TYPE column of the output is `NodePort`, access Dremio using Flight through http://localhost:31357.
## Upgrading Zookeeper
To upgrade to the official Zookeeper image set the following tags in `values.local.yaml` file.
```
zookeeper:
image: zookeeper
imageTag: 3.8.0
```
4 changes: 2 additions & 2 deletions charts/dremio_v2/docs/Values-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1462,15 +1462,15 @@ When setting this property, the load balancer attempts to use the provided IP ad

Type: String

By default, the value is set to `k8s.gcr.io/kubernetes-zookeeper`.
By default, the value is set to `zookeeper`.

The `image` refers to the location to retrieve the specific container image for Zookeeper. In some cases, the `zookeeper.image` value may vary in corporate environments where there may be a private container registry that is used.

#### `zookeeper.imageTag`

Type: String

By default, the value is set to `1.0-3.4.10`.
By default, the value is set to `3.8.0`.

The version of Zookeeper set has been validated by Dremio to work with the Dremio software. Changing this version is not recommended unless the tag is different due to a private container registry name difference.

Expand Down
65 changes: 40 additions & 25 deletions charts/dremio_v2/templates/zookeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,36 @@ spec:
containers:
- name: kubernetes-zookeeper
imagePullPolicy: Always
command:
- bash
- -ec
- |
# obtain ZOO_MY_ID based on POD hostname
export HOST_NUMBER="${HOSTNAME##*-}"
export ZOO_MY_ID="$((HOST_NUMBER + 1))"
[ -z "${ZOO_MY_ID}" ] && echo "Failed to get index from hostname $HOSTNAME" && exit 1
echo "ZOO_MY_ID=${ZOO_MY_ID}"
# construct ZOO_SERVERS based on ensemble count
DOMAIN="$(hostname -d)"
SERVERS={{ $.Values.zookeeper.count }}
for (( i=${SERVERS},j=i-1; i>=1; i--,j-- )); do ZOO_SERVERS="server.${i}=zk-${j}.${DOMAIN}:2888:3888;2181 ${ZOO_SERVERS}"; done
echo "ZOO_SERVERS=${ZOO_SERVERS}"
export ZOO_SERVERS
/docker-entrypoint.sh
zkServer.sh start-foreground
env:
- name: JVMFLAGS
value: "-Xmx{{ template "dremio.zookeeper.memory" $ }}m"
- name: ZOO_STANDALONE_ENABLED
value: "false"
- name: ZOO_4LW_COMMANDS_WHITELIST
value: "ruok"
- name: ZOO_ADMINSERVER_ENABLED
value: "false"
- name: ZOO_AUTOPURGE_PURGEINTERVAL
value: "12"
image: "{{ $.Values.zookeeper.image }}:{{ $.Values.zookeeper.imageTag }}"
resources:
requests:
Expand All @@ -90,40 +120,19 @@ spec:
name: server
- containerPort: 3888
name: leader-election
command:
- sh
- -c
- "start-zookeeper \
--servers={{ $.Values.zookeeper.count }} \
--data_dir=/var/lib/zookeeper/data \
--data_log_dir=/var/lib/zookeeper/data/log \
--conf_dir=/opt/zookeeper/conf \
--client_port=2181 \
--election_port=3888 \
--server_port=2888 \
--tick_time=2000 \
--init_limit=10 \
--sync_limit=5 \
--heap={{- template "dremio.zookeeper.memory" $ -}}M \
--max_client_cnxns=60 \
--snap_retain_count=3 \
--purge_interval=12 \
--max_session_timeout=40000 \
--min_session_timeout=4000 \
--log_level=INFO"
readinessProbe:
exec:
command: ["sh", "-c", "zookeeper-ready 2181"]
command: ["/bin/bash", "-c", "[ \"$(echo ruok | nc 127.0.0.1 2181)\" == \"imok\" ]" ]
initialDelaySeconds: 10
timeoutSeconds: 5
livenessProbe:
exec:
command: ["sh", "-c", "zookeeper-ready 2181"]
command: ["/bin/bash", "-c", "[ \"$(echo ruok | nc 127.0.0.1 2181)\" == \"imok\" ]" ]
initialDelaySeconds: 10
timeoutSeconds: 5
volumeMounts:
- name: datadir
mountPath: /var/lib/zookeeper
mountPath: /data
securityContext:
runAsUser: 1000
fsGroup: 1000
Expand All @@ -137,4 +146,10 @@ spec:
resources:
requests:
storage: {{ $.Values.zookeeper.volumeSize }}
{{- end -}}

# use the official zookeeper kubernetes image
{{- if (eq $.Values.zookeeper.image "k8s.gcr.io/kubernetes-zookeeper") }}
{{- fail "\n\n** ERROR: Zookeeper image 'k8s.gcr.io/kubernetes-zookeeper' is no longer supported. Please see 'Upgrading Zookeeper' section in README.md. **\n" -}}
{{- end }}

{{- end -}}
6 changes: 3 additions & 3 deletions charts/dremio_v2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ executor:
# Zookeeper
zookeeper:
# The Zookeeper image used in the cluster.
image: k8s.gcr.io/kubernetes-zookeeper
imageTag: 1.0-3.4.10
image: zookeeper
imageTag: 3.8.0

# CPU & Memory
# Memory allocated to each zookeeper, expressed in MB.
Expand Down Expand Up @@ -474,4 +474,4 @@ service:
# here. For more information, see
# https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
# imagePullSecrets:
# - secretname
# - secretname

0 comments on commit e545345

Please sign in to comment.