Skip to content

Commit ca7843e

Browse files
aiwenmoJam804tclxyuhang2-zhang
authored
[bug][dinky-gateway] Fix the issue where two Flink configuration items with the same prefix cause errors in Flink configuration parsing (#4286)
Co-authored-by: zhangyuhang <2827528315@qq.com> Co-authored-by: yuhang2.zhang <yuhang2.zhang@ly.com>
1 parent d6cab25 commit ca7843e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
import java.lang.reflect.Method;
4949
import java.util.Collections;
50+
import java.util.Map;
5051
import java.util.UUID;
5152
import java.util.regex.Matcher;
5253
import java.util.regex.Pattern;
@@ -102,17 +103,6 @@ protected void initConfig() {
102103
+ " is not Valid. In Kubernetes mode, task names must start and end with a lowercase letter or a digit, "
103104
+ "and can contain lowercase letters, digits, dots, and hyphens in between.");
104105
}
105-
k8sConfig = config.getKubernetesConfig();
106-
107-
// Be compatible with kubernetes.container.image and kubernetes.container.image.ref
108-
final String oldContainerImageKey = "kubernetes.container.image";
109-
if (k8sConfig.getConfiguration().containsKey(oldContainerImageKey)) {
110-
k8sConfig
111-
.getConfiguration()
112-
.put(
113-
KubernetesConfigOptions.CONTAINER_IMAGE.key(),
114-
k8sConfig.getConfiguration().get(oldContainerImageKey));
115-
}
116106

117107
configuration.set(CoreOptions.CLASSLOADER_RESOLVE_ORDER, "parent-first");
118108
try {
@@ -122,8 +112,17 @@ protected void initConfig() {
122112
logger.warn("load locale config yaml failed:{},Skip config it", e.getMessage());
123113
}
124114

115+
k8sConfig = config.getKubernetesConfig();
116+
// 兼容kubernetes.container.image 和 kubernetes.container.image.ref
117+
Map<String, String> k8sConfiguration = k8sConfig.getConfiguration();
118+
final String oldContainerImageKey = "kubernetes.container.image";
119+
if (k8sConfiguration.containsKey(oldContainerImageKey)) {
120+
String containerImageValue = k8sConfiguration.get(oldContainerImageKey);
121+
k8sConfiguration.remove(oldContainerImageKey);
122+
k8sConfiguration.put(KubernetesConfigOptions.CONTAINER_IMAGE.key(), containerImageValue);
123+
}
125124
// -------------------Note: the sequence can not be changed, priority problem----------------
126-
addConfigParas(k8sConfig.getConfiguration());
125+
addConfigParas(k8sConfiguration);
127126
addConfigParas(flinkConfig.getConfiguration());
128127
// -------------------------------------------
129128
addConfigParas(DeploymentOptions.TARGET, getType().getLongValue());

0 commit comments

Comments
 (0)