Skip to content

fix(async-minion): propagate sasl.client.callback.handler.class for SASL_SSL Kafka producers - #2280

Merged
lbroudoux merged 2 commits into
microcks:masterfrom
gozen59:fix/async-minion-msk-iam-client-callback-handler
Sep 9, 2026
Merged

lbroudoux merged 2 commits into
microcks:masterfrom
gozen59:fix/async-minion-msk-iam-client-callback-handler

Conversation

@gozen59

@gozen59 gozen59 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Propagate kafka.sasl.client.callback.handler.class to native Kafka producers in KafkaProducerManager
  • Required for Amazon MSK IAM (AWS_MSK_IAM) — SmallRye consumers already honor this property via application.properties
  • Add unit tests covering SASL_SSL security property mapping with and without the client callback handler

Fixes #2232

Problem

MSK IAM requires sasl.client.callback.handler.class=software.amazon.msk.auth.iam.IAMClientCallbackHandler.
Producers created by KafkaProducerManager fail authentication with UnsupportedCallbackException: Unrecognized SASL ClientCallback because only sasl.login.callback.handler.class was mapped in the SASL_SSL branch of completePropertiesWithSecurityConfig().

AI disclosure

This pull request was prepared with assistance from an AI coding assistant (Cursor). The human author is responsible for reviewing, testing, and understanding the changes.

Test plan

  • Unit tests KafkaProducerManagerTest pass
  • mvn spotless:check passes (pre-commit hook)
  • Manual: async-minion against MSK Serverless :9098 publishes mock messages without SASL errors

…ASL_SSL Kafka producers

Propagate kafka.sasl.client.callback.handler.class to native Kafka producers so Amazon MSK IAM authentication works for mock message publishing.

Fixes microcks#2232

Signed-off-by: Thierry MATHIAS <[email protected]>
@github-actions

Copy link
Copy Markdown

👋 @gozen59

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

@lbroudoux

Copy link
Copy Markdown
Member

Hey @gozen59

Thanks for this PR. I am a bit confused, as I don't see anything related to configuration setup in application.properties...

I see that your changes actually propagate the setting but I don't see the origin of this setting. As of today, we only specify those 2 properties via the Helm chart:

    %kube.mp.messaging.incoming.microcks-services-updates.sasl.login.callback.handler.class={{ .Values.features.async.kafka.authentication.saslLoginCallbackHandlerClass }}
    %kube.mp.messaging.incoming.microcks-asyncapi-triggers.sasl.login.callback.handler.class={{ .Values.features.async.kafka.authentication.saslLoginCallbackHandlerClass }}

but nothing related to the sasl.client.callback.handler... Shouldn't be also had this conifguration capabilities on the chart values.yaml via a features.async.kafka.authentication.saslClientCallbackHandlerClass property?

@gozen59

gozen59 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @lbroudoux,

Thanks for the feedback — you're right, the initial PR was incomplete on the configuration side.
Origin of the setting (our deployment)
We run async-minion on AWS ECS Fargate (not Helm). The property is injected at runtime via environment/SSM into Quarkus as kafka.sasl.client.callback.handler.class. That is why the Java change alone fixed MSK IAM for native producers in our case. SmallRye consumers already worked because they honor sasl.client.callback.handler.class when provided externally.
Helm chart update (just pushed)
I agree Kubernetes users need an official configuration path. The PR now adds features.async.kafka.authentication.saslClientCallbackHandlerClass in values.yaml, propagated in configmap.yaml for:

  • %kube.kafka.sasl.client.callback.handler.class — async-minion native producers (str / bytes / registry), read by KafkaProducerManager
  • %kube.mp.messaging.incoming.*.sasl.client.callback.handler.class — SmallRye consumers
  • main app Kafka producers (service-changes / asyncapi-triggers) — symmetric to the existing login callback handler
    Example for Amazon MSK IAM (AWS_MSK_IAM):
features:
  async:
    kafka:
      authentication:
        type: SASL_SSL
        saslMechanism: AWS_MSK_IAM
        saslJaasConfig: "software.amazon.msk.auth.iam.IAMLoginModule required;"
        saslClientCallbackHandlerClass: software.amazon.msk.auth.iam.IAMClientCallbackHandler

Add Helm chart support for kafka.sasl.client.callback.handler.class,
symmetric to the existing saslLoginCallbackHandlerClass, so async-minion
native producers and SmallRye consumers can be configured for Amazon MSK IAM
(AWS_MSK_IAM) via values.yaml. microcks#2232

Signed-off-by: Thierry MATHIAS <[email protected]>
@gozen59
gozen59 force-pushed the fix/async-minion-msk-iam-client-callback-handler branch from 15828c0 to af572f7 Compare August 25, 2026 16:44

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks really great! Thnaks for taking the time to push this!

