chore(helm): kafka db upgrade
Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>
This commit is contained in:
parent
6bb87ffaa8
commit
8e47849275
4 changed files with 55 additions and 1 deletions
|
|
@ -1 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
topics=(
|
||||
"raw"
|
||||
"raw-ios"
|
||||
"trigger"
|
||||
"cache"
|
||||
"analytics"
|
||||
)
|
||||
|
||||
touch /tmp/config.txt
|
||||
|
||||
if [[ $KAFKA_SSL == "true" ]]; then
|
||||
echo 'securty.protocol=SSL' > /tmp/config.txt
|
||||
fi
|
||||
|
||||
function init() {
|
||||
echo "Initializing kafka"
|
||||
for topic in ${topics[*]}; do
|
||||
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=3456000000 --entity-name=${topic} --command-config /tmp/config.txt || true
|
||||
done
|
||||
}
|
||||
|
||||
# /bin/bash kafka.sh migrate $migration_versions
|
||||
case "$1" in
|
||||
migrate)
|
||||
init
|
||||
;;
|
||||
init)
|
||||
init
|
||||
;;
|
||||
*)
|
||||
echo "Unknown operation for kafka migration; exiting."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -93,13 +93,19 @@ spec:
|
|||
- name: kafka
|
||||
image: bitnami/kafka:2.6.0-debian-10-r30
|
||||
env:
|
||||
- name: KAFKA_HOST
|
||||
value: "{{ .Values.kafka.kafkaHost }}"
|
||||
- name: KAFKA_PORT
|
||||
value: "{{ .Values.kafka.kafkaPort }}"
|
||||
- name: KAFKA_SSL
|
||||
value: "{{ .Values.kafka.kafkaUseSsl }}"
|
||||
- name: PREVIOUS_APP_VERSION
|
||||
value: "{{ .Values.fromVersion }}"
|
||||
- name: CHART_APP_VERSION
|
||||
value: "{{ .Chart.AppVersion }}"
|
||||
command:
|
||||
- /bin/bash
|
||||
- /opt/migration.sh
|
||||
- /opt/migrations/dbops.sh
|
||||
- "{{ .Release.IsUpgrade }}"
|
||||
- kafka
|
||||
volumeMounts:
|
||||
|
|
|
|||
|
|
@ -124,3 +124,6 @@ minio:
|
|||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
|
||||
kafka:
|
||||
fullnameOverride: kafka
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@ postgresql:
|
|||
postgresqlUser: "postgres"
|
||||
postgresqlDatabase: "postgres"
|
||||
|
||||
kafka:
|
||||
kafkaHost: "kafka.db.svc.cluster.local"
|
||||
kafkaPort: "9092"
|
||||
kafkaUseSsl: "false"
|
||||
|
||||
minio:
|
||||
global:
|
||||
minio:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue