From 4cef9bcc8c6ed5da0f5d5d41fe167fd13311793d Mon Sep 17 00:00:00 2001 From: Siddharth Rawat Date: Fri, 10 Nov 2023 16:19:59 -0500 Subject: [PATCH] feat: add provisioner logic to kafka dependency chart This block creates the `healthcheck` topic with 3 partitions. --- .releaserc | 4 ++++ Jenkinsfile | 1 + README.md | 34 ++++++++++++++++++++++++++++++++++ values.yaml | 11 +++++++++++ 4 files changed, 50 insertions(+) diff --git a/.releaserc b/.releaserc index a2222c9..49c3d61 100644 --- a/.releaserc +++ b/.releaserc @@ -42,6 +42,10 @@ { "path": "@semantic-release/changelog", "changelogFile": "CHANGELOG.md" + }, + "@semantic-release/exec", + { + "prepareCmd": "git push --tags" } ], "publish": "@semantic-release/github", diff --git a/Jenkinsfile b/Jenkinsfile index 076894c..c1d0cd0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,6 +23,7 @@ pipeline { npm install semantic-release-helm npm install @semantic-release/git npm install @semantic-release/github + npm install @semantic-release/exec npx semantic-release ''' } diff --git a/README.md b/README.md index 6f74704..95ff0db 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,17 @@ kafka: size: 1Gi serviceAccount: create: false + provisioning: + enabled: true + numPartitions: 3 + replicationFactor: 1 + topics: + - name: healthcheck + partitions: 3 + replicationFactor: 1 + config: + max.message.bytes: 64000 + flush.messages: 1 kraft: enabled: false zookeeper: @@ -50,3 +61,26 @@ kafka: persistence: size: 1Gi ``` + +- In order to check the number of partitions created for a particular topic: + +```bash +kubectl exec -it -- /bin/bash +# run the following commands once you're inside the pod: +cd /opt/bitnami/kafka/bin/ +kafka-topics.sh --describe --bootstrap-server \ + : \ + --topic +# kafka-topics.sh --describe --bootstrap-server \ +# infra-helm-release-kafka-broker-1.infra-helm-release-kafka-broker-headless.webapp.svc.cluster.local:9094 \ +# --topic healthcheck +``` + +You should see an output similar to the one shown below: + +``` output +Topic: healthcheck TopicId: YcLqdlRVR6yF4kvdf6eXwg PartitionCount: 3 ReplicationFactor: 1 Configs: flush.messages=1,max.message.bytes=64000 + Topic: healthcheck Partition: 0 Leader: 102 Replicas: 102 Isr: 102 + Topic: healthcheck Partition: 1 Leader: 101 Replicas: 101 Isr: 101 + Topic: healthcheck Partition: 2 Leader: 100 Replicas: 100 Isr: 100 +``` diff --git a/values.yaml b/values.yaml index 55dc870..91f2a73 100644 --- a/values.yaml +++ b/values.yaml @@ -125,6 +125,17 @@ kafka: create: false # rbac: # create: true + provisioning: + enabled: true + numPartitions: 3 + replicationFactor: 1 + topics: + - name: healthcheck + partitions: 3 + replicationFactor: 1 + config: + max.message.bytes: 64000 + flush.messages: 1 kraft: enabled: false zookeeper: