Skip to content

Commit

Permalink
update to fabric8 7.1 and quarkus 3.18.1 (#319)
Browse files Browse the repository at this point in the history

Signed-off-by: Attila Mészáros <[email protected]>
  • Loading branch information
csviri authored Feb 3, 2025
1 parent 19d58fd commit 2010c49
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public static AdmissionResponse notAllowedExceptionToAdmissionResponse(

public static KubernetesResource getTargetResource(AdmissionRequest admissionRequest,
Operation operation) {
return operation == Operation.DELETE ? admissionRequest.getOldObject()
: admissionRequest.getObject();
return (KubernetesResource) (operation == Operation.DELETE ? admissionRequest.getOldObject()
: admissionRequest.getObject());
}

public static AdmissionResponse admissionResponseFromMutation(KubernetesResource originalResource,
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<junit.version>5.10.2</junit.version>
<fabric8-client.version>6.13.4</fabric8-client.version>
<fabric8-client.version>7.1.0</fabric8-client.version>
<slf4j.version>1.7.36</slf4j.version>
<log4j.version>2.24.3</log4j.version>
<mokito.version>5.14.2</mokito.version>
Expand All @@ -73,7 +73,7 @@
<maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
<spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
<spring-boot-dependencies.version>3.4.1</spring-boot-dependencies.version>
<spring-boot-dependencies.version>3.4.2</spring-boot-dependencies.version>
</properties>

<dependencyManagement>
Expand Down
1 change: 0 additions & 1 deletion samples/commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>

<scope>test</scope>
</dependency>
</dependencies>
Expand Down
16 changes: 9 additions & 7 deletions samples/quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.11.0</quarkus.platform.version>
<quarkus.platform.version>3.18.1</quarkus.platform.version>
<skipITs>true</skipITs>
<surefire-plugin.version>3.5.2</surefire-plugin.version>
</properties>
Expand Down Expand Up @@ -43,6 +43,14 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
Expand All @@ -53,15 +61,10 @@
<artifactId>quarkus-certmanager</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-minikube</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-jib</artifactId>
Expand All @@ -71,7 +74,6 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down
131 changes: 131 additions & 0 deletions samples/spring-boot/k8s/kubernetes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
app.dekorate.io/vcs-url: <<unknown>>
labels:
app.kubernetes.io/name: spring-boot-sample
app.kubernetes.io/version: 1.1.7-SNAPSHOT
name: spring-boot-sample
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: spring-boot-sample
app.kubernetes.io/version: 1.1.7-SNAPSHOT
template:
metadata:
annotations:
app.dekorate.io/vcs-url: <<unknown>>
labels:
app.kubernetes.io/name: spring-boot-sample
app.kubernetes.io/version: 1.1.7-SNAPSHOT
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: SERVER_SSL_KEY_STORE
value: /etc/certs/keystore.p12
- name: SERVER_SSL_KEY_STORE_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: pkcs12-pass
image: test/spring-boot-sample:1.1.7-SNAPSHOT
imagePullPolicy: IfNotPresent
name: spring-boot-sample
ports:
- containerPort: 443
name: http
protocol: TCP
volumeMounts:
- mountPath: /etc/certs
name: volume-certs
readOnly: true
volumes:
- name: volume-certs
secret:
optional: false
secretName: tls-secret
---
apiVersion: v1
kind: Secret
metadata:
name: pkcs12-pass
data:
password: c3VwZXJzZWNyZXQ=
type: Opaque
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
annotations:
app.dekorate.io/vcs-url: <<unknown>>
labels:
app.kubernetes.io/name: spring-boot-sample
app.kubernetes.io/version: 1.1.7-SNAPSHOT
name: spring-boot-sample
spec:
selfSigned: {}
---
apiVersion: v1
kind: Service
metadata:
annotations:
app.dekorate.io/vcs-url: <<unknown>>
labels:
app.kubernetes.io/name: spring-boot-sample
app.kubernetes.io/version: 1.1.7-SNAPSHOT
name: spring-boot-sample
spec:
ports:
- name: http
port: 443
protocol: TCP
targetPort: 443
selector:
app.kubernetes.io/name: spring-boot-sample
app.kubernetes.io/version: 1.1.7-SNAPSHOT
type: ClusterIP
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
annotations:
app.dekorate.io/vcs-url: <<unknown>>
labels:
app.kubernetes.io/name: spring-boot-sample
app.kubernetes.io/version: 1.1.7-SNAPSHOT
name: spring-boot-sample
spec:
dnsNames:
- spring-boot-sample.default.svc
- localhost
duration: 7776000000000000ns
encodeUsagesInRequest: false
isCA: false
issuerRef:
name: spring-boot-sample
keystores:
pkcs12:
create: true
passwordSecretRef:
key: password
name: pkcs12-pass
privateKey:
algorithm: RSA
encoding: PKCS8
size: 2048
renewBefore: 1296000000000000ns
secretName: tls-secret
subject:
organizations:
- Dekorate
- Community
usages:
- server auth
- client auth
24 changes: 3 additions & 21 deletions samples/spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<name>Kubernetes Webhooks Framework - Samples - Spring Boot</name>

<properties>
<java.version>17</java.version>
<jib-maven-plugin.version>3.4.4</jib-maven-plugin.version>
<dekorate.version>4.1.4</dekorate.version>
</properties>
Expand Down Expand Up @@ -80,26 +79,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>kubernetes-spring-starter</artifactId>
<version>${dekorate.version}</version>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>certmanager-annotations</artifactId>
<version>${dekorate.version}</version>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>kubernetes-annotations</artifactId>
<version>${dekorate.version}</version>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>jib-annotations</artifactId>
<version>${dekorate.version}</version>
</dependency>
</dependencies>

<build>
Expand All @@ -109,6 +88,9 @@
<artifactId>jib-maven-plugin</artifactId>
<version>${jib-maven-plugin.version}</version>
<configuration>
<from>
<image>eclipse-temurin:17-jre</image>
</from>
<to>
<image>test/spring-boot-sample:${project.version}</image>
</to>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.junit.jupiter.api.BeforeAll;

import io.fabric8.kubernetes.client.ConfigBuilder;
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
import io.javaoperatorsdk.webhook.sample.AbstractEndToEndTest;

Expand All @@ -15,12 +16,14 @@ class SpringBootWebhooksE2E extends AbstractEndToEndTest {

@BeforeAll
static void deployService() throws IOException {
try (var client = new KubernetesClientBuilder().build();
try (var client = new KubernetesClientBuilder().withConfig(new ConfigBuilder()
.withNamespace("default")
.build()).build();
var certManager = new URL(
"https://github.com/cert-manager/cert-manager/releases/download/v1.10.1/cert-manager.yaml")
.openStream()) {
applyAndWait(client, certManager);
applyAndWait(client, "target/classes/META-INF/dekorate/kubernetes.yml");
applyAndWait(client, "k8s/kubernetes.yml");
applyAndWait(client, "k8s/validating-webhook-configuration.yml");
applyAndWait(client, "k8s/mutating-webhook-configuration.yml");
applyAndWait(client,
Expand Down

0 comments on commit 2010c49

Please sign in to comment.