Skip to content

kafka_source on kafka-in, certified; the kcat source becomes the Kerberos route (ADR-0044 step 3c, part 2) - #117

Merged
cpoder merged 6 commits into
masterfrom
feat/kafka-source-certified
Dec 5, 2026
Merged

cpoder merged 6 commits into
masterfrom
feat/kafka-source-certified

Conversation

@cpoder

@cpoder cpoder commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

ADR-0044 step 3c, part 2: §7, "Admission", for the source.

The kafka_source recipe on kafka-in

  • docs/examples/connectors/kafka_source is a manifest on kafka-in: SASL over TLS, SCRAM-SHA-256, USERNAME and PASSWORD as secret().
  • broker.sh runs one Apache Kafka node (the official image, apache/kafka:4.4.0) through a new helper, e2e/admission/brokers/kafka.sh, and makes the topic in three partitions. dataflow.sh writes one record with the broker's console producer and waits for the fixture's shape on vx.kafka.orders.in.
  • The admission points BROKERS at that broker and SECURITY at SASL_PLAINTEXT (no TLS in the stage), seeds the test user as the two secrets, and requires a green probe before the data flow. EXCEPTION.md goes. The recipe dir and its helper are one commit.

The kcat route for Kerberos

  • The kcat source example leaves the catalog for docs/examples/kafka-kerberos: kafka_orders_p0.vjs.example (one partition a manifest, -p 0, its own OFFSET_KV) and kcat-source.sh.

  • kcat-source.sh starts kcat. When the command pins no partition with -p, it counts the topic's partitions with kcat -L and the command's own -b, -X and -F, and refuses on more than one. The refusal goes to the runtime's log at each start, exit code 2:

    kcat-source.sh: refused: topic orders has 3 partitions and the command pins none with -p. The exec driver keeps one offset for the command (OFFSET_KV), and one offset for several partitions would skip or repeat records in silence. Write one manifest per partition, each with its -p and its own OFFSET_KV.
    
  • The exec drivers do not change. The book gets a page, Exec bridges, which holds the route.

  • e2e/kafka.sh phase 9 runs the route through exec-stream-source against the broker. A pinned partition and a topic of one partition reach the bus with their commits. The command without -p on three partitions is refused at each start, puts nothing on the bus and commits nothing. No kcat outlives the runtime. The CI job installs the distribution's kcat.

A finding on the way: sh -c and dash

The exec drivers run CMD with sh -c. On Debian and Ubuntu, sh is dash, which runs the command as a child instead of becoming it. The driver's child.kill() then kills sh, and the program goes on running. Phase 9 caught it: two kcat processes outlived the runtime's stop. The example's CMD now starts with exec, and the page says to do so for a long-running command. The drivers stay as they are in this PR, as the brief asks.

A probe on a new bus

Phase 8 now also probes a unit on a bus where no unit ever ran, so VEJAS_OFFSETS does not exist. The probe says "not committed yet" for the 4 partitions and makes no bucket. The real error text is failed to get the bucket: jetstream error: stream not found (code 404, error code 10059). A mutant of the contains("not found") match fails this check with that text.

Tests

  • Admission, locally, on a debug runtime: kafka_source and mqtt_source admitted. A mutant subject in the manifest fails the data flow (the record never reached vx.kafka.orders.in).
  • The probe of the recipe on its broker: 127.0.0.1:55557 (SaslPlaintext SCRAM-SHA-256): topic orders, 3 partitions. Partition 0: offset 0 committed, within the log (start 0, high watermark 0), 0 behind…
  • Phases 8 and 9 on Apache Kafka 4.4.0, locally: all checks pass.
  • CI on a8ff9da: e2e/kafka.sh passes with 84 checks on 4.4.0 and on 3.7.2 (77 before). The admission admits all 21 recipes, kafka_source in 19 s with the broker's start. The first run failed phase 9 on both versions: the runners resolve localhost to ::1 first, the broker is published on 127.0.0.1 only, and kcat took the refused ::1 for all brokers down and stopped. Phase 9 now passes -X broker.address.family=v4 to kcat.
  • Mutants of the guard: no refusal on several partitions, and -p not seen, are both caught by phase 9. A value read as an option is caught only by a local check with a fake kcat (-o -t -t orders).

Left out

  • kafka_sink stays on kcat with its stated exception (step 4/5), and ADR-0022 is not marked superseded.
  • The Kerberos login itself is not tested in CI: there is no KDC there.
  • A fix of the exec drivers for sh -c, such as a process group killed as a whole, is a follow-up.
  • Ubuntu's kcat (librdkafka 2.3.0) failed a SCRAM-SHA-256 login against the 4.4.0 admission broker that kafka-in logs in to. I did not look for the cause. It matters to the kafka_sink recipe, not to this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT

cpoder and others added 5 commits December 5, 2026 07:14
… (ADR-0044 step 3c)

The recipe reads the topic with the runtime's own Kafka client, SASL over
TLS with SCRAM-SHA-256. Its broker.sh runs one Apache Kafka node with the
topic in three partitions, and its dataflow.sh writes one record there and
waits for the fixture's shape on the bus. The admission points BROKERS at
that broker and SECURITY at SASL over plaintext, seeds the test user as the
recipe's two secrets, and requires a green probe before the data flow. The
stated exception goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
… a new bus

The kcat source example leaves the catalog for docs/examples/kafka-kerberos,
the route to a cluster that requires Kerberos (ADR-0044 point 8). Its CMD
starts kcat through kcat-source.sh, which refuses a command that pins no
partition with -p when kcat -L counts more than one: the exec driver keeps
one offset for the command, and one offset for several partitions would
skip or repeat records in silence. The refusal goes to the log at each
start. The CMD begins with exec, so the process the driver stops is kcat:
dash runs a command of sh -c as a child, and a kill of sh left it running.

e2e/kafka.sh phase 9 runs the route against the broker: a pinned partition
and a topic of one partition reach the bus with their commits, the command
without -p on three partitions is refused and puts nothing on the bus, and
no kcat outlives the runtime. The CI job installs the distribution's kcat.

Phase 8 probes a unit on a bus where no unit ever ran: no VEJAS_OFFSETS,
so the probe takes the bucket's absence from the error, says not committed
yet, and makes no bucket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
The catalog, the brokers page and the recipes' README say that the Kafka
source is kafka-in, certified against a real broker, and that the sink
stays a kcat bridge under its stated exception. A new page of the book,
Exec bridges, lists the four exec drivers, says to start a long-running
CMD with exec, and holds the Kerberos route with its refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
… Kafka recipes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
The runners resolve localhost to ::1 first. The broker's port is published
on 127.0.0.1 only, and kcat took the refused ::1 for all brokers down and
stopped, so nothing was written or read. librdkafka's
broker.address.family=v4 keeps it on 127.0.0.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
@cpoder
cpoder marked this pull request as ready for review December 5, 2026 07:01
kcat reads -p -1 as every partition, so a command with it read them all
under one offset and passed the guard. A -p whose value is not a
partition's number is refused, with the reason, at each start. Phase 9
checks it on the real broker: refused, nothing on the bus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
@cpoder
cpoder merged commit 8a54200 into master Dec 5, 2026
7 checks passed
@cpoder
cpoder deleted the feat/kafka-source-certified branch December 5, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant