davidradl commented on code in PR #957:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/957#discussion_r2007881847
##########
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:
why is this one not RECONCILING like the pattern the others follow others? I
suggest a comment, also a constant is better then a an inline literal.
--
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]