swathic95 commented on code in PR #481:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/481#discussion_r1046852187
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/StandaloneFlinkService.java:
##########
@@ -171,11 +170,6 @@ protected void deleteClusterInternal(ObjectMeta meta,
boolean deleteHaConfigmaps
@Override
public boolean scale(ObjectMeta meta, JobSpec jobSpec, Configuration conf)
{
- if (conf.get(JobManagerOptions.SCHEDULER_MODE) == null) {
Review Comment:
In this case, we are calculating the desired replicas as
```
var desiredReplicas =
conf.get(StandaloneKubernetesConfigOptionsInternal.KUBERNETES_TASKMANAGER_REPLICAS);
```
Which is actually ```kubernetes.internal.taskmanager.replicas``` which is
created whenever there is a CR update while building the task manager. Here,
this value would be equal to the following:
1) If taskmanager replicas are present, KUBERNETES_TASKMANAGER_REPLICAS =
task_manager_replicas configured. [Code Reference to
1](https://github.com/apache/flink-kubernetes-operator/blob/dc173cbccd5f9a90fe573ce01790684253dcc0a9/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/FlinkConfigBuilder.java#L233)
2) Else, if a job is running, it calculates the parallelism = task_slots *
task_manager_replicas or parallelism configured ( if no TM replicas ) and [Code
reference to 2
](https://github.com/apache/flink-kubernetes-operator/blob/dc173cbccd5f9a90fe573ce01790684253dcc0a9/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/FlinkConfigBuilder.java#L247)
```KUBERNETES_TASKMANAGER_REPLICAS = (parallelism + taskSlots - 1) /
taskSlots;```
[Internal task manager calc for 2 ](
https://github.com/apache/flink-kubernetes-operator/blob/dc173cbccd5f9a90fe573ce01790684253dcc0a9/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/FlinkUtils.java#L174)
We'll always fall to 1st category as the user has updated the task manager
replicas manually.
@gyfora , @morhidi if you think, we have other scenarios which might affect
it,let me know, I'll create another diffType ( SCALE_REPLICAS ) which will be
used only by task manager replicas change and add a separate logic to scale
based on the desired TM replicas and not
```kubernetes.internal.taskmanager.replicas```
--
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]