srpraneeth commented on code in PR #670:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/670#discussion_r1323676402


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/FlinkConfigBuilder.java:
##########
@@ -420,13 +421,24 @@ private void setResource(Resource resource, Configuration 
effectiveConfig, boole
                             ? JobManagerOptions.TOTAL_PROCESS_MEMORY
                             : TaskManagerOptions.TOTAL_PROCESS_MEMORY;
             if (resource.getMemory() != null) {
-                effectiveConfig.setString(memoryConfigOption.key(), 
resource.getMemory());
+                effectiveConfig.setString(
+                        memoryConfigOption.key(), 
parseResourceMemoryString(resource.getMemory()));
             }
 
             configureCpu(resource, effectiveConfig, isJM);
         }
     }
 
+    // Using the K8s units specification for the JM and TM memory settings
+    private String parseResourceMemoryString(String memory) {
+        try {
+            return MemorySize.parse(memory).toString();

Review Comment:
   @morhidi The issue is that Flink interprets values only in Bibytes (gi, mi, 
ki) format. For instance, a simple value like '2g' is currently interpreted as 
'2gi = 2147483648 b' and there is no way to use both Bibyte and decimal byte 
formats as in K8s Spec.
   
   This change will ensure that '2gi' is interpreted as '2g' accordingly, and 
the appropriate memory will be used. I assume that by 'backward change,' here 
means that the existing CR memory configuration should remain functional and 
not be disrupted, even though the values interpreted by the operator will 
change.



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