From f74908fe8896d4f226a56d41b12a2c3b45d939e4 Mon Sep 17 00:00:00 2001 From: pegtrifork Date: Fri, 2 Feb 2024 10:59:37 +0100 Subject: [PATCH 1/4] Add java 17 compatability options --- charts/flink-job/templates/_helpers.tpl | 12 ++++++++++++ charts/flink-job/values.yaml | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/charts/flink-job/templates/_helpers.tpl b/charts/flink-job/templates/_helpers.tpl index ba35d9d7..50bf70c5 100644 --- a/charts/flink-job/templates/_helpers.tpl +++ b/charts/flink-job/templates/_helpers.tpl @@ -167,6 +167,7 @@ Calculate the flinkConfiguration {{- $configs = fromJson (include "flink-job.storageConfiguration" (dict "configs" $configs "global" $.Values "fullname" $fullname)) -}} {{- $configs = fromJson (include "flink-job.istioConfiguration" (dict "configs" $configs "global" $.Values "fullname" $fullname)) -}} {{- $configs = fromJson (include "flink-job.sslConfiguration" (dict "configs" $configs "global" $.Values "fullname" $fullname)) -}} + {{- $configs = fromJson (include "flink-job.java17CompatibilityConfiguration" (dict "configs" $configs "global" $.Values "fullname" $fullname)) -}} {{ toYaml $configs }} {{- end -}} @@ -236,6 +237,17 @@ Add necessary configuration for running in HA mode {{- $configs | toJson -}} {{- end -}} +{{/* +Add necessary java 17 compatibility configuration +*/}} +{{- define "flink-job.java17CompatibilityConfiguration" -}} + {{- $configs := .configs -}} + {{- if .global.java17Compatability.enabled -}} + {{- $configs = fromJson (include "flink-job._dictSet" (list $configs "env.java.opts.all" "--add-exports=java.base/sun.net.util=ALL-UNNAMED --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED")) -}} + {{- end -}} + {{- $configs | toJson -}} +{{- end -}} + {{/* Validate the configuration */}} diff --git a/charts/flink-job/values.yaml b/charts/flink-job/values.yaml index 6ee873bf..1a72a5c7 100644 --- a/charts/flink-job/values.yaml +++ b/charts/flink-job/values.yaml @@ -472,3 +472,7 @@ image-automation: # Image-automation is not possible when using image-sha as a tagging strategy. # Any other configuration given here, is passed to it enabled: false + +java17Compatability: + # -- Whether to enable Java 17 compatibility + enabled: false \ No newline at end of file From c3af24fa870b60eaf32eba301d8822cac6158053 Mon Sep 17 00:00:00 2001 From: pegtrifork Date: Fri, 2 Feb 2024 11:53:19 +0100 Subject: [PATCH 2/4] Make all --- charts/flink-job/README.md | 1 + charts/flink-job/values.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/flink-job/README.md b/charts/flink-job/README.md index 649c340d..8f7c2476 100644 --- a/charts/flink-job/README.md +++ b/charts/flink-job/README.md @@ -230,6 +230,7 @@ Read more about Flink and highly available job-managers [here](https://nightlies | dnsForKubernetesHost | bool | `true` | Whether to set KUBERNETES_SERVICE_HOST=kubernetes.default.svc.cluster.local instead of relying on the kubernetes provided value For use in an environment where egress to kubeAPI is managed via DNS rather than IP addresses | | localNetworkConfiguration.enabled | bool | `false` | Whether to generate Netic LocalNetworkConfig allowing traffic between job and taskmanager. For use in a deny-all environment | | image-automation.enabled | bool | `false` | Whether to enable the image-automation subchart. Image-automation is not possible when using image-sha as a tagging strategy. Any other configuration given here, is passed to it | +| java17Compatability.enabled | bool | `false` | Whether to enable Java 17 compatibility | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) diff --git a/charts/flink-job/values.yaml b/charts/flink-job/values.yaml index 1a72a5c7..a3253f0e 100644 --- a/charts/flink-job/values.yaml +++ b/charts/flink-job/values.yaml @@ -475,4 +475,4 @@ image-automation: java17Compatability: # -- Whether to enable Java 17 compatibility - enabled: false \ No newline at end of file + enabled: false From 66a5ec14d53f531f0317719c6a0861f71f288057 Mon Sep 17 00:00:00 2001 From: pegtrifork Date: Fri, 2 Feb 2024 12:15:17 +0100 Subject: [PATCH 3/4] Update values.schema.json --- charts/flink-job/values.schema.json | 173 ++++++++++++++++++++++------ 1 file changed, 139 insertions(+), 34 deletions(-) diff --git a/charts/flink-job/values.schema.json b/charts/flink-job/values.schema.json index c8f640f8..681cf870 100644 --- a/charts/flink-job/values.schema.json +++ b/charts/flink-job/values.schema.json @@ -20,14 +20,19 @@ { "properties": { "flinkConfiguration": { - "required": ["state.savepoints.dir"] + "required": [ + "state.savepoints.dir" + ] } } }, { "properties": { "storage": { - "required": ["scheme", "baseDir"] + "required": [ + "scheme", + "baseDir" + ] } } } @@ -40,7 +45,10 @@ "job": { "properties": { "upgradeMode": { - "enum": ["savepoint", "last-state"] + "enum": [ + "savepoint", + "last-state" + ] } } } @@ -51,14 +59,19 @@ { "properties": { "flinkConfiguration": { - "required": ["state.checkpoints.dir"] + "required": [ + "state.checkpoints.dir" + ] } } }, { "properties": { "storage": { - "required": ["scheme", "baseDir"] + "required": [ + "scheme", + "baseDir" + ] } } } @@ -97,14 +110,19 @@ { "properties": { "flinkConfiguration": { - "required": ["high-availability.storageDir"] + "required": [ + "high-availability.storageDir" + ] } } }, { "properties": { "storage": { - "required": ["scheme", "baseDir"] + "required": [ + "scheme", + "baseDir" + ] } } } @@ -113,7 +131,9 @@ } ], "properties": { - "nameOverride": { "type": "string" }, + "nameOverride": { + "type": "string" + }, "fullnameOverride": { "type": "string", "maxLength": 63 @@ -128,14 +148,23 @@ }, "tag": { "description": "Which image tag to use", - "type": ["string", "number"] + "type": [ + "string", + "number" + ] }, "pullPolicy": { "description": "Which image pull policy to use", "type": "string", - "enum": ["IfNotPresent", "Always", "Never"] + "enum": [ + "IfNotPresent", + "Always", + "Never" + ] }, - "sha": { "type": "string" } + "sha": { + "type": "string" + } } }, "global": { @@ -155,7 +184,9 @@ "type": "array", "items": { "type": "object", - "required": ["name"], + "required": [ + "name" + ], "properties": { "name": { "type": "string" @@ -170,7 +201,9 @@ "type": "array", "items": { "type": "object", - "required": ["name"], + "required": [ + "name" + ], "properties": { "name": { "type": "string" @@ -188,18 +221,28 @@ "type": "boolean" } }, - "required": ["enabled"] + "required": [ + "enabled" + ] }, "flinkConfiguration": { "type": "object" }, "restartNonce": { - "type": ["integer", "string"] + "type": [ + "integer", + "string" + ] + }, + "logConfiguration": { + "type": "object" }, - "logConfiguration": { "type": "object" }, "mode": { "type": "string", - "enum": ["native", "standalone"] + "enum": [ + "native", + "standalone" + ] }, "storage": { "type": "object", @@ -211,7 +254,10 @@ "type": "string" } }, - "required": ["baseDir", "scheme"] + "required": [ + "baseDir", + "scheme" + ] }, "istio": { "type": "object", @@ -220,7 +266,9 @@ "type": "boolean" } }, - "required": ["enabled"] + "required": [ + "enabled" + ] }, "ports": { "type": "array", @@ -307,10 +355,16 @@ }, "type": { "type": "string", - "enum": ["input", "output"] + "enum": [ + "input", + "output" + ] } }, - "required": ["name", "type"] + "required": [ + "name", + "type" + ] } }, "parallelism": { @@ -318,14 +372,24 @@ }, "state": { "type": "string", - "enum": ["running", "suspended"] + "enum": [ + "running", + "suspended" + ] }, "upgradeMode": { "type": "string", - "enum": ["stateless", "last-state", "savepoint"] + "enum": [ + "stateless", + "last-state", + "savepoint" + ] }, "savepointTriggerNonce": { - "type": ["integer", "string"] + "type": [ + "integer", + "string" + ] }, "initialSavepointPath": { "type": "string" @@ -430,7 +494,9 @@ "type": "string" } }, - "required": ["enabled"], + "required": [ + "enabled" + ], "allOf": [ { "if": { @@ -441,7 +507,10 @@ } }, "then": { - "required": ["jobLabel", "targetLabels"] + "required": [ + "jobLabel", + "targetLabels" + ] } } ] @@ -462,7 +531,9 @@ "type": "object" } }, - "required": ["enabled"], + "required": [ + "enabled" + ], "allOf": [ { "if": { @@ -473,13 +544,20 @@ } }, "then": { - "required": ["targetPort"] + "required": [ + "targetPort" + ] } } ] } }, - "required": ["enabled", "port", "service", "serviceMonitor"] + "required": [ + "enabled", + "port", + "service", + "serviceMonitor" + ] }, "serviceAccount": { "type": "object", @@ -497,7 +575,9 @@ "type": "boolean" } }, - "required": ["create"], + "required": [ + "create" + ], "allOf": [ { "if": { @@ -508,7 +588,9 @@ } }, "then": { - "required": ["automountServiceAccountToken"] + "required": [ + "automountServiceAccountToken" + ] } } ] @@ -566,7 +648,9 @@ "type": "boolean" } }, - "required": ["enabled"], + "required": [ + "enabled" + ], "allOf": [ { "if": { @@ -577,7 +661,13 @@ } }, "then": { - "required": ["hostname", "path", "pathType", "selfSigned", "uiPort"] + "required": [ + "hostname", + "path", + "pathType", + "selfSigned", + "uiPort" + ] } } ] @@ -590,6 +680,20 @@ "type": "boolean" } } + }, + "java17Compatability": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + }, + "required": [ + "enabled" + ] + }, + "dnsForKubernetesHost": { + "type": "boolean" } }, "required": [ @@ -604,6 +708,7 @@ "ingress", "internalSsl", "istio", + "java17Compatability", "job", "jobManager", "metrics", @@ -723,4 +828,4 @@ ] } } -} +} \ No newline at end of file From cef5986b8f167237436a14ab698112731d4e7350 Mon Sep 17 00:00:00 2001 From: pegtrifork Date: Fri, 2 Feb 2024 14:33:16 +0100 Subject: [PATCH 4/4] Document java17Compatability --- charts/flink-job/README.md | 2 +- charts/flink-job/templates/_helpers.tpl | 2 +- charts/flink-job/values.schema.json | 11 ++--------- charts/flink-job/values.yaml | 7 ++++--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/charts/flink-job/README.md b/charts/flink-job/README.md index 8f7c2476..e3915ca7 100644 --- a/charts/flink-job/README.md +++ b/charts/flink-job/README.md @@ -230,7 +230,7 @@ Read more about Flink and highly available job-managers [here](https://nightlies | dnsForKubernetesHost | bool | `true` | Whether to set KUBERNETES_SERVICE_HOST=kubernetes.default.svc.cluster.local instead of relying on the kubernetes provided value For use in an environment where egress to kubeAPI is managed via DNS rather than IP addresses | | localNetworkConfiguration.enabled | bool | `false` | Whether to generate Netic LocalNetworkConfig allowing traffic between job and taskmanager. For use in a deny-all environment | | image-automation.enabled | bool | `false` | Whether to enable the image-automation subchart. Image-automation is not possible when using image-sha as a tagging strategy. Any other configuration given here, is passed to it | -| java17Compatability.enabled | bool | `false` | Whether to enable Java 17 compatibility | +| java17Compatability | bool | `true` | Whether to add Java 17 compatability options. For details see https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/deployment/java_compatibility/#jdk-modularization and https://github.com/apache/flink/blob/release-1.18/flink-dist/src/main/resources/flink-conf.yaml#L19-L21 | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) diff --git a/charts/flink-job/templates/_helpers.tpl b/charts/flink-job/templates/_helpers.tpl index 50bf70c5..e674b7ce 100644 --- a/charts/flink-job/templates/_helpers.tpl +++ b/charts/flink-job/templates/_helpers.tpl @@ -242,7 +242,7 @@ Add necessary java 17 compatibility configuration */}} {{- define "flink-job.java17CompatibilityConfiguration" -}} {{- $configs := .configs -}} - {{- if .global.java17Compatability.enabled -}} + {{- if .global.java17Compatability -}} {{- $configs = fromJson (include "flink-job._dictSet" (list $configs "env.java.opts.all" "--add-exports=java.base/sun.net.util=ALL-UNNAMED --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED")) -}} {{- end -}} {{- $configs | toJson -}} diff --git a/charts/flink-job/values.schema.json b/charts/flink-job/values.schema.json index 681cf870..a4e83ea9 100644 --- a/charts/flink-job/values.schema.json +++ b/charts/flink-job/values.schema.json @@ -682,15 +682,8 @@ } }, "java17Compatability": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - } - }, - "required": [ - "enabled" - ] + "description": "Whether to add Java 17 compatability options. For details see https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/deployment/java_compatibility/#jdk-modularization and https://github.com/apache/flink/blob/release-1.18/flink-dist/src/main/resources/flink-conf.yaml#L19-L21", + "type": "boolean" }, "dnsForKubernetesHost": { "type": "boolean" diff --git a/charts/flink-job/values.yaml b/charts/flink-job/values.yaml index a3253f0e..53ab7cb1 100644 --- a/charts/flink-job/values.yaml +++ b/charts/flink-job/values.yaml @@ -473,6 +473,7 @@ image-automation: # Any other configuration given here, is passed to it enabled: false -java17Compatability: - # -- Whether to enable Java 17 compatibility - enabled: false +# -- Whether to add Java 17 compatability options. +# For details see https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/deployment/java_compatibility/#jdk-modularization +# and https://github.com/apache/flink/blob/release-1.18/flink-dist/src/main/resources/flink-conf.yaml#L19-L21 +java17Compatability: true