Skip to content

Commit 3b48594

Browse files
authored
[Bug] Fix k8s test bug (#3997)
Co-authored-by: gaoyan1998 <gaoyan1998@users.noreply.github.com>
1 parent 1ffe49f commit 3b48594

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

dinky-gateway/src/main/java/org/dinky/gateway/kubernetes/KubernetesGateway.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,14 @@ public void init() {
8787
protected void initConfig() {
8888
flinkConfigPath = config.getClusterConfig().getFlinkConfigPath();
8989
flinkConfig = config.getFlinkConfig();
90-
if (!isValidTaskName(flinkConfig.getJobName())) {
91-
throw new GatewayException(
92-
"In Kubernetes mode, task names must start and end with a lowercase letter or a digit, "
93-
+ "and can contain lowercase letters, digits, dots, and hyphens in between.");
90+
String jobName = flinkConfig.getJobName();
91+
if (TextUtil.isEmpty(jobName)) {
92+
jobName = this.configuration.getString(KubernetesConfigOptions.CLUSTER_ID.key(), null);
93+
}
94+
if (!isValidTaskName(jobName)) {
95+
throw new GatewayException(jobName
96+
+ " is not Valid. In Kubernetes mode, task names must start and end with a lowercase letter or a digit, "
97+
+ "and can contain lowercase letters, digits, dots, and hyphens in between.");
9498
}
9599
k8sConfig = config.getKubernetesConfig();
96100

0 commit comments

Comments
 (0)