mxm commented on code in PR #729:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/729#discussion_r1426558636
##########
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:
I changed the PR to not delete them as you suggested. The reason is that
while testing I found that operating on the Configuration API is dangerous
(which is why the first version of this PR did intentionally operate directly
on the internal Map). When you delete a key via `Configuration#removeKey` which
is a prefix of another key, it will delete both.
We won't get warnings because the deprecated config keys have been removed
in this PR.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]