mxm commented on code in PR #762:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/762#discussion_r1478007838
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/autoscaler/KubernetesScalingRealizer.java:
##########
@@ -43,6 +53,32 @@ public void realize(
getOverrideString(context, parallelismOverrides));
}
+ @Override
+ public void realizeMemoryOverrides(
+ KubernetesJobAutoScalerContext context, Configuration
configOverrides) {
+
+ if (context.getResource() instanceof FlinkDeployment) {
+ var flinkDeployment = ((FlinkDeployment) context.getResource());
+
+
flinkDeployment.getSpec().getFlinkConfiguration().putAll(configOverrides.toMap());
+
+ var totalMemoryOverride =
MemoryTuningUtils.getTotalMemory(configOverrides, context);
+ if (totalMemoryOverride.compareTo(MemorySize.ZERO) > 0) {
+ Resource tmResource =
flinkDeployment.getSpec().getTaskManager().getResource();
+ // Make sure to support the Kubernetes syntax here, which
supports more formats than
+ // Flink's classes.
+ var currentMemory =
+ new MemorySize(
+
(Quantity.parse(tmResource.getMemory()).getNumericalAmount())
Review Comment:
Thanks for raising this. I intentionally added this way of parsing because I
thought it is compatible with Kubernetes. Flink's MemorySize is a subset of
Kubernetes because it does not support base 2 notation (e.g. Gigibytes). I
didn't realize Flink is base 2 by default. I also forgot about the M vs MB
notation. I'm afraid this logic might be broken in other parts of the operator.
I'll look into 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]