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


##########
flink-kubernetes-operator-api/src/main/java/org/apache/flink/kubernetes/operator/api/utils/ConditionUtils.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.operator.api.utils;
+
+import org.apache.flink.api.common.JobStatus;
+import 
org.apache.flink.kubernetes.operator.api.status.JobManagerDeploymentStatus;
+
+import io.fabric8.kubernetes.api.model.Condition;
+import io.fabric8.kubernetes.api.model.ConditionBuilder;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+
+/** Creates a condition object with the type, status, message and reason. */
+public class ConditionUtils {
+    public static Condition crCondition(Condition condition) {
+        return new ConditionBuilder(condition)
+                .withLastTransitionTime(
+                        new 
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(new Date()))
+                .build();
+    }
+
+    public static final Map<String, Condition> SESSION_MODE_CONDITION =
+            Map.of(
+                    JobManagerDeploymentStatus.READY.name(),
+                    new ConditionBuilder()
+                            .withType("Running")
+                            .withStatus("True")
+                            .withMessage("Ready")
+                            .withReason("JobManager is running and ready to 
receive REST API calls")

Review Comment:
   isn't the reason - how it got to this state, not a description of the state 
itself? 
   
   
[https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions)
   
   it says:
   reason | Machine-readable, UpperCamelCase text indicating the reason for the 
condition's last transition.
   
   
   



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