chore(helm): variable for kafka retention.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
rjshrjndrn 2022-06-21 09:35:08 +02:00
parent 67b83deddb
commit 6862652744
2 changed files with 5 additions and 2 deletions

View file

@ -1,7 +1,8 @@
#!/bin/bash
set -e
# Default to 4 days.
RETENTION_TIME=${RETENTION_TIME:-345600000}
topics=(
"raw"
"raw-ios"
@ -22,7 +23,7 @@ function init() {
echo "Creating topic: $topic"
# TODO: Have to check an idempotent way of creating topics.
kafka-topics.sh --create --bootstrap-server ${KAFKA_HOST}:${KAFKA_PORT} --replication-factor 2 --partitions 16 --topic ${topic} --command-config /tmp/config.txt || true
kafka-configs.sh --bootstrap-server ${KAFKA_HOST}:${KAFKA_PORT} --entity-type topics --alter --add-config retention.ms=345600000 --entity-name=${topic} --command-config /tmp/config.txt || true
kafka-configs.sh --bootstrap-server ${KAFKA_HOST}:${KAFKA_PORT} --entity-type topics --alter --add-config retention.ms=${RETENTION_TIME} --entity-name=${topic} --command-config /tmp/config.txt || true
done
}

View file

@ -145,6 +145,8 @@ spec:
- name: kafka
image: bitnami/kafka:2.6.0-debian-10-r30
env:
- name: RETENTION_TIME
value: "{{ .Values.global.kafka.retentionTime }}"
- name: KAFKA_HOST
value: "{{ .Values.global.kafka.kafkaHost }}"
- name: KAFKA_PORT