You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2020/12/01 10:02:42 UTC
[flink] 02/03: [hotfix][k8s] Specify which characters are allowed
for kubernetes.cluster-id
This is an automated email from the ASF dual-hosted git repository.
trohrmann pushed a commit to branch release-1.12
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 8155c22313548a4680ed6a18520becfb095b6f4d
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Mon Nov 30 10:40:28 2020 +0100
[hotfix][k8s] Specify which characters are allowed for kubernetes.cluster-id
Only lowercase alphanumeric characters, "-" or "." are allowed.
---
.../generated/kubernetes_config_configuration.html | 2 +-
.../configuration/KubernetesConfigOptions.java | 17 +++++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/docs/_includes/generated/kubernetes_config_configuration.html b/docs/_includes/generated/kubernetes_config_configuration.html
index aecaf0c..629e8d6 100644
--- a/docs/_includes/generated/kubernetes_config_configuration.html
+++ b/docs/_includes/generated/kubernetes_config_configuration.html
@@ -18,7 +18,7 @@
<td><h5>kubernetes.cluster-id</h5></td>
<td style="word-wrap: break-word;">(none)</td>
<td>String</td>
- <td>The cluster-id, which should be no more than 45 characters, is used for identifying a unique Flink cluster. If not set, the client will automatically generate it with a random ID.</td>
+ <td>The cluster-id, which should be no more than 45 characters, is used for identifying a unique Flink cluster. The id must only contain lowercase alphanumeric characters and "-". The required format is <span markdown="span">`[a-z]([-a-z0-9]*[a-z0-9])`</span>. If not set, the client will automatically generate it with a random ID.</td>
</tr>
<tr>
<td><h5>kubernetes.config.file</h5></td>
diff --git a/flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java b/flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java
index d707150..86a7e76 100644
--- a/flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java
+++ b/flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java
@@ -23,7 +23,6 @@ import org.apache.flink.annotation.docs.Documentation;
import org.apache.flink.configuration.ConfigOption;
import org.apache.flink.configuration.ExternalResourceOptions;
import org.apache.flink.configuration.description.Description;
-import org.apache.flink.configuration.description.TextElement;
import org.apache.flink.runtime.util.EnvironmentInformation;
import java.util.List;
@@ -31,6 +30,7 @@ import java.util.Locale;
import java.util.Map;
import static org.apache.flink.configuration.ConfigOptions.key;
+import static org.apache.flink.configuration.description.TextElement.code;
/**
* This class holds configuration constants used by Flink's kubernetes runners.
@@ -139,8 +139,13 @@ public class KubernetesConfigOptions {
key("kubernetes.cluster-id")
.stringType()
.noDefaultValue()
- .withDescription("The cluster-id, which should be no more than 45 characters, is used for identifying " +
- "a unique Flink cluster. If not set, the client will automatically generate it with a random ID.");
+ .withDescription(Description.builder()
+ .text("The cluster-id, which should be no more than 45 characters, is used for identifying a unique Flink cluster. "
+ + "The id must only contain lowercase alphanumeric characters and \"-\". "
+ + "The required format is %s. "
+ + "If not set, the client will automatically generate it with a random ID.",
+ code("[a-z]([-a-z0-9]*[a-z0-9])"))
+ .build());
@Documentation.OverrideDefault("The default value depends on the actually running version. In general it looks like \"flink:<FLINK_VERSION>-scala_<SCALA_VERSION>\"")
public static final ConfigOption<String> CONTAINER_IMAGE =
@@ -230,7 +235,7 @@ public class KubernetesConfigOptions {
.withDescription(
Description.builder()
.text("The user-specified secrets that will be mounted into Flink container. The value should be in " +
- "the form of %s.", TextElement.code("foo:/opt/secrets-foo,bar:/opt/secrets-bar"))
+ "the form of %s.", code("foo:/opt/secrets-foo,bar:/opt/secrets-bar"))
.build());
public static final ConfigOption<List<Map<String, String>>> KUBERNETES_ENV_SECRET_KEY_REF =
@@ -241,7 +246,7 @@ public class KubernetesConfigOptions {
.withDescription(
Description.builder()
.text("The user-specified secrets to set env variables in Flink container. The value should be in " +
- "the form of %s.", TextElement.code("env:FOO_ENV,secret:foo_secret,key:foo_key;env:BAR_ENV,secret:bar_secret,key:bar_key"))
+ "the form of %s.", code("env:FOO_ENV,secret:foo_secret,key:foo_key;env:BAR_ENV,secret:bar_secret,key:bar_key"))
.build());
/**
@@ -265,7 +270,7 @@ public class KubernetesConfigOptions {
.withDescription(
Description.builder()
.text("Defines the number of Kubernetes transactional operation retries before the " +
- "client gives up. For example, %s.", TextElement.code("FlinkKubeClient#checkAndUpdateConfigMap"))
+ "client gives up. For example, %s.", code("FlinkKubeClient#checkAndUpdateConfigMap"))
.build());
private static String getDefaultFlinkImage() {