suneet-s commented on code in PR #14758:
URL: https://github.com/apache/druid/pull/14758#discussion_r1284961786


##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesPeonLifecycle.java:
##########
@@ -250,8 +250,10 @@ protected TaskLocation getTaskLocation()
           podStatus.getPodIP(),
           DruidK8sConstants.PORT,
           DruidK8sConstants.TLS_PORT,
-          
Boolean.parseBoolean(pod.getMetadata().getAnnotations().getOrDefault(DruidK8sConstants.TLS_ENABLED,
 "false"))
+          
Boolean.parseBoolean(pod.getMetadata().getAnnotations().getOrDefault(DruidK8sConstants.TLS_ENABLED,
 "false")),
+          pod.getMetadata() != null ? pod.getMetadata().getName() : ""
       );
+      log.info(StringUtils.format("K8s task %s is running at location %s", 
taskId.getOriginalTaskId(), taskLocation));

Review Comment:
   It is better not to use StringUtils.format in the log message directly as 
this will cause the string to be formatted even if the log level is set to a 
higher level like `warn`
   
   ```suggestion
         log.info("K8s task %s is running at location %s", 
taskId.getOriginalTaskId(), taskLocation);
   ```



##########
processing/src/main/java/org/apache/druid/indexer/TaskLocation.java:
##########
@@ -30,21 +31,29 @@
 
 public class TaskLocation
 {
-  private static final TaskLocation UNKNOWN = new TaskLocation(null, -1, -1);
+  private static final TaskLocation UNKNOWN = new TaskLocation(null, -1, -1, 
null);
 
   @Nullable
   private final String host;
   private final int port;
   private final int tlsPort;
 
+  @Nullable
+  private final String k8sPodName;

Review Comment:
   I think `k8sJobName` will be a good name here as this is what it is called 
in the code in `K8sTaskId`



##########
processing/src/test/java/org/apache/druid/indexer/TaskLocationTest.java:
##########
@@ -54,6 +54,18 @@ public void testTlsForPeonJobs()
     Assert.assertEquals(2, tls.getTlsPort());
   }
 
+  @Test
+  public void testDefaultK8sJobName()
+  {
+    TaskLocation noK8sJobName = TaskLocation.create("foo", 1, 2, false);
+    Assert.assertNull(noK8sJobName.getK8sPodName());
+    noK8sJobName = TaskLocation.create("foo", 1, 2);
+    Assert.assertNull(noK8sJobName.getK8sPodName());
+
+    TaskLocation k8sJobName = TaskLocation.create("foo", 1, 2, false, 
"job-name");
+    Assert.assertEquals("job-name", k8sJobName.getK8sPodName());

Review Comment:
   nit: it would be better to split this test into 2



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to