Skip to content

Commit a3f14ef

Browse files
authored
[FLINK-37885] Upgrade to JOSDK 5.1
1 parent 4ef7959 commit a3f14ef

File tree

28 files changed

+680
-205
lines changed

28 files changed

+680
-205
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
name: maven build
3838
strategy:
3939
matrix:
40-
java-version: [ 11, 17, 21 ]
40+
java-version: [ 17, 21 ]
4141
steps:
4242
- uses: actions/checkout@v4
4343
- name: Set up JDK ${{ matrix.java-version }}
@@ -76,7 +76,7 @@ jobs:
7676
strategy:
7777
matrix:
7878
http-client: [ "okhttp", "jdk", "jetty", "vertx" ]
79-
java-version: [ "11", "17", "21" ]
79+
java-version: [ "17", "21" ]
8080
uses: ./.github/workflows/e2e.yaml
8181
with:
8282
java-version: ${{ matrix.java-version }}
@@ -89,7 +89,7 @@ jobs:
8989
strategy:
9090
matrix:
9191
http-client: [ "okhttp" ]
92-
java-version: [ "11", "17"]
92+
java-version: [ "17"]
9393
flink-version:
9494
- "v2_0"
9595
- "v1_20"
@@ -142,7 +142,7 @@ jobs:
142142

143143
uses: ./.github/workflows/e2e.yaml
144144
with:
145-
java-version: 11
145+
java-version: 17
146146
flink-version: ${{ matrix.flink-version }}
147147
test: ${{ matrix.test }}
148148
namespace: "flink"
@@ -211,7 +211,7 @@ jobs:
211211
test: test_snapshot.sh
212212
uses: ./.github/workflows/e2e.yaml
213213
with:
214-
java-version: 11
214+
java-version: 17
215215
flink-version: ${{ matrix.flink-version }}
216216
test: ${{ matrix.test }}
217217
mode: ${{ matrix.mode }}

.github/workflows/docker_push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
image: tonistiigi/binfmt:qemu-v7.0.0
4646
platforms: all
4747

48-
- name: Set up Docker Buildx
48+
- name: Set up Docker Build
4949
uses: docker/setup-buildx-action@v3
5050

5151
- name: Log in to the Container registry

.github/workflows/publish_snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Set up JDK 11
3535
uses: actions/setup-java@v4
3636
with:
37-
java-version: '11'
37+
java-version: '17'
3838
distribution: 'temurin'
3939
- name: Cache local Maven repository
4040
uses: actions/cache@v4

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# limitations under the License.
1717
################################################################################
1818
# Build
19-
ARG JAVA_VERSION=11
19+
ARG JAVA_VERSION=17
2020
FROM maven:3.8.8-eclipse-temurin-${JAVA_VERSION} AS build
2121
ARG SKIP_TESTS=true
2222
ARG HTTP_CLIENT=okhttp

