Open bfc5288 opened 3 years ago
I am able to reproduce this, although not locally.
After creating an empty topic sys.new-test
:
$ hop subscribe -s EARLIEST kafka://weave132-969b4a83@kafka.scimma.org/sys.new-test
hop: topic sys.new-test does not exist on the broker, so can't subscribe
kafkacat
gives a slightly different error:
$ kafkacat -F kafkacat-prod.conf -L -t sys.new-test -b kafka.scimma.org
% Reading configuration from file kafkacat-prod.conf Metadata for sys.new-test (from broker -1: sasl_ssl://kafka.scimma.org:9092/bootstrap):
3 brokers:
broker 0 at kb-0.prod.hop.scimma.org:9092
broker 2 at kb-2.prod.hop.scimma.org:9092
broker 1 at kb-1.prod.hop.scimma.org:9092 (controller)
1 topics:
topic "sys.new-test" with 0 partitions: Broker: Topic authorization failed
This appears to acknowledge that the topic exists, but suggests that there is a permissions issue.
There is a READ permission in place:
$ kafka-acls.sh --command-config prod-admin.properties --bootstrap-server kafka.scimma.org:9092 --list --topic sys.new-test
Current ACLs for resource `ResourcePattern(resourceType=TOPIC, name=sys.new-test, patternType=LITERAL)`:
(principal=User:*, host=*, operation=READ, permissionType=ALLOW)
Manually creating an ACL allowing any user to Describe
the topic seems to fix it:
$ kafka-acls.sh --command-config prod-admin.properties --bootstrap-server kafka.scimma.org:9092 --add --topic sys.new-test --allow-principal 'User:*' --resource-pattern-type LITERAL --operation Describe
Adding ACLs for resource `ResourcePattern(resourceType=TOPIC, name=sys.new-test, patternType=LITERAL)`:
(principal=User:*, host=*, operation=DESCRIBE, permissionType=ALLOW)
Current ACLs for resource `ResourcePattern(resourceType=TOPIC, name=sys.new-test, patternType=LITERAL)`:
(principal=User:*, host=*, operation=READ, permissionType=ALLOW)
(principal=User:*, host=*, operation=DESCRIBE, permissionType=ALLOW)
$ kafkacat -F kafkacat-prod.conf -C -t sys.new-test -b kafka.scimma.org
% Reading configuration from file kafkacat-prod.conf
% Reached end of topic sys.new-test [2] at offset 0
% Reached end of topic sys.new-test [1] at offset 0
% Reached end of topic sys.new-test [0] at offset 0
% Reached end of topic sys.new-test [5] at offset 0
% Reached end of topic sys.new-test [8] at offset 0
% Reached end of topic sys.new-test [11] at offset 0
% Reached end of topic sys.new-test [14] at offset 0
% Reached end of topic sys.new-test [4] at offset 0
% Reached end of topic sys.new-test [7] at offset 0
% Reached end of topic sys.new-test [10] at offset 0
% Reached end of topic sys.new-test [13] at offset 0
% Reached end of topic sys.new-test [3] at offset 0
% Reached end of topic sys.new-test [6] at offset 0
% Reached end of topic sys.new-test [9] at offset 0
% Reached end of topic sys.new-test [12] at offset 0
% Reached end of topic sys.new-test [15] at offset 0
^C
$ hop subscribe -s EARLIEST kafka://weave132-969b4a83@kafka.scimma.org/sys.new-test
$ echo $?
0
It is unclear why publishing a message into the topic works around this, but it looks like at a minimum hop-creds-sync
should be creating Describe
ACLs, at least for public topics, and possibly to match each non-All
ACL for individual users/non-public topics.
EDIT: The snews-alert-test
topic was not public, so this is not only an issue for public topics and Describe
permissions should be added for per-user permissions on non-public topics.
Description
There appears to be a bug when attempting to use
hop subscribe
to read from a topic without any messages. Thehop-client
fails due toValueError: topic <topic.name> does not exist on the broker, so can't subscribe
, even when the topic has been synced and is recognized by kafka.Example:
After waiting for the topic
snews.alert-test
to be synced (updateScram: creating topic: snews.alert-test
), the topic is recognized by Kafka (viakafka-topics.sh --list
), but thehop-client
cannot subscribe to the topic:Note that using
hop publish
to this topic succeeds, after which the abovehop subscribe
command works as expected.