@lbroudoux lbroudoux added this to the 1.16.0 milestone Sep 9, 2026
@lbroudoux
lbroudoux merged commit c5478f6 into microcks:master Sep 9, 2026
10 checks passed
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

🎉 @gozen59

You are now a Microcks community contributor! 💖

Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Kudos and please keep going, we need you 🙌

Abhayanthk added a commit to Abhayanthk/microcks-operator that referenced this pull request Sep 21, 2026
Use the same wording as microcks/microcks#2280 and state that the client
callback handler is required for Amazon MSK IAM (AWS_MSK_IAM).

Signed-off-by: Abhayanth K <[email protected]>
lbroudoux pushed a commit to microcks/microcks-operator that referenced this pull request Oct 16, 2026
…ers (#306)

* feat: propagate sasl.client.callback.handler.class for MSK IAM producers

Signed-off-by: Abhayanth K <[email protected]>

* feat: propagate sasl client and login callback handlers

- Add saslClientCallbackHandlerClass and saslLoginCallbackHandlerClass to KafkaAuthenticationSpec.
- Map these properties to the application.properties Qute template for async-minion.
- Wrap properties in optional blocks to maintain backward compatibility.

Fixes #305

Signed-off-by: Abhayanth K <[email protected]>

* docs: document sasl client callback handler class

- Add saslClientCallbackHandlerClass to the CRD documentation table

Signed-off-by: Abhayanth K <[email protected]>

* test: add unit test for sasl callback handlers mapping

Signed-off-by: Abhayanth K <[email protected]>

* fix: apply sasl callback config to main web app and regenerate CRD

- Applies the saslClientCallbackHandlerClass and saslLoginCallbackHandlerClass conditional mappings to the main MicrocksConfigMapDependentResource template, ensuring the main web app (which also produces Kafka messages) has the same authentication configuration as the async-minion.

- Regenerates the Kubernetes CRD (microckses.microcks.io-v1.yml) to expose the new KafkaAuthenticationSpec fields to the cluster.

Signed-off-by: Abhayanth K <[email protected]>

* fix: compare Kafka authentication type by name in Qute templates

`authentication.type` is a KafkaAuthenticationType enum, but the templates
compared it to String literals ("SSL", "SASL_SSL"). Qute evaluates `==` on
the objects themselves, so an enum never equals a String and neither branch
ever rendered. No Kafka TLS/SASL configuration (security.protocol, sasl.*,
truststore, keystore) reached the async-minion or the main web app.

Compare `type.name` instead, in both templates.

Signed-off-by: Abhayanth K <[email protected]>

* fix: render web app Kafka authentication for external brokers only

The main web app wrapped its Kafka authentication block in
`{#if spec.features.async.kafka.install}`, the opposite of the async-minion
template and of the upstream Helm chart (`install == false`). Authentication
was only emitted when the operator installs Kafka itself (Strimzi, internal
listener without auth) and never for an external broker such as Amazon MSK.

Negate the guard for both the pre-1.14 and the 1.14+ producer layouts.

Refs #305

Signed-off-by: Abhayanth K <[email protected]>

* test: cover Kafka authentication rendering for minion and web app

- async-minion: assert the client and login callback handlers on all three
  Kafka clients, and that they are omitted when not configured.
- main web app: new MicrocksConfigMapDependentResourceTest covering external
  Kafka on the 1.14+ and pre-1.14 layouts, omitted handlers, and no
  authentication when the operator installs Kafka.

Absence checks first assert that the SASL section rendered, so they cannot
pass just because the whole block is missing.

Signed-off-by: Abhayanth K <[email protected]>

* docs: align client callback handler row with the Helm chart docs

Use the same wording as microcks/microcks#2280 and state that the client
callback handler is required for Amazon MSK IAM (AWS_MSK_IAM).

Signed-off-by: Abhayanth K <[email protected]>

* chore: keep only the new SASL callback handler fields in the CRDs

Regenerating the CRD with the current Quarkus (3.27.1) and Quarkus
Operator SDK (7.2.3) also adds 58 lines unrelated to this PR
(additionalProperties, request, seLinuxChangePolicy,
supplementalGroupsPolicy). The same lines appear when regenerating
unmodified main; the committed CRD has not been fully regenerated since
those versions were bumped in 92783d2.

Keep only the generated lines for saslClientCallbackHandlerClass and
saslLoginCallbackHandlerClass in both CRD copies, as done in 8e8bc6f.

Signed-off-by: Abhayanth K <[email protected]>

---------

Signed-off-by: Abhayanth K <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

async-minion: propagate kafka.sasl.client.callback.handler.class for MSK IAM producers

2 participants