4747
4848import java .lang .reflect .Method ;
4949import java .util .Collections ;
50+ import java .util .Map ;
5051import java .util .UUID ;
5152import java .util .regex .Matcher ;
5253import 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