From e78f1c5e60bb0494cd12d931577a447aa4dedc3c Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 1 Feb 2018 18:51:37 +0100 Subject: Should be larger than or equal min.insync.replicas --- kafka/10broker-config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/kafka/10broker-config.yml b/kafka/10broker-config.yml index 1fe67c0..1d57641 100644 --- a/kafka/10broker-config.yml +++ b/kafka/10broker-config.yml @@ -57,6 +57,7 @@ data: num.partitions=1 default.replication.factor=3 + offsets.topic.replication.factor=3 min.insync.replicas=2 -- cgit v1.2.3 From 321189a9402944b0082d7ffaf15ef419017ea10b Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 1 Feb 2018 19:37:35 +0100 Subject: Reverts previous commit and uses the documented default instead --- kafka/10broker-config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kafka/10broker-config.yml b/kafka/10broker-config.yml index 1d57641..f3450f6 100644 --- a/kafka/10broker-config.yml +++ b/kafka/10broker-config.yml @@ -57,7 +57,6 @@ data: num.partitions=1 default.replication.factor=3 - offsets.topic.replication.factor=3 min.insync.replicas=2 @@ -114,7 +113,7 @@ data: ############################# Internal Topic Settings ############################# # The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state" # For anything other than development testing, a value greater than 1 is recommended for to ensure availability such as 3. - offsets.topic.replication.factor=1 + #offsets.topic.replication.factor=1 transaction.state.log.replication.factor=1 transaction.state.log.min.isr=1 -- cgit v1.2.3 From 7017fc07a1fef113e9494247ad94dbe07d64f4a3 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Fri, 2 Feb 2018 08:02:03 +0100 Subject: These properties have good defaults, 3 and 2 respectively, which match the default.replication.factor and min.insync.replicas that we've changed to now. --- kafka/10broker-config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kafka/10broker-config.yml b/kafka/10broker-config.yml index f3450f6..debfda1 100644 --- a/kafka/10broker-config.yml +++ b/kafka/10broker-config.yml @@ -114,8 +114,8 @@ data: # The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state" # For anything other than development testing, a value greater than 1 is recommended for to ensure availability such as 3. #offsets.topic.replication.factor=1 - transaction.state.log.replication.factor=1 - transaction.state.log.min.isr=1 + #transaction.state.log.replication.factor=1 + #transaction.state.log.min.isr=1 ############################# Log Flush Policy ############################# -- cgit v1.2.3 From e5046b197ecd88041fa71ea45bdfdb488e630d7c Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Fri, 2 Feb 2018 10:26:51 +0100 Subject: Updates the basic kafkacat test to use a consumer group of size 1 --- 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 98410bc..fe1c396 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -91,6 +91,7 @@ metadata: name: kafkacat namespace: test-kafka spec: + # Note that this test sets a consumer group, but asserts assume that the tests gets its own messages replicas: 1 selector: matchLabels: @@ -133,11 +134,13 @@ spec: env: - name: BOOTSTRAP value: bootstrap.kafka:9092 + - name: CONSUMER_GROUP_ID + value: test-kafkacat-group command: - /bin/bash - -cex - > - kafkacat -C -b $BOOTSTRAP -t test-kafkacat -o -1 -f '%T;%k:%p;%o;%s\n' -u -d broker | + kafkacat -b $BOOTSTRAP -G $CONSUMER_GROUP_ID test-kafkacat -o -1 -f '%T;%k:%p;%o;%s\n' -u -d broker | tee /shared/consumed.tmp ; volumeMounts: -- cgit v1.2.3 From e784bcac75881cb3e9e9c2d94cb5de4099633090 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Fri, 2 Feb 2018 11:15:04 +0100 Subject: Adds a console based way to check for topics configured with 1 replica --- kafka/test/replication-config.yml | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 kafka/test/replication-config.yml diff --git a/kafka/test/replication-config.yml b/kafka/test/replication-config.yml new file mode 100644 index 0000000..abaea49 --- /dev/null +++ b/kafka/test/replication-config.yml @@ -0,0 +1,98 @@ +# https://github.com/Yolean/kubernetes-kafka/pull/140 +--- +kind: ConfigMap +metadata: + name: replication-config + namespace: test-kafka +apiVersion: v1 +data: + + setup.sh: |- + touch /tmp/testlog + + tail -f /tmp/testlog + + test.sh: |- + exec >> /tmp/testlog + exec 2>&1 + set -e + + kafkacat -L -b $BOOTSTRAP > /tmp/metadata + BROKERS=$(cat /tmp/metadata | grep -E ' [0-9]+ brokers:' | awk '{print $1}') + if (( $BROKERS == 1 )); then + echo "Only one broker; no need to check for >1 replication config." + exit 0 + fi + + WITH_TWO_OR_MORE=$(cat /tmp/metadata | grep -E ' replicas: [0-9]+,[0-9]+' | wc -l) + WITH_ONE=$(cat /tmp/metadata | grep -E ' replicas: [0-9]+, ' | wc -l) + if (( $WITH_TWO_OR_MORE == 0 )); then + echo "No partitions have >1 replica, so this is probably normal." + exit 0 + fi + + if (( $WITH_ONE > $MAX_SINGLE_REPLICA_PARTITIONS )); then + echo "$(date --iso-8601='ns') There are $WITH_ONE partitions with only one replica. Alerts for under-replicated partitions won't catch that." + exit 10 + fi + + echo "$(date --iso-8601='ns') $WITH_ONE partitions have one replica and WITH_TWO_OR_MORE have more" + exit 0 + + quit-on-nonzero-exit.sh: |- + exec >> /tmp/testlog + exec 2>&1 + + exit 0 +--- +apiVersion: apps/v1beta2 +kind: ReplicaSet +metadata: + name: replication-config + namespace: test-kafka +spec: + # Note that this test sets a consumer group, but asserts assume that the tests gets its own messages + replicas: 1 + selector: + matchLabels: + test-target: kafka-replication-config + test-type: readiness + template: + metadata: + labels: + test-target: kafka-replication-config + test-type: readiness + spec: + containers: + - name: testcase + image: solsson/kafkacat@sha256:b32eedf936f3cde44cd164ddc77dfcf7565a8af4e357ff6de1abe4389ca530c9 + env: + - name: BOOTSTRAP + value: bootstrap.kafka:9092 + - name: MAX_SINGLE_REPLICA_PARTITIONS + value: "0" + command: + - /bin/bash + - -e + - /test/setup.sh + readinessProbe: + exec: + command: + - /bin/bash + - -e + - /test/test.sh + initialDelaySeconds: 30 + periodSeconds: 60 + livenessProbe: + exec: + command: + - /bin/bash + - -e + - /test/quit-on-nonzero-exit.sh + volumeMounts: + - name: config + mountPath: /test + volumes: + - name: config + configMap: + name: replication-config -- cgit v1.2.3 From dc7734ac6e1668552dc862b760282b0032ec1bb2 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Fri, 2 Feb 2018 12:22:38 +0100 Subject: Removes outdated comment; these tests can't grow more complex --- kafka/test/kafkacat.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/kafka/test/kafkacat.yml b/kafka/test/kafkacat.yml index fe1c396..d3c2766 100644 --- a/kafka/test/kafkacat.yml +++ b/kafka/test/kafkacat.yml @@ -102,12 +102,6 @@ spec: labels: test-target: kafka-client-kafkacat test-type: readiness - # for example: - # readonly - can be used in production - # isolated - read/write but in a manner that does not affect other services - # load - unsuitable for production because it uses significant resources - # chaos - unsuitable for production because it injects failure modes - #test-use: spec: containers: - name: producer -- cgit v1.2.3 From 77cdb3643a268abf98e9b9859218bebb08283b14 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Fri, 2 Feb 2018 13:25:23 +0100 Subject: Bumps kafka-manager to 1.3.3.16 --- yahoo-kafka-manager/kafka-manager.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yahoo-kafka-manager/kafka-manager.yml b/yahoo-kafka-manager/kafka-manager.yml index 77319e4..e176981 100644 --- a/yahoo-kafka-manager/kafka-manager.yml +++ b/yahoo-kafka-manager/kafka-manager.yml @@ -15,7 +15,7 @@ spec: spec: containers: - name: kafka-manager - image: solsson/kafka-manager@sha256:e07b5c50b02c761b3471ebb62ede88afc0625e325fe428316e32fec7f227ff9b + image: solsson/kafka-manager@sha256:5db7d54cdb642ec5a92f37a869fdcf2aa479b2552e900b2d2b83b38a1806c2de ports: - containerPort: 80 env: -- cgit v1.2.3