You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FLINK-36646][helm] Add required Java Opts to allow Java 17 based job images.
From Java 16 onwards, the project jigsaw java opts are now mandatory. To
allow Java 17 based job images, we need to include the java opts from the
flink dist base conf.yaml to the per-flink-version env.java.default-opts.all
config in the operator default flink-conf.yaml.
These will be combined with any user supplied opts via env.java.opts.all
and ignored by JDK 8 and 11 as we set -XX:IgnoreUnrecognizedVMOptions.
Signed-off-by: Thomas Cooper <[email protected]>
Copy file name to clipboardExpand all lines: docs/content/docs/operations/configuration.md
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,4 +158,33 @@ If you run Flink Operator in IPV6 environment, the [host name verification error
158
158
due to a known bug in Okhttp client. As a workaround before new Okhttp 5.0.0 release, the environment variable below needs to be set
159
159
for both Flink Operator and Flink Deployment Configuration.
160
160
161
-
KUBERNETES_DISABLE_HOSTNAME_VERIFICATION=true
161
+
KUBERNETES_DISABLE_HOSTNAME_VERIFICATION=true
162
+
163
+
## Java options for Java 17 based Job/Task Manager images
164
+
165
+
### Summary
166
+
167
+
From Java 17 onwards, Flink requires certain Java options to be supplied in order to function. These are set by default in the operator's `helm` configuration file.
168
+
However, users should note:
169
+
170
+
- **Flink 1.19+**: If users want to change the default opts for all Flink deployments, they should **add to** rather than replace these default options (`kubernetes.operator.default-configuration.flink-version.<flink-version>.env.java.default-opts.all`) in the `helm` configuration. They should also avoid overriding `env.java.default-opts.all` in their `FlinkDeployment` configuration and use `env.java.opts.all` for any Java options needed by their own code.
171
+
- **Flink 1.18**: Setting default Java opts is not available in Flink 1.18, so the operator sets `env.java.opts.all` to allow Java 17 to work. If users wish to use Flink 1.18 with Java 17 based images, they should avoid overriding `env.java.default.all` in their `FlinkDeployment` configuration. If custom Java opts are required, then they should include the [upstream Java options](https://github.com/apache/flink/blob/release-1.18.1/flink-dist/src/main/resources/flink-conf.yaml).
172
+
173
+
### Details
174
+
175
+
The default Job/Task Manager images use JRE 11 (Eclipse Temurin).
176
+
However, there are official images published which use JRE 17 (e.g. `flink:1.20.0-scala_2.12-java17`) and users can customize the image used in their `FlinkDeployment` which can use a custom JRE.
177
+
178
+
As Java 17 now requires the use of the module system ([Project Jigsaw](https://openjdk.org/projects/jigsaw/)), the user will need to supply the appropriate `add-exports` and `add-opens` Java options in order for the pre-module system code in Flink to function correctly with Java 17+.
179
+
These options are defined upstream in the default configuration yaml (e.g. for [Flink 1.20](https://github.com/apache/flink/blob/release-1.20.0/flink-dist/src/main/resources/config.yaml)).
180
+
181
+
Users wanting to run images based on Java 17 could supply a copy of these options by setting `env.java.opts.all`, in their `FlinkDeployment.spec.flinkconfiguration` to the upstream opts list and adding any options their code required.
182
+
However, this has to be done for every deployment.
183
+
To avoid this, the default configuration file used for `helm` sets the [`env.java.default-opts.all`](https://nightlies.apache.org/flink/flink-docs-master/docs/deployment/config/#env-java-default-opts-all) config to the upstream Flink Java options for the given Flink version.
184
+
The default opts are appended to any user supplied options via `env.java.opts.all`.
185
+
Therefore, users can continue to set Java options for their own code in their `FlinkDeployment`s and those required for Flink's core operations will be appended automatically.
186
+
187
+
The exception to the above is Flink 1.18, as the `env.java.default-opts.all` option is not available in that version.
188
+
For 1.18 the `helm` default config sets the `env.java.opts.all` directly.
189
+
This will allow Java 17 based images to work correctly.
190
+
However, if a user sets their own `env.java.opts.all` in their `FlinkDeployment`, then they will need to copy the [upstream Java options](https://github.com/apache/flink/blob/release-1.18.1/flink-dist/src/main/resources/flink-conf.yaml) into their list.
Copy file name to clipboardExpand all lines: helm/flink-kubernetes-operator/conf/flink-conf.yaml
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,14 @@
20
20
taskmanager.numberOfTaskSlots: 1
21
21
parallelism.default: 1
22
22
23
+
# These parameters are required for Java 17 support.
24
+
# These should be kept in-sync with the flink dist env.java.opts.all defaults (for the given flink version) in: flink-dist/src/main/resources/config.yaml
25
+
# Flink 1.18 uses env.java.opts.all, if a user supplies their own version of these opts in their FlinkDeployment the options below will be overridden.
26
+
# env.java.default-opts.all is used for 1.19 onwards so users can supply their own opts.all in their Job deployments and have these appended.
0 commit comments