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


##########
flink-kubernetes-operator-api/src/main/java/org/apache/flink/kubernetes/operator/api/spec/ConfigObjectNode.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.api.spec;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/** */
+public class ConfigObjectNode extends ObjectNode {
+
+    public ConfigObjectNode() {
+        this(JsonNodeFactory.instance);
+    }
+
+    public ConfigObjectNode(JsonNodeFactory nc, Map<String, JsonNode> kids) {
+        super(nc, kids);
+    }
+
+    public ConfigObjectNode(JsonNodeFactory nc) {
+        super(nc);
+    }
+
+    public void removeAll(String... names) {
+        for (String name : names) {
+            remove(name);
+        }
+    }
+
+    public void putAllFrom(Map<String, String> value) {
+        value.forEach(this::put);
+    }
+
+    public void set(Map<String, String> value) {
+        removeAll();

Review Comment:
   This looks a bit confusing, we probably shouldn't introduce a varargs 
variant of the same method that does something completely different :) 



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/autoscaler/KubernetesScalingRealizer.java:
##########
@@ -63,15 +62,16 @@ public void realizeConfigOverrides(
         }
         FlinkDeployment flinkDeployment = ((FlinkDeployment) 
context.getResource());
         // Apply config overrides
-        Map<String, String> flinkConf = 
flinkDeployment.getSpec().getFlinkConfiguration();
-        for (String keyToRemove : configChanges.getRemovals()) {
-            flinkConf.remove(keyToRemove);
-        }
-        flinkConf.putAll(configChanges.getOverrides());
+
+        
flinkDeployment.getSpec().getFlinkConfiguration().remove(configChanges.getRemovals());

Review Comment:
   Should this be removeAll? Seems like we are removing a single key here which 
will do nothing



##########
flink-kubernetes-operator-api/src/main/java/org/apache/flink/kubernetes/operator/api/spec/ConfigObjectNode.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.api.spec;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/** */
+public class ConfigObjectNode extends ObjectNode {
+
+    public ConfigObjectNode() {
+        this(JsonNodeFactory.instance);
+    }
+
+    public ConfigObjectNode(JsonNodeFactory nc, Map<String, JsonNode> kids) {
+        super(nc, kids);
+    }
+
+    public ConfigObjectNode(JsonNodeFactory nc) {
+        super(nc);
+    }
+
+    public void removeAll(String... names) {
+        for (String name : names) {
+            remove(name);
+        }
+    }
+
+    public void putAllFrom(Map<String, String> value) {

Review Comment:
   Should we call it simply putAll?



-- 
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