Skip to content

Commit daa5e93

Browse files
committed
feat!: upgrade to Fabric8 8 and Jackson 3
Upgrade Fabric8 to 8.0.0 and bump the reactor and BOM to 6.0.0-SNAPSHOT. Migrate resource matching and YAML configuration to Jackson 3, preserve the JDK HTTP-client default, and align Vert.x dependencies and CI with Vert.x 5. Add custom serialization, cloning, matching, and YAML regression tests, and document SDK 6 migration and transport compatibility requirements. Signed-off-by: Mauro de Palma <maurodep1645@gmail.com>
1 parent b0ef77f commit daa5e93

35 files changed

Lines changed: 498 additions & 65 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
httpclient-tests:
2424
strategy:
2525
matrix:
26-
httpclient: [ 'vertx', 'jdk', 'jetty' ]
26+
httpclient: [ 'vertx-5', 'jdk', 'jetty' ]
2727
uses: ./.github/workflows/integration-tests.yml
2828
with:
2929
java-version: 25

‎.github/workflows/integration-tests.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
http-client:
1313
type: string
1414
required: false
15-
default: 'vertx'
15+
default: 'vertx-5'
1616
experimental:
1717
type: boolean
1818
required: false

‎bootstrapper-maven-plugin/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>io.javaoperatorsdk</groupId>
2424
<artifactId>java-operator-sdk</artifactId>
25-
<version>5.6.4-SNAPSHOT</version>
25+
<version>6.0.0-SNAPSHOT</version>
2626
</parent>
2727

2828
<artifactId>bootstrapper</artifactId>

‎caffeine-bounded-cache-support/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>io.javaoperatorsdk</groupId>
2323
<artifactId>java-operator-sdk</artifactId>
24-
<version>5.6.4-SNAPSHOT</version>
24+
<version>6.0.0-SNAPSHOT</version>
2525
</parent>
2626

2727
<artifactId>caffeine-bounded-cache-support</artifactId>

‎docs/content/en/docs/documentation/features.md‎

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,35 @@ public class DeploymentReconciler
2727

