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


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/AbstractFlinkResourceReconciler.java:
##########
@@ -316,6 +320,35 @@ private boolean checkNewSpecAlreadyDeployed(CR resource, 
Configuration deployCon
         return false;
     }
 
+    /**
+     * Scale the cluster whenever there is a scaling change, based on the task 
manager replica
+     * update or the parallelism in case of scheduler mode.
+     *
+     * @param cr Resource being reconciled.
+     * @param ctx Reconciliation context.
+     * @param observeConfig Observe configuration.
+     * @param deployConfig Configuration to be deployed.
+     * @param diffType Spec change type.
+     * @throws Exception
+     */
+    private void scaleCluster(
+            CR cr,
+            Context<?> ctx,
+            Configuration observeConfig,
+            Configuration deployConfig,
+            DiffType diffType)
+            throws Exception {
+        boolean scaled =
+                getFlinkService(cr, ctx)
+                        .scale(cr.getMetadata(), cr.getSpec().getJob(), 
deployConfig);
+        if (scaled) {
+            LOG.info("Scaling succeeded");
+            ReconciliationUtils.updateStatusForDeployedSpec(cr, deployConfig);
+            return;
+        }
+        reconcileSpecChange(cr, ctx, observeConfig, deployConfig, diffType);

Review Comment:
   it might be better to return a boolean from this method so we don't need to 
call `reconcileSpecChange` from two places.



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