From 7a5828482dde0dccb351f6e4a2189b3689b87031 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Tue, 9 Jan 2018 08:13:36 +0100 Subject: [PATCH 01/13] Removes explicit topic creation from standard tests which means we get the default number of replicas from broker config for #116 --- kafka/test/kafkacat.yml | 25 ------------------------- kafka/test/produce-consume.yml | 25 ------------------------- 2 files changed, 50 deletions(-) diff --git a/kafka/test/kafkacat.yml b/kafka/test/kafkacat.yml index f73735d0..b1cc0008 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -62,31 +62,6 @@ data: exit 0 --- -apiVersion: batch/v1 -kind: Job -metadata: - name: topic-test-kafkacat - namespace: test-kafka -spec: - template: - spec: - containers: - - name: topic-create - image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d - command: - - ./bin/kafka-topics.sh - - --zookeeper - - zookeeper.kafka.svc.cluster.local:2181 - - --create - - --if-not-exists - - --topic - - test-kafkacat - - --partitions - - "1" - - --replication-factor - - "2" - restartPolicy: Never ---- apiVersion: apps/v1beta2 kind: ReplicaSet metadata: diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index 4b1435b4..385278ea 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -45,31 +45,6 @@ data: exit 0 --- -apiVersion: batch/v1 -kind: Job -metadata: - name: topic-test-produce-consume - namespace: test-kafka -spec: - template: - spec: - containers: - - name: topic-create - image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d - command: - - ./bin/kafka-topics.sh - - --zookeeper - - zookeeper.kafka.svc.cluster.local:2181 - - --create - - --if-not-exists - - --topic - - test-produce-consume - - --partitions - - "1" - - --replication-factor - - "2" - restartPolicy: Never ---- apiVersion: apps/v1beta2 kind: ReplicaSet metadata: From e50b8eaaf1050bae3639367c91b280e189122301 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Tue, 9 Jan 2018 08:30:01 +0100 Subject: [PATCH 02/13] Displays topic ReplicationFactor etc at producer start --- kafka/test/produce-consume.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index 385278ea..f3a9961e 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -80,6 +80,8 @@ spec: - > echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp ; + ./bin/kafka-topics.sh --zookeeper zookeeper.kafka:2181 --describe --topic test-produce-consume + ; tail -f /shared/produce.tmp | ./bin/kafka-console-producer.sh --broker-list $BOOTSTRAP --topic test-produce-consume ; From e0596905822070c7472428e8482e9633cc851f9b Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Tue, 9 Jan 2018 08:34:34 +0100 Subject: [PATCH 03/13] Makes producer acks configurable by env The suggested -1 is equivalent to "all", see https://kafka.apache.org/documentation/#producerconfigs --- kafka/test/produce-consume.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index f3a9961e..d0632ab6 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -74,6 +74,9 @@ spec: env: - name: BOOTSTRAP value: bootstrap.kafka:9092 + - name: ACKS + # -1 means use brokers' min.insync.replicas + value: "-1" command: - /bin/bash - -cex @@ -83,7 +86,7 @@ spec: ./bin/kafka-topics.sh --zookeeper zookeeper.kafka:2181 --describe --topic test-produce-consume ; tail -f /shared/produce.tmp | - ./bin/kafka-console-producer.sh --broker-list $BOOTSTRAP --topic test-produce-consume + ./bin/kafka-console-producer.sh --broker-list $BOOTSTRAP --topic test-produce-consume --producer-property "acks=$ACKS" ; volumeMounts: - name: config From 2f33b8ee2050880aeeb73dc22b12ab2341372616 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 10:02:43 +0100 Subject: [PATCH 04/13] Revert "Removes explicit topic creation from standard tests" because we'll merge https://github.com/Yolean/kubernetes-kafka/pull/221 This reverts commit 7a5828482dde0dccb351f6e4a2189b3689b87031. --- kafka/test/kafkacat.yml | 25 +++++++++++++++++++++++++ kafka/test/produce-consume.yml | 25 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/kafka/test/kafkacat.yml b/kafka/test/kafkacat.yml index b1cc0008..f73735d0 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -62,6 +62,31 @@ data: exit 0 --- +apiVersion: batch/v1 +kind: Job +metadata: + name: topic-test-kafkacat + namespace: test-kafka +spec: + template: + spec: + containers: + - name: topic-create + image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + command: + - ./bin/kafka-topics.sh + - --zookeeper + - zookeeper.kafka.svc.cluster.local:2181 + - --create + - --if-not-exists + - --topic + - test-kafkacat + - --partitions + - "1" + - --replication-factor + - "2" + restartPolicy: Never +--- apiVersion: apps/v1beta2 kind: ReplicaSet metadata: diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index d0632ab6..474ab54b 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -45,6 +45,31 @@ data: exit 0 --- +apiVersion: batch/v1 +kind: Job +metadata: + name: topic-test-produce-consume + namespace: test-kafka +spec: + template: + spec: + containers: + - name: topic-create + image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + command: + - ./bin/kafka-topics.sh + - --zookeeper + - zookeeper.kafka.svc.cluster.local:2181 + - --create + - --if-not-exists + - --topic + - test-produce-consume + - --partitions + - "1" + - --replication-factor + - "2" + restartPolicy: Never +--- apiVersion: apps/v1beta2 kind: ReplicaSet metadata: From 3e6c64e46231b77c89dc5239dd1ca18aa3568956 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 10:09:05 +0100 Subject: [PATCH 05/13] Prepares tests for v5.0 --- kafka/test/kafkacat.yml | 2 +- kafka/test/produce-consume.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kafka/test/kafkacat.yml b/kafka/test/kafkacat.yml index f73735d0..78370890 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -72,7 +72,7 @@ spec: spec: containers: - name: topic-create - image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + image: solsson/kafka:2.1.0@sha256:ac3f06d87d45c7be727863f31e79fbfdcb9c610b51ba9cf03c75a95d602f15e1 command: - ./bin/kafka-topics.sh - --zookeeper diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index 474ab54b..ec4b8bcd 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -55,7 +55,7 @@ spec: spec: containers: - name: topic-create - image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + image: solsson/kafka:2.1.0@sha256:ac3f06d87d45c7be727863f31e79fbfdcb9c610b51ba9cf03c75a95d602f15e1 command: - ./bin/kafka-topics.sh - --zookeeper @@ -95,7 +95,7 @@ spec: spec: containers: - name: producer - image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + image: solsson/kafka:2.1.0@sha256:ac3f06d87d45c7be727863f31e79fbfdcb9c610b51ba9cf03c75a95d602f15e1 env: - name: BOOTSTRAP value: bootstrap.kafka:9092 @@ -119,7 +119,7 @@ spec: - name: shared mountPath: /shared - name: consumer - image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d + image: solsson/kafka:2.1.0@sha256:ac3f06d87d45c7be727863f31e79fbfdcb9c610b51ba9cf03c75a95d602f15e1 env: - name: BOOTSTRAP value: bootstrap.kafka:9092 From 5a338f2aa26d2d675403687ad046938ab0955ca7 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 10:09:44 +0100 Subject: [PATCH 06/13] Uses kafkacat with librdkafka 1.0.0-RC3 in tests --- kafka/test/kafkacat.yml | 6 +++--- kafka/test/produce-consume.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kafka/test/kafkacat.yml b/kafka/test/kafkacat.yml index 78370890..a2c29166 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -112,7 +112,7 @@ spec: spec: containers: - name: producer - image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 + image: solsson/kafkacat@sha256:7a5961f861ddad53c25227511b9f36a5c13bc43296470b383be2f3e8e3a506f4 env: - name: BOOTSTRAP value: bootstrap.kafka:9092 @@ -131,7 +131,7 @@ spec: - name: shared mountPath: /shared - name: consumer - image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 + image: solsson/kafkacat@sha256:7a5961f861ddad53c25227511b9f36a5c13bc43296470b383be2f3e8e3a506f4 env: - name: BOOTSTRAP value: bootstrap.kafka:9092 @@ -148,7 +148,7 @@ spec: - name: shared mountPath: /shared - name: testcase - image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 + image: solsson/kafkacat@sha256:7a5961f861ddad53c25227511b9f36a5c13bc43296470b383be2f3e8e3a506f4 env: - name: BOOTSTRAP value: bootstrap.kafka:9092 diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index ec4b8bcd..c956bcac 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -136,7 +136,7 @@ spec: - name: shared mountPath: /shared - name: testcase - image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef + image: solsson/kafkacat@sha256:7a5961f861ddad53c25227511b9f36a5c13bc43296470b383be2f3e8e3a506f4 env: - name: BOOTSTRAP value: bootstrap.kafka:9092 From 09aec3b8fec8d01f11ff9ba218e0e6ed3892e084 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 10:13:47 +0100 Subject: [PATCH 07/13] Uses min.insync.replicas for the kafkacat producer as well --- kafka/test/kafkacat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kafka/test/kafkacat.yml b/kafka/test/kafkacat.yml index a2c29166..9604127a 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -123,7 +123,7 @@ spec: echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp ; tail -f /shared/produce.tmp | - kafkacat -P -b $BOOTSTRAP -t test-kafkacat -v -T -d broker -K ':' + kafkacat -P -b $BOOTSTRAP -t test-kafkacat -v -T -d broker -K ':' -X request.required.acks=-1 ; volumeMounts: - name: config From aaf0d35703b418bccd01c9e22aa732c81dfa2052 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 13:31:16 +0100 Subject: [PATCH 08/13] Resource limits for topic creation, based on #221 --- kafka/test/kafkacat.yml | 4 ++++ kafka/test/produce-consume.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/kafka/test/kafkacat.yml b/kafka/test/kafkacat.yml index 9604127a..2253cc2f 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -85,6 +85,10 @@ spec: - "1" - --replication-factor - "2" + resources: + limits: + cpu: 200m + memory: 100Mi restartPolicy: Never --- apiVersion: apps/v1beta2 diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index c956bcac..97fc4263 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -68,6 +68,10 @@ spec: - "1" - --replication-factor - "2" + resources: + limits: + cpu: 200m + memory: 100Mi restartPolicy: Never --- apiVersion: apps/v1beta2 From 7dd078d9f998d48b11e2345a072e9482bc57f7ea Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 10:24:49 +0100 Subject: [PATCH 09/13] Caps resource usage for tests --- kafka/test/produce-consume.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index 97fc4263..6ca560b8 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -117,6 +117,10 @@ spec: tail -f /shared/produce.tmp | ./bin/kafka-console-producer.sh --broker-list $BOOTSTRAP --topic test-produce-consume --producer-property "acks=$ACKS" ; + resources: + limits: + cpu: 100m + memory: 100Mi volumeMounts: - name: config mountPath: /test @@ -134,6 +138,10 @@ spec: ./bin/kafka-console-consumer.sh --bootstrap-server $BOOTSTRAP --topic test-produce-consume | tee /shared/consumed.tmp ; + resources: + limits: + cpu: 100m + memory: 100Mi volumeMounts: - name: config mountPath: /test @@ -162,6 +170,10 @@ spec: - /bin/bash - -e - /test/quit-on-nonzero-exit.sh + resources: + limits: + cpu: 100m + memory: 100Mi volumeMounts: - name: config mountPath: /test From 03b1e620a42744fdf9c9fc0bd40cb2ddbd446dbf Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 10:37:38 +0100 Subject: [PATCH 10/13] Increases the test consumer memory limit slightly due to OOMKilled --- kafka/test/produce-consume.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index 6ca560b8..d092f36d 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -141,7 +141,7 @@ spec: resources: limits: cpu: 100m - memory: 100Mi + memory: 120Mi volumeMounts: - name: config mountPath: /test From f5524f242abc43c05b50532a7c541ef8b90fe03b Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 13:33:26 +0100 Subject: [PATCH 11/13] The producer too got OOMKilled at 100Mi --- kafka/test/produce-consume.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index d092f36d..c7654bd9 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -120,7 +120,7 @@ spec: resources: limits: cpu: 100m - memory: 100Mi + memory: 120Mi volumeMounts: - name: config mountPath: /test From c8ef8d55dfb8ddbdde4b957d2bee5090bfac7d50 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 13:34:29 +0100 Subject: [PATCH 12/13] Partition the test topics, a bit --- kafka/test/kafkacat.yml | 2 +- kafka/test/produce-consume.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kafka/test/kafkacat.yml b/kafka/test/kafkacat.yml index 2253cc2f..14dc782d 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -82,7 +82,7 @@ spec: - --topic - test-kafkacat - --partitions - - "1" + - "3" - --replication-factor - "2" resources: diff --git a/kafka/test/produce-consume.yml b/kafka/test/produce-consume.yml index c7654bd9..d9ebf0ee 100644 --- a/kafka/test/produce-consume.yml +++ b/kafka/test/produce-consume.yml @@ -65,7 +65,7 @@ spec: - --topic - test-produce-consume - --partitions - - "1" + - "3" - --replication-factor - "2" resources: From e420fe2a2e6bc0e3e84d130bd4186fbab8f8e44f Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 28 Nov 2018 13:36:01 +0100 Subject: [PATCH 13/13] The kafkacat test now uses the same acks env ad produce-consume --- kafka/test/kafkacat.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kafka/test/kafkacat.yml b/kafka/test/kafkacat.yml index 14dc782d..a17d3be0 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -120,6 +120,9 @@ spec: env: - name: BOOTSTRAP value: bootstrap.kafka:9092 + - name: ACKS + # -1 means use brokers' min.insync.replicas + value: "-1" command: - /bin/bash - -cex @@ -127,7 +130,7 @@ spec: echo "--- start $HOSTNAME $(date --iso-8601='ns' -u) ---" >> /shared/produce.tmp ; tail -f /shared/produce.tmp | - kafkacat -P -b $BOOTSTRAP -t test-kafkacat -v -T -d broker -K ':' -X request.required.acks=-1 + kafkacat -P -b $BOOTSTRAP -t test-kafkacat -v -T -d broker -K ':' -X request.required.acks=$ACKS ; volumeMounts: - name: config