laughingman7743 commented on code in PR #1222:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/1222#discussion_r4709095913


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/validation/DefaultValidator.java:
##########
@@ -412,6 +415,46 @@ private Optional<String> 
validateTmReplicas(TaskManagerSpec tmSpec) {
         return Optional.empty();
     }
 
+    private Optional<String> validateStandaloneParallelism(

Review Comment:
   Thank you for the suggestion! I have moved the check into `validateJobSpec`, 
which now also receives the deployment mode, and removed the dedicated method.
   



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/validation/DefaultValidator.java:
##########
@@ -412,6 +415,46 @@ private Optional<String> 
validateTmReplicas(TaskManagerSpec tmSpec) {
         return Optional.empty();
     }
 
+    private Optional<String> validateStandaloneParallelism(
+            FlinkDeploymentSpec spec, Map<String, String> confMap) {
+        final var job = spec.getJob();
+        final var tm = spec.getTaskManager();
+        if (job == null
+                || tm == null
+                || tm.getReplicas() == null
+                || KubernetesDeploymentMode.getDeploymentMode(spec)
+                        != KubernetesDeploymentMode.STANDALONE) {
+            return Optional.empty();
+        }
+
+        final Configuration conf = Configuration.fromMap(confMap);
+        if 
(conf.get(KubernetesOperatorConfigOptions.JOB_PARALLELISM_DERIVE_FROM_REPLICAS))
 {
+            return Optional.empty();
+        }
+
+        final int slots = tm.getReplicas() * 
conf.get(TaskManagerOptions.NUM_TASK_SLOTS);
+        final int parallelism =
+                Math.max(
+                        job.getParallelism(),
+                        conf.getOptional(PipelineOptions.PARALLELISM_OVERRIDES)
+                                .flatMap(
+                                        overrides ->
+                                                overrides.values().stream()
+                                                        .map(Integer::valueOf)

Review Comment:
   Good point, thank you! I have wrapped the parsing of the overrides in a 
try-catch block. Following how the other parse errors are handled in 
`DefaultValidator`, an invalid value is now reported as a validation error 
instead of throwing, and I added 
`testStandaloneInvalidParallelismOverrideIsRejected` for it. If you would 
rather skip the check in that case, I am happy to change 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]

Reply via email to