Skip to content

Commit 9c2b46a

Browse files
authored
Preserve kafka configuration - for 2.14 version (#1581)
1 parent 03768d5 commit 9c2b46a

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

deploy/charts/impt/chart/charts/kafka/templates/statefulset.yaml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,32 @@ spec:
1515
labels:
1616
{{- include "kafka.labels" . | nindent 8 }}
1717
spec:
18+
{{- if .Values.podSecurityContext.enabled }}
19+
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
20+
{{- end }}
1821
serviceAccountName: {{ include "kafka.fullname" . }}
22+
initContainers:
23+
- args:
24+
- -ec
25+
- |
26+
mkdir -p /data-folder/kafka/data
27+
find /data-folder/kafka -type d -exec chown -v 10001 {} +
28+
command:
29+
- /bin/bash
30+
image: "{{ .Values.image.registry }}/{{ if .Values.image.repository }}{{ .Values.image.repository }}/{{ end }}{{ .Values.image.name }}"
31+
imagePullPolicy: {{ .Values.image.pullPolicy }}
32+
name: volume-permissions
33+
resources:
34+
limits:
35+
memory: 100Mi
36+
requests:
37+
cpu: 50m
38+
memory: 100Mi
39+
securityContext:
40+
allowPrivilegeEscalation: false
41+
volumeMounts:
42+
- mountPath: /data-folder
43+
name: kafka-data
1944
containers:
2045
- name: {{ .Chart.Name }}
2146
image: "{{ .Values.image.registry }}/{{ if .Values.image.repository }}{{ .Values.image.repository }}/{{ end }}{{ .Values.image.name }}"
@@ -93,7 +118,7 @@ spec:
93118
- name: KAFKA_SHARE_COORDINATOR_STATE_TOPIC_MIN_ISR
94119
value: "1"
95120
- name: KAFKA_LOG_DIRS
96-
value: '/tmp/kraft-combined-logs'
121+
value: '/var/lib/kafka/data'
97122
- name: KAFKA_SASL_ENABLED_MECHANISMS
98123
value: "PLAIN"
99124
- name: KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL
@@ -120,10 +145,16 @@ spec:
120145
mountPath: /etc/kafka/scripts/
121146
- name: tmp
122147
mountPath: /tmp
148+
- mountPath: /var/lib/kafka/data
149+
name: kafka-data
150+
subPath: kafka/data
123151
volumes:
124152
- name: config
125153
configMap:
126154
name: {{ include "kafka.fullname" . }}
127155
defaultMode: 365
128156
- name: tmp
129157
emptyDir: {}
158+
- name: kafka-data
159+
persistentVolumeClaim:
160+
claimName: data-storage-volume-claim

deploy/charts/impt/chart/charts/kafka/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ serviceAccount:
3131
# If not set and create is true, a name is generated using the fullname template
3232
name: ""
3333

34+
podSecurityContext:
35+
enabled: true
36+
fsGroup: 0
37+
runAsUser: 0
38+
3439
securityContext:
3540
allowPrivilegeEscalation: false
3641
readOnlyRootFilesystem: true

0 commit comments

Comments
 (0)