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.63%. Comparing base (6dbeee7) to head (761dcde).

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
extensions/mongoProcessor/MongoQueueProcessor.js 73.47% <ø> (ø)
lib/BackbeatConsumer.js 94.96% <100.00%> (+0.06%) ⬆️
lib/config.joi.js 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.27% <ø> (ø)
Core Library 81.34% <100.00%> (-0.13%) ⬇️
Ingestion 71.45% <ø> (ø)
Lifecycle 80.46% <ø> (ø)
Oplog Populator 85.83% <ø> (ø)
Replication 62.01% <ø> (-0.04%) ⬇️
Bucket Scanner 85.76% <ø> (ø)
@@                                  Coverage Diff                                  @@
##           improvement/BB-848/pin-fromoffset-mongo-processor    #2813      +/-   ##
=====================================================================================
- Coverage                                              75.68%   75.63%   -0.06%     
=====================================================================================
  Files                                                    200      200              
  Lines                                                  13923    13929       +6     
=====================================================================================
- Hits                                                   10538    10535       -3     
- Misses                                                  3375     3384       +9     
  Partials                                                  10       10              
Flag Coverage Δ
api:retry 9.11% <9.09%> (+<0.01%) ⬆️
api:routes 8.87% <9.09%> (+<0.01%) ⬆️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 9.18% <90.90%> (-0.96%) ⬇️
ingestion 12.27% <18.18%> (+<0.01%) ⬆️
lib 8.86% <90.90%> (+0.03%) ⬆️
lifecycle 19.35% <81.81%> (+0.05%) ⬆️
notification 1.02% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.13% <0.00%> (-0.01%) ⬇️
replication 18.88% <90.90%> (+0.03%) ⬆️
unit 55.02% <90.90%> (+0.01%) ⬆️

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
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
@delthas
delthas force-pushed the improvement/BB-850/support-mtls-kafka-consumer branch from 35fcfd6 to 34d3bb0 Compare August 19, 2026 17:10
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 that
MetricsProducer forwards.

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 the mongo-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 from the mongo-processor, the one consumer with a remote-broker
use case: the D/R metadata sink consumes from brokers on the production
site, whose exposed listener requires client certificates -- see BB-850.

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 34d3bb0 to 761dcde Compare August 19, 2026 17:12
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