### Motivation zookeeper failed to start because of wrong ZOOKEEPER_SERVERS was set. ### Modifications Changed the reference of zookeeper names by how they were created. ### Result zookeeper started successfully and broker worked as expected.
143 lines
5.4 KiB
YAML
143 lines
5.4 KiB
YAML
#
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
|
|
namespace: {{ .Values.namespace }}
|
|
labels:
|
|
app: {{ template "pulsar.name" . }}
|
|
chart: {{ template "pulsar.chart" . }}
|
|
release: {{ .Release.Name }}
|
|
heritage: {{ .Release.Service }}
|
|
component: {{ .Values.zookeeper.component }}
|
|
cluster: {{ template "pulsar.fullname" . }}
|
|
spec:
|
|
serviceName: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
|
|
replicas: {{ .Values.zookeeper.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
app: {{ template "pulsar.name" . }}
|
|
release: {{ .Release.Name }}
|
|
component: {{ .Values.zookeeper.component }}
|
|
updateStrategy:
|
|
{{ toYaml .Values.zookeeper.updateStrategy | indent 4 }}
|
|
podManagementPolicy: {{ .Values.zookeeper.podManagementPolicy }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ template "pulsar.name" . }}
|
|
release: {{ .Release.Name }}
|
|
component: {{ .Values.zookeeper.component }}
|
|
cluster: {{ template "pulsar.fullname" . }}
|
|
annotations:
|
|
{{ toYaml .Values.zookeeper.annotations | indent 8 }}
|
|
spec:
|
|
{{- if .Values.zookeeper.nodeSelector }}
|
|
nodeSelector:
|
|
{{ toYaml .Values.zookeeper.nodeSelector | indent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.zookeeper.tolerations }}
|
|
tolerations:
|
|
{{ toYaml .Values.zookeeper.tolerations | indent 8 }}
|
|
{{- end }}
|
|
affinity:
|
|
podAntiAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
- labelSelector:
|
|
matchExpressions:
|
|
- key: "app"
|
|
operator: In
|
|
values:
|
|
- "{{ template "pulsar.name" . }}-{{ .Values.zookeeper.component }}"
|
|
- key: "release"
|
|
operator: In
|
|
values:
|
|
- {{ .Release.Name }}
|
|
- key: "component"
|
|
operator: In
|
|
values:
|
|
- {{ .Values.zookeeper.component }}
|
|
topologyKey: "kubernetes.io/hostname"
|
|
terminationGracePeriodSeconds: {{ .Values.zookeeper.gracePeriod }}
|
|
containers:
|
|
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
{{- if .Values.zookeeper.resources }}
|
|
resources:
|
|
{{ toYaml .Values.zookeeper.resources | indent 10 }}
|
|
{{- end }}
|
|
command: ["sh", "-c"]
|
|
args:
|
|
- >
|
|
bin/apply-config-from-env.py conf/zookeeper.conf &&
|
|
bin/apply-config-from-env.py conf/pulsar_env.sh &&
|
|
bin/generate-zookeeper-config.sh conf/zookeeper.conf &&
|
|
bin/pulsar zookeeper
|
|
ports:
|
|
- name: client
|
|
containerPort: 2181
|
|
- name: server
|
|
containerPort: 2888
|
|
- name: leader-election
|
|
containerPort: 3888
|
|
env:
|
|
- name: ZOOKEEPER_SERVERS
|
|
value:
|
|
{{- $global := . }}
|
|
{{ range $i, $e := until (.Values.zookeeper.replicaCount | int) }}{{ if ne $i 0 }},{{ end }}{{ template "pulsar.fullname" $global }}-{{ $global.Values.zookeeper.component }}-{{ printf "%d" $i }}{{ end }}
|
|
envFrom:
|
|
- configMapRef:
|
|
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- "bin/pulsar-zookeeper-ruok.sh"
|
|
initialDelaySeconds: 5
|
|
timeoutSeconds: 5
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- "bin/pulsar-zookeeper-ruok.sh"
|
|
initialDelaySeconds: 15
|
|
timeoutSeconds: 5
|
|
volumeMounts:
|
|
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ .Values.zookeeper.volumes.data.name }}"
|
|
mountPath: /pulsar/data
|
|
{{- if not .Values.persistence }}
|
|
volumes:
|
|
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ .Values.zookeeper.volumes.data.name }}"
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- if .Values.persistence }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ .Values.zookeeper.volumes.data.name }}"
|
|
spec:
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.zookeeper.volumes.data.size }}
|
|
{{- if .Values.zookeeper.volumes.data.storageClass }}
|
|
storageClassName: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ .Values.zookeeper.volumes.data.name }}"
|
|
{{- end }}
|
|
{{- end }}
|