abhishekagarwal87 commented on code in PR #13804:
URL: https://github.com/apache/druid/pull/13804#discussion_r1113850734
##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/common/DruidKubernetesPeonClient.java:
##########
@@ -121,12 +121,12 @@ public JobResponse waitForJobCompletion(K8sTaskId taskId,
long howLong, TimeUnit
public boolean cleanUpJob(K8sTaskId taskId)
{
if (!debugJobs) {
- Boolean result = clientApi.executeRequest(client -> client.batch()
- .v1()
- .jobs()
-
.inNamespace(namespace)
-
.withName(taskId.getK8sTaskId())
- .delete());
+ Boolean result = clientApi.executeRequest(client -> !client.batch()
+ .v1()
+ .jobs()
+
.inNamespace(namespace)
+
.withName(taskId.getK8sTaskId())
+
.delete().isEmpty());
Review Comment:
what does `delete` return here?
##########
extensions-contrib/kubernetes-overlord-extensions/src/test/java/org/apache/druid/k8s/overlord/common/DruidPeonClientIntegrationTest.java:
##########
@@ -54,6 +54,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
// must have a kind / minikube cluster installed and the image pushed to your
repository
+@Disabled
Review Comment:
We are using K3S now. do you still same issues?
##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/common/DruidKubernetesPeonClient.java:
##########
@@ -106,13 +104,15 @@ public JobResponse waitForJobCompletion(K8sTaskId taskId,
long howLong, TimeUnit
.inNamespace(namespace)
.withName(taskId.getK8sTaskId())
.waitUntilCondition(
- x -> x != null && x.getStatus() != null &&
x.getStatus().getActive() == null,
+ x -> x != null && x.getStatus() != null &&
x.getStatus().getActive() == null
+ && (x.getStatus().getFailed() != null ||
x.getStatus().getSucceeded() !=null),
Review Comment:
So for the older k8s version, we can expect that when job.getActive() is
null, one of `success` or `failure` field must be set. Question - do we need to
check for getActive() result at all? can we just block till the job either
succeeded or failed?
##########
extensions-contrib/kubernetes-overlord-extensions/src/test/java/org/apache/druid/k8s/overlord/common/DruidKubernetesClientTest.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.druid.k8s.overlord.common;
+
+import io.fabric8.kubernetes.client.Client;
+import io.fabric8.kubernetes.client.Config;
+import io.fabric8.kubernetes.client.KubernetesClient;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.when;
+
+class DruidKubernetesClientTest
+{
+
+ @Test
+ void makingCodeCoverageHappy()
Review Comment:
Hmm. This is a bit of a bummer. Is there no way to avoid this?
##########
extensions-contrib/kubernetes-overlord-extensions/src/test/java/org/apache/druid/k8s/overlord/common/K8sTaskAdapterTest.java:
##########
@@ -205,4 +207,51 @@ void testNoPrimaryFound()
});
}
+ @Test
+ void testAddingMonitors() throws IOException
+ {
+ TestKubernetesClient testClient = new TestKubernetesClient(client);
+ PeonCommandContext context = new PeonCommandContext(
+ new ArrayList<>(),
+ new ArrayList<>(),
+ new File("/tmp/")
+ );
+ KubernetesTaskRunnerConfig config = new KubernetesTaskRunnerConfig();
+ config.namespace = "test";
+ K8sTaskAdapter adapter = new SingleContainerTaskAdapter(testClient,
config, jsonMapper);
+ Task task = K8sTestUtils.getTask();
+ // no monitor in overlord, no monitor override
+ Container container = new ContainerBuilder()
+ .withName("container").build();
+ adapter.addEnvironmentVariables(container, context, task.toString());
+ assertFalse(container.getEnv().stream().anyMatch(x ->
x.getName().equals("druid_monitoring_monitors")));
Review Comment:
Please print the container.getEnv if the assertion fails.
--
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]