This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
kafka-statefulset.yaml
80 lines (80 loc) · 2.44 KB
/
kafka-statefulset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Values.service.name }}
labels:
chart: "{{ .Chart.Name | trunc 63 }}"
chartVersion: "{{ .Chart.Version | trunc 63 }}"
visualize: "true"
app: {{ .Values.service.name }}
spec:
replicas: 1 # keeping a single replica in the stateful set
serviceName: {{.Values.service.name}}
selector:
matchLabels:
app: {{ .Values.service.name }}
template:
metadata:
labels:
app: {{ .Values.service.name }}
visualize: "true"
spec:
tolerations:
- key: kafka
operator: Equal
value: "false"
effect: "NoSchedule"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: role
operator: In
values:
- "kafka"
containers:
- name: kafka
image: {{ .Values.images.kafka }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: KAFKA_MESSAGE_MAX_BYTES
value: "16777216"
- name: KAFKA_REPLICA_FETCH_MAX_BYTES
value: "16777216"
- name: DOCKER_HOST
value: "localhost:2375"
- name: KAFKA_ADVERTISED_HOST_NAME
value: "{{.Values.service.name}}-0.kafka.default.svc.cluster.local"
- name: KAFKA_ZOOKEEPER_CONNECT
value: "{{.Values.service.name}}-zookeeper:{{ .Values.ports.zookeeper }}"
- name: KAFKA_BROKER_ID
value: "1"
- name: KAFKA_PORT
value: "{{ .Values.ports.kafka }}"
- name: KAFKA_ADVERTISED_PORT
value: "{{ .Values.ports.kafka }}"
{{- if eq .Values.ephemeral_storage true }}
- name: KAFKA_LOG_RETENTION_BYTES
value: "134217728"
{{- end }}
ports:
- containerPort: {{ .Values.ports.kafka }}
livenessProbe:
initialDelaySeconds: 60
tcpSocket:
port: {{ .Values.ports.kafka }}
volumeMounts:
- name: kafka-persistent-storage
mountPath: /kafka
subPath: kafka-data
resources:
{{ toYaml .Values.kafkaResources | indent 12 }}
volumes:
- name: kafka-persistent-storage
{{- if eq .Values.ephemeral_storage true }}
emptyDir: {}
{{- else }}
persistentVolumeClaim:
claimName: "{{ .Values.service.name }}-pvc"
{{- end }}