You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by GitBox <gi...@apache.org> on 2022/03/01 10:03:14 UTC

[GitHub] [flink-kubernetes-operator] bgeng777 commented on a change in pull request #29: [FLINK-26405] Add validation check of num of JM replica

bgeng777 commented on a change in pull request #29:
URL: https://github.com/apache/flink-kubernetes-operator/pull/29#discussion_r816621065



##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/validation/DefaultDeploymentValidator.java
##########
@@ -86,12 +87,26 @@
         return Optional.empty();
     }
 
-    private Optional<String> validateJmSpec(JobManagerSpec jmSpec) {
+    private Optional<String> validateJmSpec(JobManagerSpec jmSpec, Map<String, String> confMap) {
         if (jmSpec == null) {
             return Optional.empty();
         }
 
-        return validateResources("JobManager", jmSpec.getResource());
+        return firstPresent(
+                validateResources("JobManager", jmSpec.getResource()),
+                validateJmReplicas("JobManager", jmSpec.getReplicas(), confMap));
+    }
+
+    private Optional<String> validateJmReplicas(
+            String component, int replicas, Map<String, String> confMap) {
+        if (!confMap.containsKey(HighAvailabilityOptions.HA_MODE.key()) && replicas != 1) {

Review comment:
       My bad for using wrong judgement method. I have followed Yang's advice to fix it in this new #30.

##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/validation/DefaultDeploymentValidator.java
##########
@@ -86,12 +87,26 @@
         return Optional.empty();
     }
 
-    private Optional<String> validateJmSpec(JobManagerSpec jmSpec) {
+    private Optional<String> validateJmSpec(JobManagerSpec jmSpec, Map<String, String> confMap) {
         if (jmSpec == null) {
             return Optional.empty();
         }
 
-        return validateResources("JobManager", jmSpec.getResource());
+        return firstPresent(
+                validateResources("JobManager", jmSpec.getResource()),
+                validateJmReplicas("JobManager", jmSpec.getReplicas(), confMap));
+    }
+
+    private Optional<String> validateJmReplicas(
+            String component, int replicas, Map<String, String> confMap) {
+        if (!confMap.containsKey(HighAvailabilityOptions.HA_MODE.key()) && replicas != 1) {

Review comment:
       My bad for using wrong judgement method. I have followed Yang's advice to fix it in this PR #30.




-- 
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: commits-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org