From fd404a2ef329fc2ad741184972595a66e5034020 Mon Sep 17 00:00:00 2001 From: ljupcovangelski Date: Fri, 12 Aug 2022 13:14:19 +0200 Subject: [PATCH] [#3575] Fix Kafka topics provisioning --- VERSION | 2 +- docs/docs/changelog.md | 14 +++++++++ .../templates/provisioning/job-kafka.yaml | 2 +- .../provisioning/kafka-create-topics.yaml | 31 ++++++++++--------- .../co/airy/tools/topics/Application.java | 3 +- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/VERSION b/VERSION index fc7f502dba..1c0069e4d9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.47.3 +0.47.4 diff --git a/docs/docs/changelog.md b/docs/docs/changelog.md index 078244ff16..1060eaf5d4 100644 --- a/docs/docs/changelog.md +++ b/docs/docs/changelog.md @@ -3,6 +3,20 @@ title: Changelog sidebar_label: 📝 Changelog --- +## 0.47.4 + +#### Hotfix + +* [[#3575](https://github.com/airyhq/airy/issues/3575)] Fix Kafka topics provisioning + +#### Airy CLI + +You can download the Airy CLI for your operating system from the following links: + +[MacOS](https://airy-core-binaries.s3.amazonaws.com/0.47.4/darwin/amd64/airy) +[Linux](https://airy-core-binaries.s3.amazonaws.com/0.47.4/linux/amd64/airy) +[Windows](https://airy-core-binaries.s3.amazonaws.com/0.47.4/windows/amd64/airy.exe) + ## 0.47.3 #### Hotfix diff --git a/infrastructure/helm-chart/templates/provisioning/job-kafka.yaml b/infrastructure/helm-chart/templates/provisioning/job-kafka.yaml index df740ca7e4..023587bb7f 100644 --- a/infrastructure/helm-chart/templates/provisioning/job-kafka.yaml +++ b/infrastructure/helm-chart/templates/provisioning/job-kafka.yaml @@ -10,7 +10,7 @@ spec: containers: - name: create-topics image: "{{ .Values.provisioning.kafka.image }}:{{ .Values.provisioning.kafka.imageTag }}" - command: ["/bin/sh", "/opt/provisioning/create-topics.sh"] + command: ["/bin/bash", "/opt/provisioning/create-topics.sh"] envFrom: - configMapRef: name: kafka-config diff --git a/infrastructure/helm-chart/templates/provisioning/kafka-create-topics.yaml b/infrastructure/helm-chart/templates/provisioning/kafka-create-topics.yaml index 66cfadfd35..5990908759 100644 --- a/infrastructure/helm-chart/templates/provisioning/kafka-create-topics.yaml +++ b/infrastructure/helm-chart/templates/provisioning/kafka-create-topics.yaml @@ -28,6 +28,7 @@ data: PARTITIONS=${PARTITIONS:-10} REPLICAS=${KAFKA_MINIMUM_REPLICAS:-1} AIRY_CORE_NAMESPACE=${AIRY_CORE_NAMESPACE:-} + AUTH_JAAS=${AUTH_JAAS:-} echo "Creating Kafka topics" @@ -51,33 +52,33 @@ data: - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.channels" + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.channels" - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.contacts" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.contacts" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.messages" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.messages" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.metadata" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.metadata" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.read-receipt" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.read-receipt" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.sources" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.sources" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.tags" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.tags" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.templates" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.templates" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.users" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.users" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.webhooks-v0.29.0" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}application.communication.webhooks-v0.29.0" --config cleanup.policy=compact min.compaction.lag.ms=86400000 segment.bytes=10485760 - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}ops.application.logs" + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}ops.application.logs" - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}source.facebook.events" + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}source.facebook.events" - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}source.google.events" + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}source.google.events" - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}source.twilio.events" + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}source.twilio.events" - kafka-topics.sh --create --if-not-exists --zookeeper "${ZOOKEEPER}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}source.viber.events" + kafka-topics.sh --create --if-not-exists "${CONNECTION_OPTS[@]}" --replication-factor "${REPLICAS}" --partitions "${PARTITIONS}" --topic "${AIRY_CORE_NAMESPACE}source.viber.events" diff --git a/infrastructure/tools/topics/src/main/java/co/airy/tools/topics/Application.java b/infrastructure/tools/topics/src/main/java/co/airy/tools/topics/Application.java index 57c99bb858..7dd09f5d7a 100644 --- a/infrastructure/tools/topics/src/main/java/co/airy/tools/topics/Application.java +++ b/infrastructure/tools/topics/src/main/java/co/airy/tools/topics/Application.java @@ -12,7 +12,7 @@ public class Application { public static void main(String[] args) { - String createTopicTemplate = " kafka-topics.sh --create --if-not-exists --zookeeper \"${ZOOKEEPER}\" --replication-factor \"${REPLICAS}\" --partitions \"${PARTITIONS}\" --topic \"${AIRY_CORE_NAMESPACE}%s\" %s"; + String createTopicTemplate = " kafka-topics.sh --create --if-not-exists \"${CONNECTION_OPTS[@]}\" --replication-factor \"${REPLICAS}\" --partitions \"${PARTITIONS}\" --topic \"${AIRY_CORE_NAMESPACE}%s\" %s"; String headerTemplate = "apiVersion: v1" + "\n" + "kind: ConfigMap" + @@ -53,6 +53,7 @@ public static void main(String[] args) { " PARTITIONS=${PARTITIONS:-10}\n" + " REPLICAS=${KAFKA_MINIMUM_REPLICAS:-1}\n" + " AIRY_CORE_NAMESPACE=${AIRY_CORE_NAMESPACE:-}\n" + + " AUTH_JAAS=${AUTH_JAAS:-}\n" + "\n" + " echo \"Creating Kafka topics\"\n" + "\n" +