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

Upgrade Optaplanner to Quarkus 3.8.0 #3070

Closed
wants to merge 5 commits into from
Closed
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
4 changes: 2 additions & 2 deletions build/optaplanner-build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<version.ch.qos.logback>1.4.6</version.ch.qos.logback>
<version.org.apache.logging.log4j>2.20.0</version.org.apache.logging.log4j>
<version.com.thoughtworks.xstream>1.4.20</version.com.thoughtworks.xstream>
<version.io.quarkiverse.operatorsdk>6.0.3</version.io.quarkiverse.operatorsdk>
<version.io.quarkus>3.2.10.Final</version.io.quarkus>
<version.io.quarkiverse.operatorsdk>6.6.4</version.io.quarkiverse.operatorsdk>
<version.io.quarkus>3.8.3</version.io.quarkus>
<version.org.apache.commons.math3>3.6.1</version.org.apache.commons.math3>
<version.org.apache.commons.text>1.10.0</version.org.apache.commons.text>
<version.org.apache.openjpa>4.0.0</version.org.apache.openjpa>
Expand Down
13 changes: 0 additions & 13 deletions optaplanner-operator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@
<java.module.name>org.optaplanner.operator</java.module.name>
</properties>

<!-- TODO: Remove when OptaPlanner no longer supports Quarkus 2.13 -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${version.io.quarkus}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkiverse.operatorsdk</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
import io.javaoperatorsdk.operator.processing.event.ResourceID;
import io.javaoperatorsdk.operator.processing.event.source.EventSource;
import io.quarkiverse.operatorsdk.runtime.QuarkusConfigurationService;

@ControllerConfiguration(name = "optaplanner-solver")
public final class OptaPlannerSolverReconciler implements Reconciler<OptaPlannerSolver>, ErrorStatusHandler<OptaPlannerSolver>,
Expand All @@ -61,13 +62,17 @@ public final class OptaPlannerSolverReconciler implements Reconciler<OptaPlanner
private final ScaledObjectDependentResource scaledObjectDependentResource;

