-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
K8s Service Binding for Kafka #15631
Comments
/cc @cescoffier |
/cc @geoand |
cc @wtrocki |
@wtrocki we likely want to place the service binding glue code in either In that module you'll have to add an optional dependency to <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kubernetes-service-binding</artifactId>
<optional>true</optional>
</dependency> The code itself should be very simple, something like: public class KafkaBindingConverter implements ServiceBindingConverter {
@Override
public Optional<ServiceBindingConfigSource> convert(List<ServiceBinding> serviceBindings) {
Optional<ServiceBinding> matchingByType = ServiceBinding.singleMatchingByType("kafka", serviceBindings);
if (!matchingByType.isPresent()) {
return Optional.empty();
}
Map<String, String> properties = new HashMap<>();
ServiceBinding binding = matchingByType.get();
//TODO: add the property mappings
return Optional.of(new ServiceBindingConfigSource("kafka-k8s-service-binding-source", properties));
}
} Much like https://github.com/quarkusio/quarkus/blob/031e5bf4eddb2f6399ef8c726e8df8e63bb8439c/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/MsSQLServiceBindingConverter.java does for example. |
If it is an option, I'd like to get it in |
+1 on adding it to both. |
Good point - I hadn't thought about that |
K8 Service Binding support in Strimzi tracked by strimzi/strimzi-kafka-operator#2753 |
It should be added to the That extension is registering a bean providing the Map<String, ?> used to configure the clients. In the future, when we add multiple broker support, we would need to extend that to produce multiple Maps with the right name. |
@lburgazzoli you should use the exposed Map actually. |
I have been thinking about that a bit this morning. At the moment the This approach can be used for single binding. The properties provided by the binding can be pushed to that map. Now, in the case of multiple bindings, we could do the following:
In terms of implementation, it's straightforward, as the mechanism is already in place. It just needs a few more Map producers (unremovable as the lookup is going to be programmatic). See https://github.com/quarkusio/quarkus/blob/master/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java. They will have to be generated (unlike the existing one) and take the binding name as an argument. @geoand WDYT? PS: this does not include the work that needs to be done in reactive messaging to consume these bindings. |
@cescoffier sounds reasonable, yes |
@cescoffier at this point, do we only expect |
@wtrocki what is the final set of files that will be injected into the container? |
@geoand only |
Right, that's what I though. Thanks |
Currently, I have added type and provider using mapping capability on SBO object which is not ideal.
This is how is would look like no matter what approach we going to use
Note that since For kafka that is not a big problem since we can add those fields in all clients that create CR's but it brings some limitations for additions of these patterns in the future. Possible solutions:
redhat-developer/service-binding-operator#843
This way we could enable quarkus to automatically work with resources created in IBM, Google cloud like db's etc. - typically ones we do not control or can add extra requirements for and also bind kafka with them. |
@wtrocki thanks for the complete rundown. If you would like to do the Quarkus part of the binding based on those files, then cool :). If you are too swamped to get it done by tomorrow, let me know and I'll code it up based on what you have described above. |
I spoke with @wtrocki and due to the time constraints of this, I'll provide the initial PR myself. |
#15733 should (partly) take care of it |
Add Service Binding configuration for Kafka
From @cescoffier, OAUTH support will need something like: mp.messaging.connector.smallrye-kafka.security.protocol=SASL_PLAINTEXT kafka.sasl.login.callback.handler.class=io.strimzi.kafka.oauth.client.JaasClientOauthLoginCallbackHandle |
Support setting up Kafka via the new Service Binding setup
type
should bekafka
provider
could be anythingWhat keys are required/supported?
The text was updated successfully, but these errors were encountered: