morhidi commented on code in PR #215:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/215#discussion_r872986702


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/sessionjob/FlinkSessionJobReconciler.java:
##########
@@ -76,6 +78,24 @@ public void reconcile(FlinkSessionJob flinkSessionJob, 
Context context) throws E
                 OperatorUtils.getSecondaryResource(
                         flinkSessionJob, context, 
configManager.getOperatorConfiguration());
 
+        var labels = flinkSessionJob.getMetadata().getLabels();

Review Comment:
   I suggest to extract this into a utility method (we could use 
computeIfAbsent)



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/sessionjob/FlinkSessionJobReconciler.java:
##########
@@ -76,6 +78,24 @@ public void reconcile(FlinkSessionJob flinkSessionJob, 
Context context) throws E
                 OperatorUtils.getSecondaryResource(
                         flinkSessionJob, context, 
configManager.getOperatorConfiguration());
 
+        var labels = flinkSessionJob.getMetadata().getLabels();
+        if (labels == null) {
+            labels = new HashMap<>();
+        }
+        if (!flinkSessionJob
+                .getSpec()
+                .getDeploymentName()
+                .equals(labels.get(LABEL_SESSION_CLUSTER))) {
+            labels.put(LABEL_SESSION_CLUSTER, 
flinkSessionJob.getSpec().getDeploymentName());
+            flinkSessionJob.getMetadata().setLabels(labels);
+            kubernetesClient

Review Comment:
   Can't we use an update control for this?



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