Skip to content

Commit

Permalink
Merge pull request #42992 from gsmet/3.14.2-backports-2
Browse files Browse the repository at this point in the history
[3.14] 3.14.2 backports 2
  • Loading branch information
gsmet committed Sep 4, 2024
2 parents 5deaa44 + a1b0ede commit 75b8a98
Show file tree
Hide file tree
Showing 28 changed files with 509 additions and 197 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ updates:
- dependency-name: org.glassfish:jakarta-el
- dependency-name: com.google.cloud.tools:jib-core
- dependency-name: org.jboss.threads:jboss-threads
- dependency-name: org.jboss.marshalling:*
# Quarkus
- dependency-name: io.quarkus.*:*
- dependency-name: io.quarkus:*
Expand Down
4 changes: 2 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<wildfly-common.version>1.7.0.Final</wildfly-common.version>
<wildfly-client-config.version>1.0.1.Final</wildfly-client-config.version>
<wildfly-elytron.version>2.5.2.Final</wildfly-elytron.version>
<jboss-marshalling.version>2.1.4.SP1</jboss-marshalling.version>
<jboss-marshalling.version>2.2.0.Final</jboss-marshalling.version>
<jboss-threads.version>3.6.1.Final</jboss-threads.version>
<vertx.version>4.5.9</vertx.version>
<httpclient.version>4.5.14</httpclient.version>
Expand Down Expand Up @@ -161,7 +161,7 @@
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.2</awaitility.version>
<jboss-logmanager.version>3.0.6.Final</jboss-logmanager.version>
<flyway.version>10.17.1</flyway.version>
<flyway.version>10.17.3</flyway.version>
<yasson.version>3.0.4</yasson.version>
<!-- liquibase-mongodb is not released everytime with liquibase anymore, but the two versions need to be compatible -->
<liquibase.version>4.29.1</liquibase.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nat
}
String executableName = getNativeImageExecutableName();
String errorMessage = "Cannot find the `" + executableName
+ "` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`.";
+ "` in the GRAALVM_HOME, JAVA_HOME and System PATH.";
if (!SystemUtils.IS_OS_LINUX) {
// Delay the error: if we're just building native sources, we may not need the build runner at all.
return new NativeImageRunnerBuildItem(new NativeImageBuildRunnerError(errorMessage));
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/scripting.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ INFO: Building native image source jar: /tmp/quarkus-jbang8082065952748314720/qu
Mar 22, 2023 9:58:47 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildStep build
INFO: Building native image from /tmp/quarkus-jbang8082065952748314720/quarkus-application-native-image-source-jar/quarkus-application-runner.jar
Mar 22, 2023 9:58:47 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildStep getNativeImageBuildRunner
WARN: Cannot find the `native-image` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image` Attempting to fall back to container build.
WARN: Cannot find the `native-image` in the GRAALVM_HOME, JAVA_HOME and System PATH. Attempting to fall back to container build.
Mar 22, 2023 9:58:47 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner <init>
INFO: Using docker to run the native image builder
Mar 22, 2023 9:58:47 A.M. io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner setup
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/security-oauth2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class TokenSecuredResourceTest {
void testPermitAll() {
RestAssured.given()
.when()
.header("Authorization", "Bearer: " + BEARER_TOKEN) // <3>
.header("Authorization", "Bearer " + BEARER_TOKEN) // <3>
.get("/secured/permit-all")
.then()
.statusCode(200)
Expand All @@ -429,7 +429,7 @@ class TokenSecuredResourceTest {
void testRolesAllowed() {
RestAssured.given()
.when()
.header("Authorization", "Bearer: " + BEARER_TOKEN)
.header("Authorization", "Bearer " + BEARER_TOKEN)
.get("/secured/roles-allowed")
.then()
.statusCode(200)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
import static io.quarkus.kubernetes.spi.KubernetesDeploymentTargetBuildItem.DEFAULT_PRIORITY;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import io.dekorate.knative.decorator.AddAwsElasticBlockStoreVolumeToRevisionDecorator;
Expand All @@ -20,21 +23,31 @@
import io.dekorate.knative.decorator.AddPvcVolumeToRevisionDecorator;
import io.dekorate.knative.decorator.AddSecretVolumeToRevisionDecorator;
import io.dekorate.knative.decorator.AddSidecarToRevisionDecorator;
import io.dekorate.knative.decorator.ApplyAnnotationsToServiceTemplate;
import io.dekorate.knative.decorator.ApplyGlobalAutoscalingClassDecorator;
import io.dekorate.knative.decorator.ApplyGlobalContainerConcurrencyDecorator;
import io.dekorate.knative.decorator.ApplyGlobalRequestsPerSecondTargetDecorator;
import io.dekorate.knative.decorator.ApplyGlobalTargetUtilizationDecorator;
import io.dekorate.knative.decorator.ApplyLocalAutoscalingClassDecorator;
import io.dekorate.knative.decorator.ApplyLocalAutoscalingMetricDecorator;
import io.dekorate.knative.decorator.ApplyLocalAutoscalingTargetDecorator;
import io.dekorate.knative.decorator.ApplyLocalContainerConcurrencyDecorator;
import io.dekorate.knative.decorator.ApplyLocalTargetUtilizationPercentageDecorator;
import io.dekorate.knative.decorator.ApplyMaxScaleDecorator;
import io.dekorate.knative.decorator.ApplyMinScaleDecorator;
import io.dekorate.knative.decorator.ApplyRevisionNameDecorator;
import io.dekorate.knative.decorator.ApplyServiceAccountToRevisionSpecDecorator;
import io.dekorate.knative.decorator.ApplyTrafficDecorator;
import io.dekorate.kubernetes.config.ConfigMapVolumeBuilder;
import io.dekorate.kubernetes.config.EnvBuilder;
import io.dekorate.kubernetes.config.MountBuilder;
import io.dekorate.kubernetes.config.Port;
import io.dekorate.kubernetes.config.SecretVolumeBuilder;
import io.dekorate.kubernetes.decorator.AddConfigMapDataDecorator;
import io.dekorate.kubernetes.decorator.AddConfigMapResourceProvidingDecorator;
import io.dekorate.kubernetes.decorator.AddEnvVarDecorator;
import io.dekorate.kubernetes.decorator.AddImagePullSecretToServiceAccountDecorator;
import io.dekorate.kubernetes.decorator.AddLabelDecorator;
import io.dekorate.kubernetes.decorator.AddMountDecorator;
import io.dekorate.kubernetes.decorator.AddServiceAccountResourceDecorator;
import io.dekorate.kubernetes.decorator.ApplicationContainerDecorator;
import io.dekorate.kubernetes.decorator.ApplyImagePullPolicyDecorator;
Expand Down Expand Up @@ -75,14 +88,6 @@ public class KnativeProcessor {
private static final String KNATIVE_CONFIG_AUTOSCALER = "config-autoscaler";
private static final String KNATIVE_CONFIG_DEFAULTS = "config-defaults";
private static final String KNATIVE_SERVING = "knative-serving";
private static final String KNATIVE_MIN_SCALE = "autoscaling.knative.dev/minScale";
private static final String KNATIVE_MAX_SCALE = "autoscaling.knative.dev/maxScale";
private static final String KNATIVE_AUTOSCALING_METRIC = "autoscaling.knative.dev/metric";
private static final String KNATIVE_AUTOSCALING_CLASS = "autoscaling.knative.dev/class";
private static final String KNATIVE_AUTOSCALING_CLASS_SUFFIX = ".autoscaling.knative.dev";
private static final String KNATIVE_UTILIZATION_PERCENTAGE = "autoscaling.knative.dev/target-utilization-percentage";
private static final String KNATIVE_AUTOSCALING_TARGET = "autoscaling.knative.dev/target";
private static final String KNATIVE_CONTAINER_CONCURRENCY = "container-concurrency";
private static final String KNATIVE_DEV_VISIBILITY = "networking.knative.dev/visibility";

@BuildStep
Expand Down Expand Up @@ -194,55 +199,20 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic
result.add(new DecoratorBuildItem(KNATIVE,
new AddLabelDecorator(name, KNATIVE_DEV_VISIBILITY, "cluster-local")));
}

}

/**
* Once the Dekorate issue is fixed https://github.com/dekorateio/dekorate/issues/869,
* we should replace ApplyAnnotationsToServiceTemplate by ApplyMinScaleDecorator.
*/
config.minScale.map(String::valueOf).ifPresent(min -> result.add(new DecoratorBuildItem(KNATIVE,
new ApplyAnnotationsToServiceTemplate(name, KNATIVE_MIN_SCALE, min))));
/**
* Once the Dekorate issue is fixed https://github.com/dekorateio/dekorate/issues/869,
* we should replace ApplyAnnotationsToServiceTemplate by ApplyMaxScaleDecorator.
*/
config.maxScale.map(String::valueOf).ifPresent(max -> result.add(new DecoratorBuildItem(KNATIVE,
new ApplyAnnotationsToServiceTemplate(name, KNATIVE_MAX_SCALE, max))));
/**
* Once the Dekorate issue is fixed https://github.com/dekorateio/dekorate/issues/869,
* we should replace ApplyAnnotationsToServiceTemplate by ApplyLocalAutoscalingClassDecorator.
*/
config.minScale.ifPresent(min -> result.add(new DecoratorBuildItem(KNATIVE, new ApplyMinScaleDecorator(name, min))));
config.maxScale.ifPresent(max -> result.add(new DecoratorBuildItem(KNATIVE, new ApplyMaxScaleDecorator(name, max))));
config.revisionAutoScaling.autoScalerClass.map(AutoScalerClassConverter::convert)
.ifPresent(a -> result.add(new DecoratorBuildItem(KNATIVE, new ApplyAnnotationsToServiceTemplate(name,
KNATIVE_AUTOSCALING_CLASS, a.name().toLowerCase() + KNATIVE_AUTOSCALING_CLASS_SUFFIX))));
/**
* Once the Dekorate issue is fixed https://github.com/dekorateio/dekorate/issues/869,
* we should replace ApplyAnnotationsToServiceTemplate by ApplyLocalAutoscalingMetricDecorator.
*/
.ifPresent(a -> result.add(new DecoratorBuildItem(KNATIVE, new ApplyLocalAutoscalingClassDecorator(name, a))));
config.revisionAutoScaling.metric.map(AutoScalingMetricConverter::convert)
.ifPresent(m -> result.add(new DecoratorBuildItem(KNATIVE,
new ApplyAnnotationsToServiceTemplate(name, KNATIVE_AUTOSCALING_METRIC, m.name().toLowerCase()))));

config.revisionAutoScaling.containerConcurrency
.ifPresent(
c -> result.add(new DecoratorBuildItem(KNATIVE, new ApplyLocalContainerConcurrencyDecorator(name, c))));

/**
* Once the Dekorate issue is fixed https://github.com/dekorateio/dekorate/issues/869,
* we should replace ApplyAnnotationsToServiceTemplate by ApplyLocalTargetUtilizationPercentageDecorator.
*/
config.revisionAutoScaling.targetUtilizationPercentage.map(String::valueOf)
.ifPresent(t -> result
.add(new DecoratorBuildItem(KNATIVE,
new ApplyAnnotationsToServiceTemplate(name, KNATIVE_UTILIZATION_PERCENTAGE, t))));
/**
* Once the Dekorate issue is fixed https://github.com/dekorateio/dekorate/issues/869,
* we should replace ApplyAnnotationsToServiceTemplate by ApplyLocalAutoscalingTargetDecorator.
*/
config.revisionAutoScaling.target.map(String::valueOf)
.ifPresent(t -> result.add(new DecoratorBuildItem(KNATIVE,
new ApplyAnnotationsToServiceTemplate(name, KNATIVE_AUTOSCALING_TARGET, t))));
.ifPresent(m -> result.add(new DecoratorBuildItem(KNATIVE, new ApplyLocalAutoscalingMetricDecorator(name, m))));
config.revisionAutoScaling.containerConcurrency.ifPresent(
c -> result.add(new DecoratorBuildItem(KNATIVE, new ApplyLocalContainerConcurrencyDecorator(name, c))));
config.revisionAutoScaling.targetUtilizationPercentage.ifPresent(t -> result
.add(new DecoratorBuildItem(KNATIVE, new ApplyLocalTargetUtilizationPercentageDecorator(name, t))));
config.revisionAutoScaling.target
.ifPresent(t -> result.add(new DecoratorBuildItem(KNATIVE, new ApplyLocalAutoscalingTargetDecorator(name, t))));
config.globalAutoScaling.autoScalerClass
.map(AutoScalerClassConverter::convert)
.ifPresent(a -> {
Expand All @@ -251,17 +221,11 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic
new AddConfigMapResourceProvidingDecorator(KNATIVE_CONFIG_AUTOSCALER, KNATIVE_SERVING)));
result.add(new DecoratorBuildItem(KNATIVE, new ApplyGlobalAutoscalingClassDecorator(a)));
});
config.globalAutoScaling.containerConcurrency.map(String::valueOf)
.ifPresent(c -> {
result.add(new DecoratorBuildItem(KNATIVE,
new AddConfigMapResourceProvidingDecorator(KNATIVE_CONFIG_DEFAULTS, KNATIVE_SERVING)));
/**
* Once the Dekorate issue is fixed https://github.com/dekorateio/dekorate/issues/869,
* we should replace ApplyAnnotationsToServiceTemplate by ApplyGlobalContainerConcurrencyDecorator.
*/
result.add(new DecoratorBuildItem(KNATIVE,
new AddConfigMapDataDecorator(KNATIVE_CONFIG_DEFAULTS, KNATIVE_CONTAINER_CONCURRENCY, c)));
});
config.globalAutoScaling.containerConcurrency.ifPresent(c -> {
result.add(new DecoratorBuildItem(KNATIVE,
new AddConfigMapResourceProvidingDecorator(KNATIVE_CONFIG_DEFAULTS, KNATIVE_SERVING)));
result.add(new DecoratorBuildItem(KNATIVE, new ApplyGlobalContainerConcurrencyDecorator(c)));
});

config.globalAutoScaling.requestsPerSecond
.ifPresent(r -> {
Expand Down Expand Up @@ -311,6 +275,7 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic

//Add revision decorators
result.addAll(createVolumeDecorators(project, name, config));
result.addAll(createAppConfigVolumeAndEnvDecorators(project, name, config));
config.getHostAliases().entrySet().forEach(e -> {
result.add(new DecoratorBuildItem(KNATIVE,
new AddHostAliasesToRevisionDecorator(name, HostAliasConverter.convert(e))));
Expand Down Expand Up @@ -375,4 +340,45 @@ private static List<DecoratorBuildItem> createVolumeDecorators(Optional<Project>
});
return result;
}

private static List<DecoratorBuildItem> createAppConfigVolumeAndEnvDecorators(Optional<Project> project, String name,
PlatformConfiguration config) {

List<DecoratorBuildItem> result = new ArrayList<>();
Set<String> paths = new HashSet<>();

config.getAppSecret().ifPresent(s -> {
result.add(new DecoratorBuildItem(KNATIVE, new AddSecretVolumeToRevisionDecorator(new SecretVolumeBuilder()
.withSecretName(s)
.withVolumeName("app-secret")
.build())));
result.add(new DecoratorBuildItem(KNATIVE, new AddMountDecorator(new MountBuilder()
.withName("app-secret")
.withPath("/mnt/app-secret")
.build())));
paths.add("/mnt/app-secret");
});

config.getAppConfigMap().ifPresent(s -> {
result.add(new DecoratorBuildItem(KNATIVE, new AddConfigMapVolumeToRevisionDecorator(new ConfigMapVolumeBuilder()
.withConfigMapName(s)
.withVolumeName("app-config-map")
.build())));
result.add(new DecoratorBuildItem(KNATIVE, new AddMountDecorator(new MountBuilder()
.withName("app-config-map")
.withPath("/mnt/app-config-map")
.build())));
paths.add("/mnt/app-config-map");
});

if (!paths.isEmpty()) {
result.add(new DecoratorBuildItem(KNATIVE,
new AddEnvVarDecorator(ApplicationContainerDecorator.ANY, name, new EnvBuilder()
.withName("SMALLRYE_CONFIG_LOCATIONS")
.withValue(paths.stream().collect(Collectors.joining(",")))
.build())));
}
return result;
}

}
Loading

0 comments on commit 75b8a98

Please sign in to comment.