You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/06/29 07:22:59 UTC

[GitHub] [flink-kubernetes-operator] gyfora commented on a diff in pull request #283: [FLINK-28228] Never skip generations when observing already upgraded deployment

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


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/observer/deployment/AbstractDeploymentObserver.java:
##########
@@ -279,21 +279,35 @@ private void checkIfAlreadyUpgraded(FlinkDeployment flinkDep, Context context) {
                     Long upgradeTargetGeneration =
                             ReconciliationUtils.getUpgradeTargetGeneration(flinkDep);
 
+                    Long currentSpecGeneration = flinkDep.getMetadata().getGeneration();
+
                     if (deployedGeneration.equals(upgradeTargetGeneration)) {
-                        logger.info(
-                                "Last reconciled generation is already deployed, setting reconciliation status to "
-                                        + ReconciliationState.DEPLOYED);
+                        logger.info("Pending upgrade is already deployed, updating status.");
 
                         var firstDeploy =
                                 status.getReconciliationStatus().getLastReconciledSpec() == null;
-                        var conf =
-                                firstDeploy
-                                        ? configManager.getDeployConfig(
-                                                flinkDep.getMetadata(), flinkDep.getSpec())
-                                        : configManager.getObserveConfig(flinkDep);
+                        if (firstDeploy) {
+                            ReconciliationUtils.updateForSpecReconciliationSuccess(
+                                    flinkDep,
+                                    JobState.RUNNING,
+                                    configManager.getDeployConfig(
+                                            flinkDep.getMetadata(), flinkDep.getSpec()));
+                        } else {
+                            ReconciliationUtils.updateStatusForAlreadyUpgraded(flinkDep);
+                        }
+
+                        status.getJobStatus()
+                                .setState(org.apache.flink.api.common.JobStatus.RECONCILING.name());
+                        status.setJobManagerDeploymentStatus(JobManagerDeploymentStatus.DEPLOYING);
+                    } else if (deployedGeneration.equals(currentSpecGeneration)) {

Review Comment:
   this only affects the first deployment scenario so it’s not a critical optimization but I can see how complicated it would be to add 



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

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