davsclaus opened a new pull request, #3286: URL: https://github.com/apache/camel-kamelets/pull/3286
Part of #3279: the Kafka Kamelets can log in to a schema registry, with the options that camel-kafka got in [CAMEL-27256](https://issues.apache.org/jira/browse/CAMEL-27256) (apache/camel#30437). **Draft:** - **Built on #3281** (the batch registry); this PR's own change is the last commit. - **Needs a Camel 4.24.0-SNAPSHOT with CAMEL-27256.** The latest published snapshot predates it, so the build fails until then: it validates the `from` parameters of `kafka-source` and `kafka-batch-source` against the Camel catalog. I tested it locally against a reactor build of apache/camel main. ### What changed `kafka-source`, `kafka-sink` and `kafka-batch-source` get six optional options, passed to camel-kafka only when set: | Option | Login | |---|---| | `schemaRegistryUsername`, `schemaRegistryPassword` | Basic auth. For Confluent Cloud, the API key and secret of the Schema Registry | | `schemaRegistryOauthTokenEndpoint`, `schemaRegistryOauthClientId`, `schemaRegistryOauthClientSecret`, `schemaRegistryOauthScope` | OAuth2 client credentials, such as a Keycloak client | - **Secrets:** the password and the client secret are `format: password` with the credentials descriptor, and are passed in `RAW()`. - **Descriptions:** the "A `confluent` or `apicurio` registry that requires a login is not supported yet" sentence now says how to log in. They also say that with `aws-glue` and `azure` these options fail at startup, as those log in with the credentials of the environment. ### Found while testing: Kafka 4 restricts OAuth token endpoints Kafka 4 only calls an OAuth2 token endpoint that is listed in the JVM system property `org.apache.kafka.sasl.oauthbearer.allowed.urls`. Otherwise the integration fails to start with `The URL cannot be accessed due to restrictions`. - **The registry login:** the Confluent client checks `schemaRegistryOauthTokenEndpoint` the same way. - **The existing `saslAuthType: OAUTH`:** its `oauthTokenEndpointUri` is affected too. I checked `kafka-sink` on main: it does not start without the property. A Kamelet cannot set a JVM system property, so the descriptions now say this, in "Good to know" and on both token endpoint options, with an example for Camel JBang (`--jvm-args`). The camel-kafka documentation gets the same note in apache/camel#30443. ### Tests - **New Citrus test `kafka-schema-registry-login-route`:** `kafka-sink` writes through a registry with a login. The test server of `KafkaIT` stands in for the registry and checks that it gets `Authorization: Basic` with the username and the whole password `s3c&r+t=/x`. - **Checked by hand with `camel run`:** the OAuth2 login reaches the token endpoint with the client credentials, `grant_type=client_credentials&scope=registry`, once the endpoint is in the allowed URLs. - **`KafkaIT`:** 8 of 9 pass, including the new test and the batch registry tests of #3281. The failure is the flaky `kafka-source-route-test`, which #3282 fixes and which this branch does not have yet. - **Build:** `./mvnw clean install` from the root passes, run twice, against the local reactor build. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
