Skip to content

Commit

Permalink
Upgrade Quarkus to 3.19.0.CR1
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Feb 5, 2025
1 parent 46df87e commit d0b0096
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 216 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig;
import io.quarkus.deployment.dev.devservices.DevServicesConfig;
import io.quarkus.kafka.client.deployment.KafkaBuildTimeConfig;
import org.apache.camel.quarkus.component.kafka.KafkaClientFactoryProducer;
import org.eclipse.microprofile.config.Config;
Expand Down Expand Up @@ -63,7 +63,7 @@ void createKafkaClientFactoryProducerBean(
}
}

@BuildStep(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class)
@BuildStep(onlyIfNot = IsNormal.class, onlyIf = DevServicesConfig.Enabled.class)
public void configureKafkaComponentForDevServices(
DevServicesLauncherConfigResultBuildItem devServiceResult,
KafkaBuildTimeConfig kafkaBuildTimeConfig,
Expand All @@ -72,7 +72,7 @@ public void configureKafkaComponentForDevServices(
Config config = ConfigProvider.getConfig();
Optional<String> brokers = config.getOptionalValue(CAMEL_KAFKA_BROKERS, String.class);

if (brokers.isEmpty() && kafkaBuildTimeConfig.devservices.enabled.orElse(true)) {
if (brokers.isEmpty() && kafkaBuildTimeConfig.devservices().enabled().orElse(true)) {
String kafkaBootstrapServers = devServiceResult.getConfig().get(KAFKA_BOOTSTRAP_SERVERS);
if (kafkaBootstrapServers != null) {
runTimeConfig.produce(new RunTimeConfigurationDefaultBuildItem(CAMEL_KAFKA_BROKERS, kafkaBootstrapServers));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public boolean getAsBoolean() {
.orElse(true);

return !mpHealthDisabled && camelHealthEnabled && camelHealthConfig.enabled
&& quarkusHealthConfig.enabled;
&& quarkusHealthConfig.enabled();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.vertx.deployment.VertxBuildItem;
import io.quarkus.vertx.http.deployment.VertxWebRouterBuildItem;
import io.quarkus.vertx.http.runtime.HttpConfiguration;
import io.quarkus.vertx.http.runtime.VertxHttpConfig;
import org.apache.camel.component.vertx.websocket.VertxWebsocketComponent;
import org.apache.camel.quarkus.component.vertx.websocket.VertxWebsocketRecorder;
import org.apache.camel.quarkus.core.deployment.spi.CamelRuntimeBeanBuildItem;
Expand All @@ -46,7 +46,7 @@ CamelRuntimeBeanBuildItem configureVertxWebsocketComponent(
VertxBuildItem vertx,
VertxWebRouterBuildItem router,
LaunchModeBuildItem launchMode,
HttpConfiguration httpConfig,
VertxHttpConfig httpConfig,
VertxWebsocketRecorder recorder) {
return new CamelRuntimeBeanBuildItem("vertx-websocket", VertxWebsocketComponent.class.getName(),
recorder.createVertxWebsocketComponent(vertx.getVertx(), router.getHttpRouter(), launchMode.getLaunchMode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import io.quarkus.tls.TlsConfiguration;
import io.quarkus.tls.TlsConfigurationRegistry;
import io.quarkus.vertx.http.runtime.CertificateConfig;
import io.quarkus.vertx.http.runtime.HttpConfiguration;
import io.quarkus.vertx.http.runtime.ServerSslConfig;
import io.quarkus.vertx.http.runtime.VertxHttpConfig;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.http.WebSocketConnectOptions;
Expand All @@ -53,13 +53,13 @@ public RuntimeValue<VertxWebsocketComponent> createVertxWebsocketComponent(
RuntimeValue<Vertx> vertx,
RuntimeValue<Router> router,
LaunchMode launchMode,
HttpConfiguration httpConfig) {
VertxHttpConfig httpConfig) {

boolean sslEnabled = isHttpSeverSecureTransportConfigured(httpConfig);
int httpPort = httpConfig.determinePort(launchMode);
int httpsPort = httpConfig.determineSslPort(launchMode);

HOST = httpConfig.host;
HOST = httpConfig.host();
PORT = sslEnabled ? httpsPort : httpPort;

QuarkusVertxWebsocketComponent component = new QuarkusVertxWebsocketComponent();
Expand All @@ -70,15 +70,15 @@ public RuntimeValue<VertxWebsocketComponent> createVertxWebsocketComponent(
return new RuntimeValue<>(component);
}

private boolean isHttpSeverSecureTransportConfigured(HttpConfiguration httpConfig) {
private boolean isHttpSeverSecureTransportConfigured(VertxHttpConfig httpConfig) {
return httpServerTlsRegistryConfigurationExists(httpConfig) || httpServerLegacySslConfigurationExists(httpConfig);
}

private boolean httpServerTlsRegistryConfigurationExists(HttpConfiguration httpConfig) {
private boolean httpServerTlsRegistryConfigurationExists(VertxHttpConfig httpConfig) {
if (Arc.container() != null) {
TlsConfigurationRegistry tlsConfigurationRegistry = Arc.container().select(TlsConfigurationRegistry.class).orNull();
if (tlsConfigurationRegistry != null) {
Optional<String> tlsConfigurationName = httpConfig.tlsConfigurationName;
Optional<String> tlsConfigurationName = httpConfig.tlsConfigurationName();
Optional<TlsConfiguration> defaultTlsConfiguration = tlsConfigurationRegistry.getDefault();
if (tlsConfigurationName.isPresent() && tlsConfigurationRegistry.get(tlsConfigurationName.get()).isPresent()) {
return true;
Expand All @@ -90,15 +90,15 @@ private boolean httpServerTlsRegistryConfigurationExists(HttpConfiguration httpC
return false;
}

private boolean httpServerLegacySslConfigurationExists(HttpConfiguration httpConfig) {
ServerSslConfig ssl = httpConfig.ssl;
private boolean httpServerLegacySslConfigurationExists(VertxHttpConfig httpConfig) {
ServerSslConfig ssl = httpConfig.ssl();
if (ssl != null) {
CertificateConfig certificate = ssl.certificate;
CertificateConfig certificate = ssl.certificate();
if (certificate != null) {
if (certificate.files.isPresent() && certificate.keyFiles.isPresent()) {
if (certificate.files().isPresent() && certificate.keyFiles().isPresent()) {
return true;
}
return certificate.keyStoreFile.isPresent() && certificate.keyStorePassword.isPresent();
return certificate.keyStoreFile().isPresent() && certificate.keyStorePassword().isPresent();
}
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import org.apache.commons.io.IOUtils;
import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.logging.Logger;
import org.testcontainers.utility.MountableFile;

import static java.util.Map.entry;

import static io.strimzi.test.container.StrimziKafkaContainer.KAFKA_PORT;

Expand Down Expand Up @@ -80,18 +81,27 @@ public Map<String, String> start() {
}

//Start kafka container
//TODO: Ideally we'd use kafka.container.image, but we can't due to https://github.com/strimzi/test-container/issues/63
String imageName = ConfigProvider.getConfig().getValue("kafka-oauth.container.image", String.class);
String imageName = ConfigProvider.getConfig().getValue("kafka.container.image", String.class);
this.kafka = new StrimziKafkaContainer(imageName)
.withBrokerId(1)
.withKafkaConfigurationMap(Map.of("listener.security.protocol.map",
"JWT:SASL_PLAINTEXT,BROKER1:PLAINTEXT",
"listener.name.jwt.oauthbearer.sasl.jaas.config",
getOauthSaslJaasConfig(keycloak.getInternalUrl(), keycloak.getServerUrl()),
"listener.name.jwt.plain.sasl.jaas.config",
getPlainSaslJaasConfig(keycloak.getInternalUrl(), keycloak.getServerUrl())))
.withKafkaConfigurationMap(Map.ofEntries(
entry("listener.security.protocol.map", "JWT:SASL_PLAINTEXT,BROKER1:PLAINTEXT"),
entry("listener.name.jwt.oauthbearer.sasl.jaas.config",
getOauthSaslJaasConfig(keycloak.getInternalUrl(), keycloak.getServerUrl())),
entry("listener.name.jwt.plain.sasl.jaas.config",
getPlainSaslJaasConfig(keycloak.getInternalUrl(), keycloak.getServerUrl())),
entry("sasl.enabled.mechanisms", "OAUTHBEARER"),
entry("sasl.mechanism.inter.broker.protocol", "OAUTHBEARER"),
entry("oauth.username.claim", "preferred_username"),
entry("principal.builder.class", "io.strimzi.kafka.oauth.server.OAuthKafkaPrincipalBuilder"),
entry("listener.name.jwt.sasl.enabled.mechanisms", "OAUTHBEARER,PLAIN"),
entry("listener.name.jwt.oauthbearer.sasl.server.callback.handler.class",
"io.strimzi.kafka.oauth.server.JaasServerOauthValidatorCallbackHandler"),
entry("listener.name.jwt.oauthbearer.sasl.login.callback.handler.class",
"io.strimzi.kafka.oauth.client.JaasClientOauthLoginCallbackHandler"),
entry("listener.name.jwt.plain.sasl.server.callback.handler.class",
"io.strimzi.kafka.oauth.server.plain.JaasServerOauthOverPlainValidatorCallbackHandler")))
.withNetworkAliases("kafka")
.withServerProperties(MountableFile.forClasspathResource("kafkaServer.properties"))
.withBootstrapServers(
c -> String.format("JWT://%s:%s", c.getHost(), c.getMappedPort(KAFKA_PORT)));
this.kafka.start();
Expand Down

This file was deleted.

Loading

0 comments on commit d0b0096

Please sign in to comment.