From 6862652744f5d8abd96dae1ddeb25cdc911525cd Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Tue, 21 Jun 2022 09:35:08 +0200 Subject: [PATCH] chore(helm): variable for kafka retention. Signed-off-by: rjshrjndrn --- scripts/helmcharts/openreplay/files/kafka.sh | 5 +++-- scripts/helmcharts/openreplay/templates/job.yaml | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/helmcharts/openreplay/files/kafka.sh b/scripts/helmcharts/openreplay/files/kafka.sh index 61c039601..8f24952f2 100644 --- a/scripts/helmcharts/openreplay/files/kafka.sh +++ b/scripts/helmcharts/openreplay/files/kafka.sh @@ -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 } diff --git a/scripts/helmcharts/openreplay/templates/job.yaml b/scripts/helmcharts/openreplay/templates/job.yaml index 980eab56b..575fd1411 100644 --- a/scripts/helmcharts/openreplay/templates/job.yaml +++ b/scripts/helmcharts/openreplay/templates/job.yaml @@ -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