docs/content.zh/docs/development/guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ In order to build the operator you need to [clone the git repository]({{< github
3636
git clone {{< github_repo >}}
3737
```
3838

39-
To build from the command line, it is necessary to have **Maven 3** and a **Java Development Kit** (JDK) installed. Please note that Flink Kubernetes Operator requires **Java 11**.
39+
To build from the command line, it is necessary to have **Maven 3** and a **Java Development Kit** (JDK) installed. Please note that Flink Kubernetes Operator requires **Java 17**.
4040

4141
To build the project, you can use the following command:
4242

docs/content/docs/development/guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ In order to build the operator you need to [clone the git repository]({{< github
3636
git clone {{< github_repo >}}
3737
```
3838

39-
To build from the command line, it is necessary to have **Maven 3** and a **Java Development Kit** (JDK) installed. Please note that Flink Kubernetes Operator requires **Java 11**.
39+
To build from the command line, it is necessary to have **Maven 3** and a **Java Development Kit** (JDK) installed. Please note that Flink Kubernetes Operator requires **Java 17**.
4040

4141
To build the project, you can use the following command:
4242

flink-kubernetes-operator-api/src/main/java/org/apache/flink/kubernetes/operator/api/validation/CrdCompatibilityChecker.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ protected static void checkObjectCompatibility(
9797
// This claims field was removed in Kubernetes 1.28 as it was mistakenly
9898
// added in the first place. For more context please refer to
9999
// https://github.com/kubernetes/api/commit/8b14183
100-
&& !fieldPath.contains(".volumeClaimTemplate.spec.resources.claims")) {
100+
&& !fieldPath.contains(".volumeClaimTemplate.spec.resources.claims")
101+
&& !fieldPath.contains(
102+
".spec.taskManager.podTemplate.spec.resourceClaims.items.source")
103+
&& !fieldPath.contains(
104+
".spec.jobManager.podTemplate.spec.resourceClaims.items.source")
105+
&& !fieldPath.contains(
106+
".spec.podTemplate.spec.resourceClaims.items.source")) {
101107
err(fieldPath + " has been removed");
102108
}
103109
} else {

flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/FlinkOperator.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666

6767
import javax.annotation.Nullable;
6868

69+
import java.time.Duration;
6970
import java.util.Collection;
7071
import java.util.HashSet;
7172
import java.util.Set;
@@ -150,14 +151,15 @@ private void overrideOperatorConfigs(ConfigurationServiceOverrider overrider) {
150151
overrider.withMetrics(new OperatorJosdkMetrics(metricGroup, configManager));
151152
}
152153

153-
overrider.withTerminationTimeoutSeconds(
154-
(int)
154+
overrider.withReconciliationTerminationTimeout(
155+
Duration.ofSeconds(
155156
conf.get(KubernetesOperatorConfigOptions.OPERATOR_TERMINATION_TIMEOUT)
156-
.toSeconds());
157+
.toSeconds()));
157158

158159
overrider.withStopOnInformerErrorDuringStartup(
159160
conf.get(KubernetesOperatorConfigOptions.OPERATOR_STOP_ON_INFORMER_ERROR));
160161

162+
overrider.withUseSSAToPatchPrimaryResource(false);
161163
var leaderElectionConf = operatorConf.getLeaderElectionConfiguration();
162164
if (leaderElectionConf != null) {
163165
overrider.withLeaderElectionConfiguration(leaderElectionConf);

flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/KubernetesOperatorConfigOptions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,13 +496,13 @@ public static String operatorConfigKey(String key) {
496496
.withDescription(
497497
"Whether informer errors should stop operator startup. If false, the startup will ignore recoverable errors, caused for example by RBAC issues and will retry periodically.");
498498

499+
public static final int DEFAULT_TERMINATION_TIMEOUT_SECONDS = 10;
500+
499501
@Documentation.Section(SECTION_ADVANCED)
500502
public static final ConfigOption<Duration> OPERATOR_TERMINATION_TIMEOUT =
501503
operatorConfig("termination.timeout")
502504
.durationType()
503-
.defaultValue(
504-
Duration.ofSeconds(
505-
ConfigurationService.DEFAULT_TERMINATION_TIMEOUT_SECONDS))
505+
.defaultValue(Duration.ofSeconds(DEFAULT_TERMINATION_TIMEOUT_SECONDS))
506506
.withDescription(
507507
"Operator shutdown timeout before reconciliation threads are killed.");
508508

flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/controller/FlinkDeploymentController.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@
4343
import io.javaoperatorsdk.operator.api.reconciler.Context;
4444
import io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration;
4545
import io.javaoperatorsdk.operator.api.reconciler.DeleteControl;
46-
import io.javaoperatorsdk.operator.api.reconciler.ErrorStatusHandler;
4746
import io.javaoperatorsdk.operator.api.reconciler.ErrorStatusUpdateControl;
4847
import io.javaoperatorsdk.operator.api.reconciler.EventSourceContext;
49-
import io.javaoperatorsdk.operator.api.reconciler.EventSourceInitializer;
5048
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
5149
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
5250
import io.javaoperatorsdk.operator.processing.event.source.EventSource;
@@ -55,17 +53,13 @@
5553

5654
import java.util.ArrayList;
5755
import java.util.List;
58-
import java.util.Map;
5956
import java.util.Optional;
6057
import java.util.Set;
6158

6259
/** Controller that runs the main reconcile loop for Flink deployments. */
6360
@ControllerConfiguration
6461
public class FlinkDeploymentController
65-
implements Reconciler<FlinkDeployment>,
66-
ErrorStatusHandler<FlinkDeployment>,
67-
EventSourceInitializer<FlinkDeployment>,
68-
Cleaner<FlinkDeployment> {
62+
implements Reconciler<FlinkDeployment>, Cleaner<FlinkDeployment> {
6963
private static final Logger LOG = LoggerFactory.getLogger(FlinkDeploymentController.class);
7064

7165
private final Set<FlinkResourceValidator> validators;
@@ -185,9 +179,9 @@ private void triggerErrorEvent(
185179
}
186180

187181
@Override
188-
public Map<String, EventSource> prepareEventSources(
182+
public List<EventSource<?, FlinkDeployment>> prepareEventSources(
189183
EventSourceContext<FlinkDeployment> context) {
190-
List<EventSource> eventSources = new ArrayList<>();
184+
List<EventSource<?, FlinkDeployment>> eventSources = new ArrayList<>();
191185
eventSources.add(EventSourceUtils.getSessionJobInformerEventSource(context));
192186
eventSources.add(EventSourceUtils.getDeploymentInformerEventSource(context));
193187

@@ -199,7 +193,7 @@ public Map<String, EventSource> prepareEventSources(
199193
"Could not initialize informer for snapshots as the CRD has not been installed!");
200194
}
201195

202-
return EventSourceInitializer.nameEventSources(eventSources.toArray(EventSource[]::new));
196+
return eventSources;
203197
}
204198

205199
@Override

0 commit comments

Comments
 (0)