lajith2006 commented on code in PR #957:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/957#discussion_r2013971477


##########
flink-kubernetes-operator-api/src/main/java/org/apache/flink/kubernetes/operator/api/status/FlinkDeploymentStatus.java:
##########
@@ -55,4 +60,175 @@ public class FlinkDeploymentStatus extends 
CommonStatus<FlinkDeploymentSpec> {
 
     /** Information about the TaskManagers for the scale subresource. */
     private TaskManagerInfo taskManager;
+
+    /** Condition of the CR . */
+    private List<Condition> conditions = new ArrayList<>();
+
+    private String phase;
+
+    public List<Condition> getConditions() {
+        if (reconciliationStatus != null
+                && reconciliationStatus.deserializeLastReconciledSpec() != null
+                && 
reconciliationStatus.deserializeLastReconciledSpec().getJob() == null) {
+            switch (jobManagerDeploymentStatus) {
+                case READY:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningTrue(
+                                    "JobManager is running and ready to 
receive REST API call",
+                                    "JobManager is running and ready to 
receive REST API call"));
+                    break;
+                case MISSING:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    "JobManager deployment not found",
+                                    "JobManager deployment not found"));
+                    break;
+                case DEPLOYING:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    "JobManager process is starting up",
+                                    "JobManager process is starting up"));
+                    break;
+                case DEPLOYED_NOT_READY:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    "JobManager is running but not ready yet 
to receive REST API calls",
+                                    "JobManager is running but not ready yet 
to receive REST API calls"));
+                    break;
+                case ERROR:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    "Deployment in terminal error, requires 
spec change for reconciliation to continue",
+                                    "JobManager deployment failed"));
+            }
+        } else if (getJobStatus() != null && getJobStatus().getState() != 
null) {
+            switch (getJobStatus().getState()) {
+                case RECONCILING:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    JobStatus.RECONCILING.name(), "Job is 
currently reconciling"));
+                    break;
+                case CREATED:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    JobStatus.CREATED.name(), "Job is 
created"));
+                    break;
+                case RUNNING:
+                    updateCondition(
+                            conditions,
+                            
ConditionUtils.runningTrue(JobStatus.RUNNING.name(), "Job is running"));
+                    break;
+                case FAILING:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    JobStatus.FAILING.name(), "Job has 
failed"));
+                    break;
+                case RESTARTING:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    JobStatus.RESTARTING.name(),
+                                    "The job is currently undergoing a 
restarting"));
+                    break;
+                case FAILED:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    JobStatus.FAILED.name(),
+                                    "The job has failed with a non-recoverable 
task failure"));
+                    break;
+                case FINISHED:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    JobStatus.FINISHED.name(),
+                                    "Job's tasks have successfully finished"));
+                    break;
+
+                case CANCELED:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    JobStatus.CANCELED.name(), "Job has been 
cancelled"));
+                    break;
+                case SUSPENDED:
+                    updateCondition(
+                            conditions,
+                            ConditionUtils.runningFalse(
+                                    JobStatus.SUSPENDED.name(), "The job has 
been suspended"));
+                    break;
+            }
+        }
+        return conditions;
+    }
+
+    public String getPhase() {
+        if (reconciliationStatus != null
+                && reconciliationStatus.deserializeLastReconciledSpec() != null
+                && 
reconciliationStatus.deserializeLastReconciledSpec().getJob() == null) {
+            switch (jobManagerDeploymentStatus) {
+                case READY:
+                    phase = "Running";
+                    break;
+                case MISSING:
+                case ERROR:
+                case DEPLOYING:
+                    phase = "Pending";
+                    break;
+            }
+        } else if (getJobStatus() != null && getJobStatus().getState() != 
null) {
+            switch (getJobStatus().getState()) {
+                case RECONCILING:
+                    phase = "Pending";

Review Comment:
   Right, as mentioned 
[here](https://issues.apache.org/jira/browse/FLINK-33634?focusedCommentId=17933676&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17933676)
 , `phase` which is intended to keep the current status of FlinkDeployment 
especially useful in Openshift environment, as Openshift UI can  render the 
value from `status.phase` and populate the current status of deployment.  
   
   As when FlinkDeployment applied in Application Mode,  in the initial phase, 
as the JM  brining up , job state would be in `RECONCILING` state, so 
status.phase is kept as "Pending". 



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

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

Reply via email to