Skip to content
This repository was archived by the owner on Dec 26, 2020. It is now read-only.

Commit e56833f

Browse files
committed
add quarkus
depends on unreleased code in the sdk (https://github.com/ContainerSolutions/java-operator-sdk/pull/210)
1 parent 6938b05 commit e56833f

File tree

7 files changed

+84
-37
lines changed

7 files changed

+84
-37
lines changed

Diff for: deps.txt

-27.1 KB
Binary file not shown.

Diff for: pom.xml

+54-25
Original file line numberDiff line numberDiff line change
@@ -10,62 +10,91 @@
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13-
<java-operator-sdk.version>1.3.0</java-operator-sdk.version>
13+
<quarkus-plugin.version>1.8.1.Final</quarkus-plugin.version>
14+
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
15+
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
16+
<quarkus.platform.version>1.8.3.Final</quarkus.platform.version>
17+
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
18+
<compiler-plugin.version>3.8.1</compiler-plugin.version>
19+
<maven.compiler.parameters>true</maven.compiler.parameters>
1420
<maven.compiler.source>11</maven.compiler.source>
1521
<maven.compiler.target>11</maven.compiler.target>
16-
<jib-maven-plugin.version>2.5.2</jib-maven-plugin.version>
22+
<java-operator-sdk.version>1.3.1-SNAPSHOT</java-operator-sdk.version>
1723
</properties>
1824

25+
<dependencyManagement>
26+
<dependencies>
27+
<dependency>
28+
<groupId>${quarkus.platform.group-id}</groupId>
29+
<artifactId>${quarkus.platform.artifact-id}</artifactId>
30+
<version>${quarkus.platform.version}</version>
31+
<type>pom</type>
32+
<scope>import</scope>
33+
</dependency>
34+
</dependencies>
35+
</dependencyManagement>
36+
1937
<dependencies>
2038
<dependency>
2139
<groupId>com.github.containersolutions</groupId>
2240
<artifactId>operator-framework</artifactId>
2341
<version>${java-operator-sdk.version}</version>
42+
<exclusions>
43+
<exclusion>
44+
<groupId>io.fabric8</groupId>
45+
<artifactId>openshift-client</artifactId>
46+
</exclusion>
47+
</exclusions>
2448
</dependency>
49+
2550
<dependency>
26-
<groupId>org.apache.logging.log4j</groupId>
27-
<artifactId>log4j-slf4j-impl</artifactId>
28-
<version>2.13.3</version>
51+
<groupId>io.fabric8</groupId>
52+
<artifactId>kubernetes-client</artifactId>
2953
</dependency>
3054
<dependency>
31-
<groupId>org.takes</groupId>
32-
<artifactId>takes</artifactId>
33-
<version>1.19</version>
55+
<groupId>io.quarkus</groupId>
56+
<artifactId>quarkus-resteasy</artifactId>
3457
</dependency>
3558
<dependency>
36-
<groupId>commons-io</groupId>
37-
<artifactId>commons-io</artifactId>
38-
<version>2.6</version>
59+
<groupId>io.quarkus</groupId>
60+
<artifactId>quarkus-junit5</artifactId>
61+
<scope>test</scope>
62+
</dependency>
63+
<dependency>
64+
<groupId>io.quarkus</groupId>
65+
<artifactId>quarkus-container-image-jib</artifactId>
3966
</dependency>
4067
</dependencies>
4168

4269
<build>
4370
<plugins>
4471
<plugin>
45-
<groupId>com.google.cloud.tools</groupId>
46-
<artifactId>jib-maven-plugin</artifactId>
47-
<version>${jib-maven-plugin.version}</version>
48-
<configuration>
49-
<from>
50-
<image>gcr.io/distroless/java:11</image>
51-
</from>
52-
<to>
53-
<image>eu.gcr.io/adamsandor-test/tomcat-operator</image>
54-
</to>
55-
</configuration>
72+
<groupId>io.quarkus</groupId>
73+
<artifactId>quarkus-maven-plugin</artifactId>
74+
<version>${quarkus-plugin.version}</version>
5675
<executions>
5776
<execution>
58-
<phase>package</phase>
5977
<goals>
78+
<goal>generate-code</goal>
79+
<goal>generate-code-tests</goal>
6080
<goal>build</goal>
6181
</goals>
6282
</execution>
6383
</executions>
6484
</plugin>
6585
<plugin>
66-
<groupId>org.apache.maven.plugins</groupId>
6786
<artifactId>maven-compiler-plugin</artifactId>
68-
<version>3.8.1</version>
87+
<version>${compiler-plugin.version}</version>
88+
</plugin>
89+
<plugin>
90+
<artifactId>maven-surefire-plugin</artifactId>
91+
<version>${surefire-plugin.version}</version>
92+
<configuration>
93+
<systemPropertyVariables>
94+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
95+
<maven.home>${maven.home}</maven.home>
96+
</systemPropertyVariables>
97+
</configuration>
6998
</plugin>
7099
</plugins>
71100
</build>

Diff for: src/main/java/com/example/jaxdemo/TomcatController.java

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.Objects;
2727

2828
@Controller(customResourceClass = Tomcat.class,
29+
customResourceDoneableClass = TomcatDoneable.class,
2930
crdName = "tomcats.tomcatoperator.io")
3031
public class TomcatController implements ResourceController<Tomcat> {
3132

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.example.jaxdemo;
2+
3+
import io.fabric8.kubernetes.api.builder.Function;
4+
import io.fabric8.kubernetes.client.CustomResourceDoneable;
5+
6+
public class TomcatDoneable extends CustomResourceDoneable<Tomcat> {
7+
public TomcatDoneable(Tomcat resource, Function<Tomcat, Tomcat> function) {
8+
super(resource, function);
9+
}
10+
}

Diff for: src/main/java/com/example/jaxdemo/TomcatOperator.java

+8-12
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@
55
import io.fabric8.kubernetes.client.ConfigBuilder;
66
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
77
import io.fabric8.kubernetes.client.KubernetesClient;
8+
import io.quarkus.runtime.StartupEvent;
89
import org.slf4j.Logger;
910
import org.slf4j.LoggerFactory;
10-
import org.takes.facets.fork.FkRegex;
11-
import org.takes.facets.fork.TkFork;
12-
import org.takes.http.Exit;
13-
import org.takes.http.FtBasic;
14-
15-
import java.io.IOException;
11+
import javax.enterprise.context.ApplicationScoped;
12+
import javax.enterprise.event.Observes;
1613

14+
@ApplicationScoped
1715
public class TomcatOperator {
1816

1917
private static final Logger log = LoggerFactory.getLogger(TomcatOperator.class);
2018

21-
public static void main(String[] args) throws IOException {
19+
void onStart(@Observes StartupEvent ev) {
2220

2321
Config config = new ConfigBuilder().withNamespace(null).build();
2422
KubernetesClient client = new DefaultKubernetesClient(config);
@@ -30,9 +28,7 @@ public static void main(String[] args) throws IOException {
3028

3129
operator.registerControllerForAllNamespaces(new WebappController(client));
3230

33-
34-
new FtBasic(
35-
new TkFork(new FkRegex("/health", "ALL GOOD.")), 8080
36-
).start(Exit.NEVER);
31+
log.info("Start happened");
3732
}
38-
}
33+
34+
}

Diff for: src/main/java/com/example/jaxdemo/WebappController.java

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.regex.Pattern;
1818

1919
@Controller(customResourceClass = Webapp.class,
20+
customResourceDoneableClass = WebappDoneable.class,
2021
crdName = "webapps.tomcatoperator.io")
2122
public class WebappController implements ResourceController<Webapp> {
2223

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.example.jaxdemo;
2+
3+
import io.fabric8.kubernetes.api.builder.Function;
4+
import io.fabric8.kubernetes.client.CustomResourceDoneable;
5+
6+
public class WebappDoneable extends CustomResourceDoneable<Webapp> {
7+
public WebappDoneable(Webapp resource, Function<Webapp, Webapp> function) {
8+
super(resource, function);
9+
}
10+
}

0 commit comments

Comments
 (0)