Skip to content

Commit

Permalink
[CAMEL-21451] Migrate to JKube generated resources for all runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
tdiesler committed Nov 15, 2024
1 parent 14b897e commit 4c397e3
Show file tree
Hide file tree
Showing 22 changed files with 1,016 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,15 @@ private void createMavenPom(File settings, File pom, Set<String> deps) throws Ex
camelVersion = catalog.getCatalogVersion();
}

context = context.replaceFirst("\\{\\{ \\.GroupId }}", ids[0]);
context = context.replaceFirst("\\{\\{ \\.ArtifactId }}", ids[1]);
context = context.replaceFirst("\\{\\{ \\.Version }}", ids[2]);
context = context.replaceFirst("\\{\\{ \\.QuarkusGroupId }}", quarkusGroupId);
context = context.replaceFirst("\\{\\{ \\.QuarkusArtifactId }}", quarkusArtifactId);
context = context.replaceAll("\\{\\{ \\.GroupId }}", ids[0]);
context = context.replaceAll("\\{\\{ \\.ArtifactId }}", ids[1]);
context = context.replaceAll("\\{\\{ \\.Version }}", ids[2]);
context = context.replaceAll("\\{\\{ \\.QuarkusGroupId }}", quarkusGroupId);
context = context.replaceAll("\\{\\{ \\.QuarkusArtifactId }}", quarkusArtifactId);
context = context.replaceAll("\\{\\{ \\.QuarkusVersion }}", quarkusVersion);
context = context.replaceFirst("\\{\\{ \\.JavaVersion }}", javaVersion);
context = context.replaceFirst("\\{\\{ \\.CamelVersion }}", camelVersion);
context = context.replaceFirst("\\{\\{ \\.ProjectBuildOutputTimestamp }}", this.getBuildMavenProjectDate());
context = context.replaceAll("\\{\\{ \\.JavaVersion }}", javaVersion);
context = context.replaceAll("\\{\\{ \\.CamelVersion }}", camelVersion);
context = context.replaceAll("\\{\\{ \\.ProjectBuildOutputTimestamp }}", this.getBuildMavenProjectDate());

context = replaceBuildProperties(context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,19 @@
</plugin>
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>${camel.main.jkube.maven.plugin}</artifactId>
<version>${camel.main.jkube.version}</version>
<artifactId>${jkube.maven.plugin}</artifactId>
<version>${jkube.version}</version>
<configuration>
<imagePullPolicy>${camel.main.kubernetes.image-pull-policy}</imagePullPolicy>
<buildStrategy>${jkube.build.strategy}</buildStrategy>
<images>
<image>
<name>${camel.main.kubernetes.image-name}</name>
<build>
<from>eclipse-temurin:{{ .JavaVersion }}</from>
<!-- Supported only when using the jib build strategy -->
<createImageOptions>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</createImageOptions>
<ports>
<port>${camel.main.kubernetes.ports.http.container-port}</port>
</ports>
<entryPoint>
<exec>
<arg>java</arg>
Expand Down Expand Up @@ -175,7 +170,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
<!-- For symmetry with Quarkus, copy kubernetes.yml to the same target location -->
<!-- Copy kubernetes resources to target/kubernetes -->
<outputDirectory>${project.build.directory}/kubernetes</outputDirectory>
<resources>
<resource>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>

<groupId>{{ .GroupId }}</groupId>
<artifactId>{{ .ArtifactId }}</artifactId>
<version>{{ .Version }}</version>

<properties>
<project.build.outputTimestamp>{{ .ProjectBuildOutputTimestamp }}</project.build.outputTimestamp>
<compiler-plugin.version>3.13.0</compiler-plugin.version>
<failsafe.useModulePath>false</failsafe.useModulePath>
<maven.compiler.release>{{ .JavaVersion }}</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.group-id>{{ .QuarkusGroupId }}</quarkus.platform.group-id>
<quarkus.platform.artifact-id>{{ .QuarkusArtifactId }}</quarkus.platform.artifact-id>
<quarkus.platform.version>{{ .QuarkusVersion }}</quarkus.platform.version>
{{ .BuildProperties }}
<skipITs>true</skipITs>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-camel-bom</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

{{ .MavenRepositories }}

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-microprofile-health</artifactId>
</dependency>
{{ .CamelDependencies }}

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>${jkube.maven.plugin}</artifactId>
<version>${jkube.version}</version>
<configuration>
<buildStrategy>${jkube.build.strategy}</buildStrategy>
<images>
<image>
<build>
<from>eclipse-temurin:{{ .JavaVersion }}</from>
<!-- Supported only when using the jib build strategy -->
<createImageOptions>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</createImageOptions>
<assembly>
<layers>
<layer>
<id>quarkus-files</id>
<fileSets>
<fileSet>
<directory>${project.build.directory}/quarkus-app</directory>
<outputDirectory>quarkus</outputDirectory>
</fileSet>
</fileSets>
</layer>
</layers>
</assembly>
<entryPoint>
<exec>
<arg>java</arg>
<arg>-jar</arg>
<arg>/maven/quarkus/quarkus-run.jar</arg>
</exec>
</entryPoint>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>resource</goal>
<goal>push</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<!-- Copy kubernetes resources to target/kubernetes -->
<outputDirectory>${project.build.directory}/kubernetes</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/classes/META-INF/jkube</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<skipITs>false</skipITs>
<quarkus.package.type>native</quarkus.package.type>
</properties>
</profile>
<profile>
<id>camel.debug</id>
<activation>
<property>
<name>camel.debug</name>
<value>true</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-debug</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.1</version>
<executions>
<execution>
<id>copy</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-agent-jvm</artifactId>
<version>2.1.0</version>
<type>jar</type>
<classifier>javaagent</classifier>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<configuration>
<jvmArgs>-Dcamel.main.shutdownTimeout=30 -Dquarkus.camel.source-location-enabled=true -javaagent:target/dependency/jolokia-agent-jvm-javaagent.jar=port=7878,host=localhost</jvmArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Loading

0 comments on commit 4c397e3

Please sign in to comment.