Repository navigation
feat: propagate sasl.client.callback.handler.class for MSK IAM producers - #306
Conversation
|
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! |
|
What I found:
What I'm going to do:
Backward compatibility: This change is fully backward-compatible. Both callback handler fields are completely optional in the CRD. In the Qute template, they are wrapped in standard This is my first contribution here and I'm still learning the codebase, so if I've put something in the wrong place or missed an existing pattern for SASL config, I'd appreciate any guidance. |
|
While working on this, I noticed I only added the new row and matched the existing style/wording — I didn't touch or rewrite any of the existing documentation. Happy to change the phrasing if you'd prefer it worded differently. |
Signed-off-by: Abhayanth K <abhayanth2006@gmail.com>
- 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 microcks#305 Signed-off-by: Abhayanth K <abhayanth2006@gmail.com>
- Add saslClientCallbackHandlerClass to the CRD documentation table Signed-off-by: Abhayanth K <abhayanth2006@gmail.com>
f9b9cc1 to
11a7f98
Compare
|
Hi again! I noticed the upstream PR (microcks/microcks#2232) included a unit test for the mapping, so I've added the equivalent coverage here. I added a new test method to This should round out the change — happy to adjust if you'd like the test structured differently. |
Signed-off-by: Abhayanth K <abhayanth2006@gmail.com>
|
Hi @lbroudoux 👋 — this is ready for review whenever you get a chance. I’ve added the full thought process, the fix, and my reasoning in the comments above, so you can read through it there. |
lbroudoux
left a comment
There was a problem hiding this comment.
Thanks for your patience. This looks great but you should also apply the configuration changes to the main web app ConfigMap for the component that is producing Kafka messages.
As this PR also updates the KafkaAuthenticationSpec.java, it must also update the /deploy/crd/microckses.microcks.io-v1.yml file. This CRD is typically generated when you run mvn quarkus:dev on the operator module - you just have to extract it from the target/kubernetes folder.
Let me know if you can push the changes. Thanks,
- 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 <abhayanth2006@gmail.com>
|
Thanks! Addressed both points in 2fb491c:
|
|
One thing I noticed: there's no test covering the main web app ConfigMap auth rendering (the MicrocksConfigMapDependentResource path), unlike the async-minion side. To be clear, I mean a rendering unit test — asserting that the operator emits the right SASL properties into the generated ConfigMap (same style as the async-minion test), not an actual MSK/IAM integration test. Happy to add it here or as a follow-up — whichever you prefer. |
`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 <abhayanth2006@gmail.com>
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 microcks#305
Signed-off-by: Abhayanth K <abhayanth2006@gmail.com>
- 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 <abhayanth2006@gmail.com>
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 <abhayanth2006@gmail.com>
|
Hi @lbroudoux, a follow-up on your review. Both points were addressed in 2fb491c, but when I first ran the tests locally I found two pre-existing bugs that meant the new properties — and all Kafka SSL / SASL_SSL auth config — never actually rendered. Both are fixed in this PR (5d9d2f6 for A, 7c50a10 for B) with tests in 8d5db8e. The PR description has the full summary. Corrections to my earlier comments
Bug A — enum compared with a String
Same pattern at minion L73 and web app L52, L64, L80, L99. A standalone Qute check gives no match for Bug B — web app guard inverted vs the Helm chartThe Helm chart renders the web app's Kafka auth for an external broker ( The operator had the opposite guard (also at L79), with no So the web app only got auth config when the operator installs Strimzi — where both components use the Also worth flagging
Questions
|
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 <abhayanth2006@gmail.com>
|
Hi @lbroudoux, a gentle ping when you have time. Both review points are addressed in 2fb491c, and the two questions above are still open. |
|
Thanks for your patience and sorry for the delay...
Yes please do so.
It would be awesome to add this in a follow-up issue and PR! |
lbroudoux
left a comment
There was a problem hiding this comment.
It is great! Thanks a lot for taking the time to push this and to nudge me on the review!
|
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 🙌 |
Description
Adds
saslClientCallbackHandlerClassandsaslLoginCallbackHandlerClasstoKafkaAuthenticationSpecso Microcks' Kafka clients can authenticate to Amazon MSK using IAM. They map to Kafka'ssasl.client.callback.handler.class/sasl.login.callback.handler.classsettings, and are applied to both components that talk to Kafka — the async-minion and the main web app.Changes
KafkaAuthenticationSpec.javasaslClientCallbackHandlerClassandsaslLoginCallbackHandlerClass(both optional)AsyncMinionConfigMapDependentResource/application.propertiesMicrocksConfigMapDependentResource/application.properties/deploy/crd/microckses.microcks.io-v1.yml+ Helm chart copymicrocks-cr.mdTwo pre-existing bugs
Both were already on
main; neither is a regression from this PR.(More details in the comments)type == "SSL"→type.name == "SSL"Behaviour change
install: false) with SSL / SASL_SSLinstall: true)Tests
AsyncMinionConfigMapDependentResourceTestMicrocksConfigMapDependentResourceTest(new)Run locally against k3s. Each commit builds and passes on its own. Not covered: the SSL branch, and CI hasn't run yet.
Related issue(s)
Fixes #305. Replicates the Helm chart changes of microcks/microcks#2280; see also microcks/microcks#2232 for background.
AI usage
AI assisted with investigating the root cause, writing the code and docs, and drafting the tests. I've reviewed and understood every change and am fully accountable for them.