2828
**Note:** This feature is provided by the [Fabric8 Kubernetes Client](https://github.com/fabric8io/kubernetes-client), not JOSDK itself.
2929

30-
To automatically generate CRD manifests from your annotated Custom Resource classes, add this dependency to your project:
30+
To automatically generate CRD manifests from your annotated Custom Resource classes, configure the
31+
Fabric8 CRD generator Maven plugin. Use the same Fabric8 version as the SDK:
3132

3233
```xml
33-
34-
<dependency>
34+
<plugin>
3535
<groupId>io.fabric8</groupId>
36-
<artifactId>crd-generator-apt</artifactId>
37-
<scope>provided</scope>
38-
</dependency>
36+
<artifactId>crd-generator-maven-plugin</artifactId>
37+
<version>${fabric8-client.version}</version>
38+
<executions>
39+
<execution>
40+
<goals>
41+
<goal>generate</goal>
42+
</goals>
43+
</execution>
44+
</executions>
45+
</plugin>
3946
```
4047

41-
The CRD will be generated in `target/classes/META-INF/fabric8` (or `target/test-classes/META-INF/fabric8` for test scope) with the CRD name suffixed by the generated spec version.
48+
Add the plugin under `build/plugins` and set `fabric8-client.version` to `8.0.0`.
49+
The old `crd-generator-apt` annotation processor was removed in Fabric8 8.
50+
51+
The CRD will be generated in `target/classes/META-INF/fabric8` with the filename suffixed by the
52+
generated spec version. For test resources, configure `classesToScan` to
53+
`${project.build.testOutputDirectory}` and `classpath` to `WITH_ALL_DEPENDENCIES_AND_TESTS`, and
54+
bind the plugin execution to `process-test-classes`.
4255

43-
For example, a CR using the `java-operator-sdk.io` group with a `mycrs` plural form will result in these files:
56+
For example, a CR using the `java-operator-sdk.io` group with a `mycrs` plural form will result in:
4457
- `mycrs.java-operator-sdk.io-v1.yml`
45-
- `mycrs.java-operator-sdk.io-v1beta1.yml`
58+
59+
Only `apiextensions.k8s.io/v1` CRDs are generated.
4660

4761
**Note for Quarkus users:** If you're using the `quarkus-operator-sdk` extension, you don't need to add any extra dependency for CRD generation - the extension handles this automatically.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
title: Migrating from SDK 5 to SDK 6
3+
description: Updating operators for SDK 6, Fabric8 Kubernetes Client 8, and Jackson 3
4+
---
5+
6+
## Breaking changes in SDK 6
7+
8+
Java Operator SDK 6 introduces source and binary incompatibilities through its upgrade to
9+
Fabric8 8 and Jackson 3. Upgrade the SDK dependencies and `operator-framework-bom` together,
10+
migrate custom Jackson integrations, and recompile your operator. This is not a drop-in
11+
replacement for SDK 5.
12+
13+
## Fabric8 Kubernetes Client 8
14+
15+
The SDK now uses Fabric8 Kubernetes Client `8.0.0`, which requires Java 17 or newer, matching the
16+
SDK's existing Java baseline. Align any explicit Fabric8 dependencies and the
17+
`crd-generator-maven-plugin` with this version.
18+
19+
See the [Fabric8 8 migration guide](https://github.com/fabric8io/kubernetes-client/blob/v8.0.0/doc/MIGRATION-v8.md)
20+
for the complete list of client and CRD generator changes.
21+
22+
## Jackson 3
23+
24+
The Kubernetes client, resource matchers, and YAML configuration provider now use Jackson 3.
25+
Code that uses the client's Jackson types must migrate from `com.fasterxml.jackson.core`,
26+
`com.fasterxml.jackson.databind`, and `com.fasterxml.jackson.dataformat` to the corresponding
27+
`tools.jackson` packages. Maven dependencies use `tools.jackson.core:jackson-core`,
28+
`tools.jackson.core:jackson-databind`, and `tools.jackson.dataformat:jackson-dataformat-yaml`.
29+
Jackson annotations such as `@JsonProperty` remain in `com.fasterxml.jackson.annotation`,
30+
provided by `com.fasterxml.jackson.core:jackson-annotations`.
31+
32+
Custom serializers, deserializers, and databind annotations must use Jackson 3 types:
33+
`ValueSerializer`, `ValueDeserializer`, and `tools.jackson.databind.annotation`. Jackson 2
34+
databind annotations are not used by the client, even when Jackson 2 is also on the classpath.
35+
Java time support is built in, so remove `JavaTimeModule` registrations.
36+
37+
Jackson 3 mappers are immutable. Use builders instead of `registerModule` or `configure`.
38+
When supplying a custom mapper to the Kubernetes client, preserve the Fabric8 compatibility
39+
defaults:
40+
41+
```java
42+
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
43+
import io.fabric8.kubernetes.client.utils.KubernetesSerialization;
44+
import io.fabric8.kubernetes.model.jackson.Jackson2JdkTypesModule;
45+
import tools.jackson.databind.json.JsonMapper;
46+
47+
var mapper = JsonMapper.builderWithJackson2Defaults()
48+
.addModule(new Jackson2JdkTypesModule())
49+
.build();
50+
var client = new KubernetesClientBuilder()
51+
.withKubernetesSerialization(new KubernetesSerialization(mapper, true))
52+
.build();
53+
```
54+
55+
The default client already applies these compatibility settings. Supplying a mapper configures
56+
a copy; the original mapper is not modified. See the Fabric8 migration guide for wire-format
57+
differences that cannot be restored, and review regenerated CRDs before applying them.
58+
59+
## HTTP client selection
60+
61+
The `operator-framework` module continues to use the JDK HTTP client by default. Fabric8's
62+
default HTTP client is now `kubernetes-httpclient-vertx-5`, which the core module excludes so
63+
that it does not bring a second HTTP implementation into operators.
64+
65+
If you select Vert.x through `fabric8-httpclient-impl.name`, use `vertx-5` instead of `vertx`.
66+
Explicit Vert.x dependencies should use `io.fabric8:kubernetes-httpclient-vertx-5` and compatible
67+
Vert.x 5 dependencies. Applications depending only on `operator-framework-core` must provide
68+
their chosen Fabric8 HTTP client implementation.
69+
70+
Vert.x 5 requires Netty 4.2. Check application and platform BOMs for dependencies pinned to
71+
Vert.x 4 or Netty 4.1 before selecting this client; incompatible versions can prevent client
72+
startup. See the Fabric8 migration guide if you need to remain on Vert.x 4.
73+
74+
The Jetty HTTP client now uses Jetty 12.1 and cannot share a classpath with Jetty 9, 10, or 11.
75+
Upgrade any application dependencies using older Jetty versions or choose a different
76+
Fabric8 HTTP client implementation.
77+
78+
## CRD generation
79+
80+
Fabric8 removed the `crd-generator-apt` annotation processor. Use the
81+
[`crd-generator-maven-plugin`](../../documentation/features/#automatic-crd-generation) instead.
82+
Only `apiextensions.k8s.io/v1` CRDs are generated.

‎micrometer-support/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>io.javaoperatorsdk</groupId>
2323
<artifactId>java-operator-sdk</artifactId>
24-
<version>5.6.4-SNAPSHOT</version>
24+
<version>6.0.0-SNAPSHOT</version>
2525
</parent>
2626

2727
<artifactId>micrometer-support</artifactId>
@@ -64,7 +64,7 @@
6464
</dependency>
6565
<dependency>
6666
<groupId>io.fabric8</groupId>
67-
<artifactId>kubernetes-httpclient-vertx</artifactId>
67+
<artifactId>kubernetes-httpclient-vertx-5</artifactId>
6868
<scope>test</scope>
6969
</dependency>
7070
</dependencies>

‎migration/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>io.javaoperatorsdk</groupId>
2323
<artifactId>java-operator-sdk</artifactId>
24-
<version>5.6.4-SNAPSHOT</version>
24+
<version>6.0.0-SNAPSHOT</version>
2525
</parent>
2626

2727
<artifactId>migration</artifactId>

‎operator-framework-bom/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<groupId>io.javaoperatorsdk</groupId>
2323
<artifactId>operator-framework-bom</artifactId>
24-
<version>5.6.4-SNAPSHOT</version>
24+
<version>6.0.0-SNAPSHOT</version>
2525
<packaging>pom</packaging>
2626
<name>Operator SDK - Bill of Materials</name>
2727
<description>Java SDK for implementing Kubernetes operators</description>

‎operator-framework-core/pom.xml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>io.javaoperatorsdk</groupId>
2323
<artifactId>java-operator-sdk</artifactId>
24-
<version>5.6.4-SNAPSHOT</version>
24+
<version>6.0.0-SNAPSHOT</version>
2525
<relativePath>../pom.xml</relativePath>
2626
</parent>
2727

@@ -46,10 +46,15 @@
4646
<exclusions>
4747
<exclusion>
4848
<groupId>io.fabric8</groupId>
49-
<artifactId>kubernetes-httpclient-okhttp</artifactId>
49+
<artifactId>kubernetes-httpclient-vertx-5</artifactId>
5050
</exclusion>
5151
</exclusions>
5252
</dependency>
53+
<dependency>
54+
<groupId>io.fabric8</groupId>
55+
<artifactId>kubernetes-httpclient-${fabric8-httpclient-impl.name}</artifactId>
56+
<scope>test</scope>
57+
</dependency>
5358
<dependency>
5459
<groupId>org.slf4j</groupId>
5560
<artifactId>slf4j-api</artifactId>

0 commit comments

Comments
 (0)