Skip to content

Support mTLS on the Kafka consumer - #2813

Open
delthas wants to merge 2 commits into
improvement/BB-848/pin-fromoffset-mongo-processorfrom
improvement/BB-850/support-mtls-kafka-consumer
Open

Support mTLS on the Kafka consumer#2813
delthas wants to merge 2 commits into
improvement/BB-848/pin-fromoffset-mongo-processorfrom
improvement/BB-850/support-mtls-kafka-consumer

Conversation

@delthas

@delthas delthas commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Stacked on #2808 (BB-848), which introduces the _getConsumerOptions() this adds a line to. Base needs retargeting to development/9.5 once that merges.

BackbeatConsumer builds its rdkafka params with no way to pass security.protocol or ssl.*, so it cannot reach a broker that requires client certificates. Producers already have this: BackbeatProducer spreads producerParams, and kafka.producerParams is an existing config field that MetricsProducer forwards — so TLS on the producer side is already configuration-only. Consumers were the gap.

This adds kafka.consumerParams alongside it with the same shape: .unknown(true), and the keys BackbeatConsumer sets itself forbidden, so a caller gets a validation error rather than a silently ignored setting. The schema is defined once in config.joi and reused by BackbeatConsumer's own joi, so a programmatic caller is validated like a config file.

Threaded through the mongo-processor only — the one consumer with a remote-broker use case. The D/R metadata sink (ZKOP-562) consumes from brokers on the production site, whose exposed listener is configured with SSLClientAuth: SSLClientAuthRequired. The other eight BackbeatConsumer call sites are one line each whenever they need it.

The operator half is ZKOP-577.

The first commit extracts consumerConfig and topicConfig getters, mirroring BackbeatProducer, so the rdkafka config can be asserted without stubbing.

Issue: BB-850

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.62%. Comparing base (b7a8483) to head (3a3db1b).

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
extensions/gc/GarbageCollector.js 46.37% <ø> (ø)
...ecycle/bucketProcessor/LifecycleBucketProcessor.js 80.60% <ø> (ø)
...ecycle/objectProcessor/LifecycleObjectProcessor.js 81.48% <ø> (ø)
extensions/mongoProcessor/MongoQueueProcessor.js 73.36% <ø> (ø)
...ions/notification/queueProcessor/QueueProcessor.js 56.86% <ø> (ø)
...ensions/replication/failedCRR/FailedCRRConsumer.js 47.36% <ø> (ø)
...sions/replication/queueProcessor/QueueProcessor.js 75.27% <ø> (ø)
...ationStatusProcessor/ReplicationStatusProcessor.js 68.51% <ø> (ø)
lib/BackbeatConsumer.js 94.73% <100.00%> (+0.07%) ⬆️
lib/MetricsConsumer.js 27.95% <ø> (ø)
... and 1 more
Components Coverage Δ
Bucket Notification 80.27% <ø> (ø)
Core Library 81.33% <100.00%> (+0.02%) ⬆️
Ingestion 71.42% <ø> (ø)
Lifecycle 80.46% <ø> (ø)
Oplog Populator 85.83% <ø> (ø)
Replication 62.01% <ø> (ø)
Bucket Scanner 85.76% <ø> (ø)
@@                                  Coverage Diff                                  @@
##           improvement/BB-848/pin-fromoffset-mongo-processor    #2813      +/-   ##
=====================================================================================
+ Coverage                                              75.61%   75.62%   +0.01%     
=====================================================================================
  Files                                                    200      200              
  Lines                                                  13922    13929       +7     
=====================================================================================
+ Hits                                                   10527    10534       +7     
  Misses                                                  3385     3385              
  Partials                                                  10       10              
Flag Coverage Δ
api:retry 9.11% <8.33%> (+<0.01%) ⬆️
api:routes 8.87% <8.33%> (+<0.01%) ⬆️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 9.25% <91.66%> (+0.10%) ⬆️
ingestion 12.27% <16.66%> (+<0.01%) ⬆️
lib 8.86% <91.66%> (+0.04%) ⬆️
lifecycle 19.35% <83.33%> (+0.04%) ⬆️
notification 1.02% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.13% <0.00%> (-0.01%) ⬇️
replication 18.89% <91.66%> (+0.04%) ⬆️
unit 55.02% <91.66%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@delthas
delthas force-pushed the improvement/BB-850/support-mtls-kafka-consumer branch from 4d5707f to e5ea0dd Compare August 19, 2026 09:53
@delthas
delthas force-pushed the improvement/BB-850/support-mtls-kafka-consumer branch 2 times, most recently from f69017b to c8c7f33 Compare August 19, 2026 16:24
@delthas
delthas force-pushed the improvement/BB-850/support-mtls-kafka-consumer branch from c8c7f33 to 35fcfd6 Compare August 19, 2026 16:58
@delthas
delthas force-pushed the improvement/BB-850/support-mtls-kafka-consumer branch 2 times, most recently from 34d3bb0 to 761dcde Compare August 19, 2026 17:12
Move the params built inline in _initConsumer into consumerConfig and
topicConfig getters, so they can be asserted in a unit test. Mirrors
BackbeatProducer, which already exposes producerConfig and topicConfig.

The "follower fetching enabled" log stays in _initConsumer, keeping the
getters side-effect free as the producer's are. No behaviour change.

Issue: BB-850
BackbeatConsumer built its rdkafka params with no way to pass
security.protocol or ssl.*, so it could not reach a broker requiring
client certificates. Producers already had this: BackbeatProducer spreads
producerParams, and kafka.producerParams is an existing config field.

Add kafka.consumerParams alongside it with the same shape --
.unknown(true), and the keys BackbeatConsumer sets itself forbidden, so a
caller gets a validation error rather than a silently ignored setting.
Three keys it does not set are forbidden too: enable.auto.commit and
auto.commit.interval.ms would silently disable the periodic offset commits
the consumer relies on, and auto.offset.reset is topic scope, so
librdkafka accepts it into a default_topic_conf that node-rdkafka then
replaces wholesale -- a caller could otherwise believe they had overridden
the offset reset a processor pins.

The schema is defined once in config.joi and reused by BackbeatConsumer's
own joi, so a programmatic caller is validated like a config file.

Thread it through every consumer rather than only the one with a
remote-broker use case today, mirroring how producerParams rolled out in
efc9c6a: one line per call site, so the knob exists wherever a broker
might require certificates.

BackbeatConsumer's own internal producers -- the canary and the test-only
bootstrap -- take producerParams as well. Its kafka block already accepted
compressionType and requiredAcks for them, but not producerParams, so the
replication queue processor (the one consumer with canary: true) could not
have completed its canary against an mTLS broker.

librdkafka in node-rdkafka 3.0.1 already reports ssl and sasl in its
features, so no dependency change is needed.

Issue: BB-850
@delthas
delthas force-pushed the improvement/BB-850/support-mtls-kafka-consumer branch from 761dcde to 3a3db1b Compare August 25, 2026 18:40
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