blob: 135b59e2b67f5df4621b5aeeb542a2750b9c1a83 [file] [log] [blame]
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: {{ template "common.fullname" . }}
labels:
app: {{ template "common.name" . }}
chart: {{ .Chart.Name }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
component: server
spec:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- "{{ .Chart.Name }}"
serviceName: {{ template "common.fullname" . }}-headless
replicas: {{ .Values.replicaCount }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
selector:
matchLabels:
app: {{ template "common.name" . }}
release: {{ .Release.Name }}
component: server
updateStrategy:
{{ toYaml .Values.updateStrategy | indent 4 }}
template:
metadata:
labels:
app: {{ template "common.name" . }}
release: {{ .Release.Name }}
component: server
{{- if .Values.podLabels }}
## Custom pod labels
{{- range $key, $value := .Values.podLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
annotations:
{{- if .Values.podAnnotations }}
## Custom pod annotations
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
{{- if .Values.schedulerName }}
schedulerName: "{{ .Values.schedulerName }}"
{{- end }}
securityContext:
{{ toYaml .Values.securityContext | indent 8 }}
containers:
- name: zookeeper
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /bin/bash
- -xec
- zkGenConfig.sh && exec zkServer.sh start-foreground
ports:
{{- range $key, $port := .Values.ports }}
- name: {{ $key }}
{{ toYaml $port | indent 14 }}
{{- end }}
livenessProbe:
{{ toYaml .Values.livenessProbe | indent 12 }}
readinessProbe:
{{ toYaml .Values.readinessProbe | indent 12 }}
env:
- name: ZK_REPLICAS
value: {{ .Values.replicaCount | quote }}
{{- range $key, $value := .Values.env }}
- name: {{ $key | upper | replace "." "_" }}
value: {{ $value | quote }}
{{- end }}
resources:
{{ include "common.resources" . }}
volumeMounts:
- name: zookeeper-data
mountPath: /var/lib/zookeeper
{{- if .Values.exporters.jmx.enabled }}
- name: jmx-exporter
image: "{{ .Values.exporters.jmx.image.repository }}:{{ .Values.exporters.jmx.image.tag }}"
imagePullPolicy: {{ .Values.exporters.jmx.image.pullPolicy }}
ports:
{{- range $key, $port := .Values.exporters.jmx.ports }}
- name: {{ $key }}
{{ toYaml $port | indent 14 }}
{{- end }}
livenessProbe:
{{ toYaml .Values.exporters.jmx.livenessProbe | indent 12 }}
readinessProbe:
{{ toYaml .Values.exporters.jmx.readinessProbe | indent 12 }}
env:
- name: SERVICE_PORT
value: {{ .Values.exporters.jmx.ports.jmxxp.containerPort | quote }}
{{- with .Values.exporters.jmx.env }}
{{- range $key, $value := . }}
- name: {{ $key | upper | replace "." "_" }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
resources:
{{ toYaml .Values.exporters.jmx.resources | indent 12 }}
volumeMounts:
- name: config-jmx-exporter
mountPath: /opt/jmx_exporter/config.yml
subPath: config.yml
{{- end }}
{{- if .Values.exporters.zookeeper.enabled }}
- name: zookeeper-exporter
image: "{{ .Values.exporters.zookeeper.image.repository }}:{{ .Values.exporters.zookeeper.image.tag }}"
imagePullPolicy: {{ .Values.exporters.zookeeper.image.pullPolicy }}
args:
- -bind-addr=:{{ .Values.exporters.zookeeper.ports.zookeeperxp.containerPort }}
- -metrics-path={{ .Values.exporters.zookeeper.path }}
- -zookeeper=localhost:{{ .Values.ports.client.containerPort }}
- -log-level={{ .Values.exporters.zookeeper.config.logLevel }}
- -reset-on-scrape={{ .Values.exporters.zookeeper.config.resetOnScrape }}
ports:
{{- range $key, $port := .Values.exporters.zookeeper.ports }}
- name: {{ $key }}
{{ toYaml $port | indent 14 }}
{{- end }}
livenessProbe:
{{ toYaml .Values.exporters.zookeeper.livenessProbe | indent 12 }}
readinessProbe:
{{ toYaml .Values.exporters.zookeeper.readinessProbe | indent 12 }}
env:
{{- range $key, $value := .Values.exporters.zookeeper.env }}
- name: {{ $key | upper | replace "." "_" }}
value: {{ $value | quote }}
{{- end }}
resources:
{{ toYaml .Values.exporters.zookeeper.resources | indent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if (or .Values.exporters.jmx.enabled (not .Values.persistence.enabled)) }}
volumes:
{{- if .Values.exporters.jmx.enabled }}
- name: config-jmx-exporter
configMap:
name: {{ .Release.Name }}-jmx-exporter
{{- end }}
{{- if not .Values.persistence.enabled }}
- name: zookeeper-data
emptyDir: {}
{{- end }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: zookeeper-data
labels:
app: {{ .Chart.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass }}
spec:
storageClassName: {{ .Values.persistence.storageClass }}
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
selector:
matchLabels:
release: "{{ .Release.Name }}"
{{- end }}