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


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java:
##########
@@ -195,6 +201,34 @@ protected void deploy(
                 relatedResource.getMetadata(), spec, deployConfig, 
kubernetesClient);
     }
 
+    private void setJobIdIfNecessary(
+            FlinkDeploymentSpec spec, FlinkDeploymentStatus status, 
Configuration deployConfig) {
+        // https://issues.apache.org/jira/browse/FLINK-19358
+        // https://issues.apache.org/jira/browse/FLINK-29109
+        if (spec.getFlinkVersion().isNewerVersionThan(FlinkVersion.v1_15)) {
+            return;
+        }
+
+        final JobID jobId;

Review Comment:
   We could use the String representation and set this directly from 
`status.getJobStatus().getJobId()` to get rid of the `else` branch later.



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java:
##########
@@ -195,6 +201,34 @@ protected void deploy(
                 relatedResource.getMetadata(), spec, deployConfig, 
kubernetesClient);
     }
 
+    private void setJobIdIfNecessary(
+            FlinkDeploymentSpec spec, FlinkDeploymentStatus status, 
Configuration deployConfig) {
+        // https://issues.apache.org/jira/browse/FLINK-19358
+        // https://issues.apache.org/jira/browse/FLINK-29109
+        if (spec.getFlinkVersion().isNewerVersionThan(FlinkVersion.v1_15)) {
+            return;
+        }
+
+        final JobID jobId;
+        // generate jobId initially or rotate on every deployment when mode is 
stateless
+        if (status.getJobStatus().getJobId() == null
+                || spec.getJob().getUpgradeMode() == UpgradeMode.STATELESS) {
+            if 
(deployConfig.get(PipelineOptionsInternal.PIPELINE_FIXED_JOB_ID) != null) {
+                // user managed, don't touch
+                return;
+            }

Review Comment:
   We could move this before the `if` clause to simplify



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