gyfora commented on code in PR #729:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/729#discussion_r1425609941


##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/config/AutoScalerOptions.java:
##########
@@ -247,21 +222,41 @@ private static ConfigOptions.OptionBuilder 
autoScalerConfig(String key) {
                     .stringType()
                     .asList()
                     .defaultValues()
-                    
.withFallbackKeys(oldOperatorConfigKey("vertex.exclude.ids"))
                     .withDescription(
                             "A (semicolon-separated) list of vertex ids in 
hexstring for which to disable scaling. Caution: For non-sink vertices this 
will still scale their downstream operators until 
https://issues.apache.org/jira/browse/FLINK-31215 is implemented.");
 
     public static final ConfigOption<Duration> SCALING_EVENT_INTERVAL =
             autoScalerConfig("scaling.event.interval")
                     .durationType()
                     .defaultValue(Duration.ofMinutes(30))
-                    
.withFallbackKeys(oldOperatorConfigKey("scaling.event.interval"))
                     .withDescription("Time interval to resend the identical 
event");
 
     public static final ConfigOption<Duration> FLINK_CLIENT_TIMEOUT =
             autoScalerConfig("flink.rest-client.timeout")
                     .durationType()
                     .defaultValue(Duration.ofSeconds(10))
-                    
.withFallbackKeys(oldOperatorConfigKey("flink.rest-client.timeout"))
                     .withDescription("The timeout for waiting the flink rest 
client to return.");
+
+    /** Migrate config keys still prefixed with the old Kubernetes operator 
prefix. */
+    public static Configuration migrateOldConfigKeys(Configuration config) {
+        Preconditions.checkNotNull(config);
+        config = new Configuration(config);
+
+        Set<String> toBeMigrated = new HashSet<>();
+        for (String key : config.keySet()) {
+            if (key.startsWith(LEGACY_CONF_PREFIX)) {
+                toBeMigrated.add(key);
+            }
+        }
+        for (String key : toBeMigrated) {
+            String migratedKey = key.substring(LEGACY_CONF_PREFIX.length());
+            boolean keyDoesNotExist = config.getString(migratedKey, null) == 
null;
+            if (keyDoesNotExist) {
+                String migratedValue = 
Preconditions.checkNotNull(config.getString(key, null));
+                config.setString(migratedKey, migratedValue);
+            }
+            config.removeKey(key);

Review Comment:
   Actually I am not sure whether we will get the warn logs if we don't delete 
it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to