Skip to content
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

[3.15] Backports #2082

Merged
merged 8 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions funqy/knative-events/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@
<artifactId>quarkus-openshift</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>openshift-client</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>knative-client</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-openshift-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus.qe</groupId>
Expand All @@ -51,20 +47,4 @@
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- Disable native build on this module -->
<!--TODO https://github.com/quarkusio/quarkus/issues/43360 -->
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<!-- To not build the module on Native -->
<quarkus.build.skip>true</quarkus.build.skip>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.scenarios.annotations.DisabledOnNative;
import io.quarkus.test.services.QuarkusApplication;
import io.restassured.RestAssured;

@QuarkusScenario
@DisabledOnNative(reason = "https://github.com/quarkusio/quarkus/issues/43360")
public class FunqyKnEventsIT {

@QuarkusApplication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@

import io.quarkus.test.scenarios.OpenShiftDeploymentStrategy;
import io.quarkus.test.scenarios.OpenShiftScenario;
import io.quarkus.test.scenarios.annotations.DisabledOnNative;
import io.quarkus.test.services.QuarkusApplication;
import io.quarkus.test.services.knative.eventing.FunqyKnativeEventsService;
import io.quarkus.test.services.knative.eventing.OpenShiftExtensionFunqyKnativeEventsService;
import io.quarkus.test.services.knative.eventing.spi.ForwardResponseDTO;
import io.restassured.common.mapper.TypeRef;

@DisabledOnNative(reason = "https://github.com/quarkusio/quarkus/issues/43360")
@Tag("use-quarkus-openshift-extension")
@Tag("serverless")
@OpenShiftScenario(deployment = OpenShiftDeploymentStrategy.UsingOpenShiftExtension)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,47 +1,39 @@
package io.quarkus.ts.messaging.infinispan.grpc.kafka.providers;

import java.io.File;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Inject;
import jakarta.inject.Named;

import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.KafkaAdminClient;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.common.config.SaslConfigs;
import org.apache.kafka.common.config.SslConfigs;
import org.eclipse.microprofile.config.inject.ConfigProperty;

public class SaslSslKafkaProvider extends KafkaProviders {

private final static String SASL_USERNAME_VALUE = "client";
private final static String SASL_PASSWORD_VALUE = "client-secret12345678912345678912";

@ConfigProperty(name = "kafka.ssl.truststore.location")
Optional<String> trustStoreFile;

@ConfigProperty(name = "kafka.ssl.truststore.password")
Optional<String> trustStorePassword;
import io.smallrye.common.annotation.Identifier;

@ConfigProperty(name = "kafka.ssl.truststore.type")
Optional<String> trustStoreType;
public class SaslSslKafkaProvider extends KafkaProviders {

@ConfigProperty(name = "kafka-client-sasl-ssl.bootstrap.servers")
Optional<String> saslSslKafkaBootStrap;

@Inject
@Identifier("default-kafka-broker")
Map<String, Object> defaultKafkaBrokerConfig;

@ApplicationScoped
@Produces
@Named("kafka-consumer-sasl-ssl")
KafkaConsumer<String, String> getSaslSslConsumer() {
Properties props = setupConsumerProperties(saslSslKafkaBootStrap.get());
saslSetup(props);
sslSetup(props);
saslSslSetup(props);
KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
consumer.subscribe(Collections.singletonList("test-ssl-consumer"));
return consumer;
Expand All @@ -52,8 +44,7 @@ KafkaConsumer<String, String> getSaslSslConsumer() {
@Named("kafka-producer-sasl-ssl")
KafkaProducer<String, String> getSaslSslProducer() {
Properties props = setupProducerProperties(saslSslKafkaBootStrap.get());
saslSetup(props);
sslSetup(props);
saslSslSetup(props);
return new KafkaProducer<>(props);
}

Expand All @@ -62,24 +53,12 @@ KafkaProducer<String, String> getSaslSslProducer() {
@Named("kafka-admin-sasl-ssl")
AdminClient getSaslSslAdmin() {
Properties props = setupConsumerProperties(saslSslKafkaBootStrap.get());
saslSetup(props);
sslSetup(props);
saslSslSetup(props);
return KafkaAdminClient.create(props);
}

private static void saslSetup(Properties props) {
props.setProperty(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SASL_SSL");
props.setProperty(SaslConfigs.SASL_MECHANISM, "SCRAM-SHA-512");
props.setProperty(SaslConfigs.SASL_JAAS_CONFIG,
"org.apache.kafka.common.security.scram.ScramLoginModule required username=\"%s\" password=\"%s\";"
.formatted(SASL_USERNAME_VALUE, SASL_PASSWORD_VALUE));
}

protected void sslSetup(Properties props) {
File tsFile = new File(trustStoreFile.get());
props.setProperty(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, tsFile.getPath());
props.setProperty(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, trustStorePassword.get());
props.setProperty(SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG, trustStoreType.get());
protected void saslSslSetup(Properties props) {
defaultKafkaBrokerConfig.forEach(props::putIfAbsent);
props.setProperty(SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG, "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.quarkus.test.services.containers.model.KafkaProtocol;
import io.quarkus.test.services.containers.model.KafkaVendor;

@Tag("QUARKUS-4592")
@Tag("QUARKUS-2036")
@QuarkusScenario
public class InfinispanKafkaSaslSslIT {
Expand All @@ -29,7 +30,7 @@ public class InfinispanKafkaSaslSslIT {
.withSecretFiles(CertUtils.KEYSTORE)
.onPreStart((action) -> CertUtils.prepareCerts());

@KafkaContainer(vendor = KafkaVendor.STRIMZI, protocol = KafkaProtocol.SASL_SSL)
@KafkaContainer(vendor = KafkaVendor.STRIMZI, protocol = KafkaProtocol.SASL_SSL, tlsRegistryEnabled = true, tlsConfigName = "kafka-sasl-ssl")
static final KafkaService kafkaSaslSsl = new KafkaService();

@QuarkusApplication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
@Inherited
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@ExtendWith(DisabledOnRHBQAarch64NativeConditions.class)
public @interface DisabledOnRHBQAarch64Native {
@ExtendWith(DisabledOnAarch64NativeConditions.class)
public @interface DisabledOnAarch64Native {

/**
* Why is the annotated test class or test method disabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@

import io.quarkus.test.services.quarkus.model.QuarkusProperties;

public class DisabledOnRHBQAarch64NativeConditions implements ExecutionCondition {
public class DisabledOnAarch64NativeConditions implements ExecutionCondition {

@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext extensionContext) {
boolean isRHBQ = QuarkusProperties.getVersion().contains("redhat");
boolean isNative = QuarkusProperties.isNativeEnabled();
boolean isAarch64 = "true".equals(System.getProperty("ts.arm.missing.services.excludes"));
if (isRHBQ && isAarch64 && isNative) {
return ConditionEvaluationResult.disabled("It is RHBQ running on aarch64 in native mode.");
if (isAarch64 && isNative) {
return ConditionEvaluationResult.disabled("It is running on aarch64 in native mode.");
} else {
return ConditionEvaluationResult.enabled("It is not RHBQ running on aarch64 in native mode.");
return ConditionEvaluationResult.enabled("It is not running on aarch64 in native mode.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.quarkus.test.services.containers.model.KafkaVendor;

@OpenShiftScenario
@DisabledOnAarch64Native(reason = "https://issues.redhat.com/browse/QUARKUS-4321")
@EnabledIfSystemProperty(named = "ts.redhat.registry.enabled", matches = "true")
public class OpenShiftAmqStreamsKafkaStreamIT extends BaseKafkaStreamTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import io.quarkus.test.scenarios.OpenShiftScenario;

@OpenShiftScenario
@DisabledOnRHBQAarch64Native(reason = "https://issues.redhat.com/browse/QUARKUS-4321")
@DisabledOnAarch64Native(reason = "https://issues.redhat.com/browse/QUARKUS-4321")
public class OpenShiftStrimziKafkaStreamIT extends StrimziKafkaStreamIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.quarkus.test.services.operator.KafkaInstance;

@OpenShiftScenario
@DisabledOnAarch64Native(reason = "https://issues.redhat.com/browse/QUARKUS-4321")
public class OperatorOpenShiftAmqStreamsKafkaStreamIT extends BaseKafkaStreamTest {

@Operator(name = "amq-streams", source = "redhat-operators")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,84 +1,63 @@
package io.quarkus.qe.messaging.ssl.providers;

import java.io.File;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Singleton;

import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.KafkaAdminClient;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.common.config.SaslConfigs;
import org.apache.kafka.common.config.SslConfigs;
import org.eclipse.microprofile.config.inject.ConfigProperty;

public class SaslSslKafkaProvider extends KafkaProviders {
import io.smallrye.common.annotation.Identifier;

private final static String SASL_USERNAME_VALUE = "client";
private final static String SASL_PASSWORD_VALUE = "client-secret12345678912345678912";
public class SaslSslKafkaProvider extends KafkaProviders {

@ConfigProperty(name = "kafka-client-sasl-ssl.bootstrap.servers", defaultValue = "localhost:9092")
String saslSslKafkaBootStrap;

@ConfigProperty(name = "kafka.ssl.truststore.location", defaultValue = "server.jks")
String trustStoreFile;

@ConfigProperty(name = "kafka.ssl.truststore.password", defaultValue = "top-secret")
String trustStorePassword;
@Inject
@Identifier("default-kafka-broker")
Map<String, Object> defaultKafkaBrokerConfig;

@ConfigProperty(name = "kafka.ssl.truststore.type", defaultValue = "PKCS12")
String trustStoreType;

@Singleton
@ApplicationScoped // don't create bean when testing Kafka SSL
@Produces
@Named("kafka-consumer-sasl-ssl")
KafkaConsumer<String, String> getSaslSslConsumer() {
Properties props = setupConsumerProperties(saslSslKafkaBootStrap);
saslSetup(props);
sslSetup(props);
saslSslSetup(props);
KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
consumer.subscribe(Collections.singletonList("test-sasl-ssl-consumer"));
return consumer;
}

@Singleton
@ApplicationScoped // don't create bean when testing Kafka SSL
@Produces
@Named("kafka-producer-sasl-ssl")
KafkaProducer<String, String> getSaslSslProducer() {
Properties props = setupProducerProperties(saslSslKafkaBootStrap);
saslSetup(props);
sslSetup(props);
saslSslSetup(props);
return new KafkaProducer<>(props);
}

@Singleton
@ApplicationScoped // don't create bean when testing Kafka SSL
@Produces
@Named("kafka-admin-sasl-ssl")
AdminClient getSaslSslAdmin() {
Properties props = setupConsumerProperties(saslSslKafkaBootStrap);
saslSetup(props);
sslSetup(props);
saslSslSetup(props);
return KafkaAdminClient.create(props);
}

private static void saslSetup(Properties props) {
props.setProperty(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SASL_SSL");
props.setProperty(SaslConfigs.SASL_MECHANISM, "SCRAM-SHA-512");
props.setProperty(SaslConfigs.SASL_JAAS_CONFIG,
"org.apache.kafka.common.security.scram.ScramLoginModule required username=\"%s\" password=\"%s\";"
.formatted(SASL_USERNAME_VALUE, SASL_PASSWORD_VALUE));
}

protected void sslSetup(Properties props) {
File tsFile = new File(trustStoreFile);
props.setProperty(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, tsFile.getPath());
props.setProperty(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, trustStorePassword);
props.setProperty(SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG, trustStoreType);
protected void saslSslSetup(Properties props) {
props.putAll(defaultKafkaBrokerConfig);
props.setProperty(SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG, "");
}
}
Loading