Repository navigation
fix(async-minion): propagate sasl.client.callback.handler.class for SASL_SSL Kafka producers - #2280
Conversation
…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]>
|
👋 @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! |
|
Hey @gozen59 Thanks for this PR. I am a bit confused, as I don't see anything related to configuration setup in 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 |
|
Hi @lbroudoux, Thanks for the feedback — you're right, the initial PR was incomplete on the configuration side.
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]>
15828c0 to
af572f7
Compare
lbroudoux
left a comment
There was a problem hiding this comment.
It looks really great! Thnaks for taking the time to push this!
|
🎉 @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 🙌 |
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]>
…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]>
Summary
kafka.sasl.client.callback.handler.classto native Kafka producers inKafkaProducerManagerAWS_MSK_IAM) — SmallRye consumers already honor this property viaapplication.propertiesFixes #2232
Problem
MSK IAM requires
sasl.client.callback.handler.class=software.amazon.msk.auth.iam.IAMClientCallbackHandler.Producers created by
KafkaProducerManagerfail authentication withUnsupportedCallbackException: Unrecognized SASL ClientCallbackbecause onlysasl.login.callback.handler.classwas mapped in theSASL_SSLbranch ofcompletePropertiesWithSecurityConfig().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
KafkaProducerManagerTestpassmvn spotless:checkpasses (pre-commit hook)