@Inject
public OptaPlannerSolverReconciler(KubernetesClient kubernetesClient) {
deploymentDependentResource = new DeploymentDependentResource(kubernetesClient);
inputQueueDependentResource = new ArtemisQueueDependentResource(MessageAddress.INPUT, kubernetesClient);
outputQueueDependentResource = new ArtemisQueueDependentResource(MessageAddress.OUTPUT, kubernetesClient);
configMapDependentResource = new ConfigMapDependentResource(kubernetesClient);
triggerAuthenticationDependentResource = new TriggerAuthenticationDependentResource(kubernetesClient);
scaledObjectDependentResource = new ScaledObjectDependentResource(kubernetesClient);
QuarkusConfigurationService configurationService;

@Inject
public OptaPlannerSolverReconciler() {

deploymentDependentResource = new DeploymentDependentResource();
inputQueueDependentResource = new ArtemisQueueDependentResource(MessageAddress.INPUT);
outputQueueDependentResource = new ArtemisQueueDependentResource(MessageAddress.OUTPUT);
configMapDependentResource = new ConfigMapDependentResource();
triggerAuthenticationDependentResource = new TriggerAuthenticationDependentResource();
scaledObjectDependentResource = new ScaledObjectDependentResource();

inputQueueDependentResource.setResourceDiscriminator(new ResourceIDMatcherDiscriminator<>(
optaPlannerSolver -> new ResourceID(optaPlannerSolver.getInputMessageAddressName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import io.fabric8.kubernetes.api.model.ConfigMap;
import io.fabric8.kubernetes.api.model.ConfigMapBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent;
Expand All @@ -37,9 +36,8 @@ public final class ConfigMapDependentResource extends CRUDKubernetesDependentRes
public static final String SOLVER_MESSAGE_AMQ_HOST_KEY = "solver.amq.host";
public static final String SOLVER_MESSAGE_AMQ_PORT_KEY = "solver.amq.port";

public ConfigMapDependentResource(KubernetesClient kubernetesClient) {
public ConfigMapDependentResource() {
super(ConfigMap.class);
setKubernetesClient(kubernetesClient);
}

@Override
Expand All @@ -63,7 +61,7 @@ protected ConfigMap desired(OptaPlannerSolver solver, Context<OptaPlannerSolver>
public ConfigMap update(ConfigMap actual, ConfigMap target, OptaPlannerSolver solver, Context<OptaPlannerSolver> context) {
ConfigMap resultingConfigMap = super.update(actual, target, solver, context);
String namespace = actual.getMetadata().getNamespace();
getKubernetesClient()
context.getClient()
.pods()
.inNamespace(namespace)
.withLabel("app", solver.getMetadata().getName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder;
import io.fabric8.kubernetes.api.model.apps.DeploymentSpecBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent;
Expand All @@ -47,9 +46,8 @@ public final class DeploymentDependentResource extends CRUDKubernetesDependentRe
private static final String ENV_AMQ_USERNAME = "SOLVER_MESSAGE_AMQ_USERNAME";
private static final String ENV_AMQ_PASSWORD = "SOLVER_MESSAGE_AMQ_PASSWORD";

public DeploymentDependentResource(KubernetesClient k8s) {
public DeploymentDependentResource() {
super(Deployment.class);
setKubernetesClient(k8s);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent;
Expand Down Expand Up @@ -75,9 +74,8 @@ public final class ScaledObjectDependentResource extends CRUDKubernetesDependent
*/
private static final int TARGET_QUEUE_LENGTH = 1;

public ScaledObjectDependentResource(KubernetesClient kubernetesClient) {
public ScaledObjectDependentResource() {
super(ScaledObject.class);
setKubernetesClient(kubernetesClient);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.fabric8.kubernetes.api.model.SecretKeySelector;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent;
Expand Down Expand Up @@ -54,9 +53,8 @@ public final class TriggerAuthenticationDependentResource
public static final String PARAM_USERNAME = "username";
public static final String PARAM_PASSWORD = "password";

public TriggerAuthenticationDependentResource(KubernetesClient kubernetesClient) {
public TriggerAuthenticationDependentResource() {
super(TriggerAuthentication.class);
setKubernetesClient(kubernetesClient);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@

import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource;
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent;

@KubernetesDependent
public final class ArtemisQueueDependentResource extends CRUDKubernetesDependentResource<ArtemisQueue, OptaPlannerSolver> {

public ArtemisQueueDependentResource(MessageAddress messageAddress, KubernetesClient kubernetesClient) {
public ArtemisQueueDependentResource(MessageAddress messageAddress) {
super(ArtemisQueue.class);
this.messageAddress = messageAddress;
setKubernetesClient(kubernetesClient);
}

private final MessageAddress messageAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@
# under the License.
#


quarkus.operator-sdk.crd.apply=true

# New version of the operator use SSA, a different algorithm for creating resources
# that needs some changes. In the meanwhile this feature flag reverts to the old behaviour
# See https://javaoperatorsdk.io/docs/dependent-resources#comparing-desired-and-actual-state-matching
# And https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java#L332-L358
quarkus.operator-sdk.enable-ssa=false

quarkus.log.category."io.quarkiverse.operatorsdk".level=ERROR

########################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,30 +123,6 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- Remove comments from META-INF/quarkus-extension.properties -->
<!-- This is needed because the file generated by quarkus contains a timestamp in a comment that makes the build not reproducible -->
<!-- This workaround can be removed when drools will be migrated to quarkus release containing this fix https://github.com/quarkusio/quarkus/pull/38365 -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.maven-exec-plugin}</version>
<executions>
<execution>
<id>Remove comments from quarkus-extension.properties</id>
<phase>prepare-package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>org.drools.util.RemoveCommentsMain</mainClass>
<arguments>
<argument>${project.basedir}/target/classes/META-INF/quarkus-javadoc.properties</argument>
<argument>${project.basedir}/target/generated-sources/annotations/org/optaplanner/benchmark/quarkus/deployment/OptaPlannerBenchmarkBuildTimeConfig.jdp</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,6 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- Remove comments from META-INF/quarkus-extension.properties -->
<!-- This is needed because the file generated by quarkus contains a timestamp in a comment that makes the build not reproducible -->
<!-- This workaround can be removed when drools will be migrated to quarkus release containing this fix https://github.com/quarkusio/quarkus/pull/38365 -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.maven-exec-plugin}</version>
<executions>
<execution>
<id>Remove comments from quarkus-extension.properties</id>
<phase>prepare-package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>org.drools.util.RemoveCommentsMain</mainClass>
<arguments>
<argument>${project.basedir}/target/classes/META-INF/quarkus-extension.properties</argument>
<argument>${project.basedir}/target/classes/META-INF/quarkus-javadoc.properties</argument>
<argument>${project.basedir}/target/generated-sources/annotations/org/optaplanner/benchmark/quarkus/config/OptaPlannerBenchmarkRuntimeConfig.jdp</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -75,37 +75,6 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<!-- Remove comments from META-INF/quarkus-extension.properties -->
<!-- This is needed because the file generated by quarkus contains a timestamp in a comment that makes the build not reproducible -->
<!-- This workaround can be removed when drools will be migrated to quarkus release containing this fix https://github.com/quarkusio/quarkus/pull/38365 -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.maven-exec-plugin}</version>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-util</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>Remove comments from quarkus-extension.properties</id>
<phase>prepare-package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>org.drools.util.RemoveCommentsMain</mainClass>
<arguments>
<argument>${project.basedir}/target/classes/META-INF/quarkus-javadoc.properties</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,37 +102,6 @@
</ignoredUnusedDeclaredDependencies>
</configuration>
</plugin>
<plugin>
<!-- Remove comments from META-INF/quarkus-extension.properties -->
<!-- This is needed because the file generated by quarkus contains a timestamp in a comment that makes the build not reproducible -->
<!-- This workaround can be removed when drools will be migrated to quarkus release containing this fix https://github.com/quarkusio/quarkus/pull/38365 -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.maven-exec-plugin}</version>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-util</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>Remove comments from quarkus-extension.properties</id>
<phase>prepare-package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>org.drools.util.RemoveCommentsMain</mainClass>
<arguments>
<argument>${project.basedir}/target/classes/META-INF/quarkus-extension.properties</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -75,37 +75,6 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<!-- Remove comments from META-INF/quarkus-extension.properties -->
<!-- This is needed because the file generated by quarkus contains a timestamp in a comment that makes the build not reproducible -->
<!-- This workaround can be removed when drools will be migrated to quarkus release containing this fix https://github.com/quarkusio/quarkus/pull/38365 -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.maven-exec-plugin}</version>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-util</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>Remove comments from quarkus-extension.properties</id>
<phase>prepare-package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>org.drools.util.RemoveCommentsMain</mainClass>
<arguments>
<argument>${project.basedir}/target/classes/META-INF/quarkus-javadoc.properties</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -94,37 +94,6 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<!-- Remove comments from META-INF/quarkus-extension.properties -->
<!-- This is needed because the file generated by quarkus contains a timestamp in a comment that makes the build not reproducible -->
<!-- This workaround can be removed when drools will be migrated to quarkus release containing this fix https://github.com/quarkusio/quarkus/pull/38365 -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.maven-exec-plugin}</version>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-util</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>Remove comments from quarkus-extension.properties</id>
<phase>prepare-package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>org.drools.util.RemoveCommentsMain</mainClass>
<arguments>
<argument>${project.basedir}/target/classes/META-INF/quarkus-extension.properties</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading
Loading