github-code-scanning[bot] commented on code in PR #14156:
URL: https://github.com/apache/druid/pull/14156#discussion_r1176032643
##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerFactory.java:
##########
@@ -126,15 +124,15 @@
TYPE_NAME
));
- if (adapter != null && !MultiContainerTaskAdapter.TYPE.equals(adapter) &&
kubernetesTaskRunnerConfig.sidecarSupport) {
+ if (adapter != null && !MultiContainerTaskAdapter.TYPE.equals(adapter) &&
kubernetesTaskRunnerConfig.isSidecarSupport()) {
Review Comment:
## Deprecated method or constructor invocation
Invoking [KubernetesTaskRunnerConfig.isSidecarSupport](1) should be avoided
because it has been deprecated.
[Show more
details](https://github.com/apache/druid/security/code-scanning/4887)
##########
extensions-contrib/kubernetes-overlord-extensions/src/test/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerConfigTest.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.joda.time.Period;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class KubernetesTaskRunnerConfigTest
+{
+ @Test
+ public void test_builder_preservesDefaults()
+ {
+ KubernetesTaskRunnerConfig config = KubernetesTaskRunnerConfig.builder()
+ .withNamespace("namespace")
+ .withDisableClientProxy(true)
+ .build();
+
+ Assert.assertEquals("namespace", config.getNamespace());
+ Assert.assertFalse(config.isDebugJobs());
+ Assert.assertFalse(config.isSidecarSupport());
Review Comment:
## Deprecated method or constructor invocation
Invoking [KubernetesTaskRunnerConfig.isSidecarSupport](1) should be avoided
because it has been deprecated.
[Show more
details](https://github.com/apache/druid/security/code-scanning/4889)
##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerFactory.java:
##########
@@ -126,15 +124,15 @@
TYPE_NAME
));
- if (adapter != null && !MultiContainerTaskAdapter.TYPE.equals(adapter) &&
kubernetesTaskRunnerConfig.sidecarSupport) {
+ if (adapter != null && !MultiContainerTaskAdapter.TYPE.equals(adapter) &&
kubernetesTaskRunnerConfig.isSidecarSupport()) {
throw new IAE(
"Invalid pod adapter [%s], only pod adapter [%s] can be specified
when sidecarSupport is enabled",
adapter,
MultiContainerTaskAdapter.TYPE
);
}
- if (MultiContainerTaskAdapter.TYPE.equals(adapter) ||
kubernetesTaskRunnerConfig.sidecarSupport) {
+ if (MultiContainerTaskAdapter.TYPE.equals(adapter) ||
kubernetesTaskRunnerConfig.isSidecarSupport()) {
Review Comment:
## Deprecated method or constructor invocation
Invoking [KubernetesTaskRunnerConfig.isSidecarSupport](1) should be avoided
because it has been deprecated.
[Show more
details](https://github.com/apache/druid/security/code-scanning/4888)
##########
extensions-contrib/kubernetes-overlord-extensions/src/test/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerConfigTest.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.joda.time.Period;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class KubernetesTaskRunnerConfigTest
+{
+ @Test
+ public void test_builder_preservesDefaults()
+ {
+ KubernetesTaskRunnerConfig config = KubernetesTaskRunnerConfig.builder()
+ .withNamespace("namespace")
+ .withDisableClientProxy(true)
+ .build();
+
+ Assert.assertEquals("namespace", config.getNamespace());
+ Assert.assertFalse(config.isDebugJobs());
+ Assert.assertFalse(config.isSidecarSupport());
+ Assert.assertNull(config.getPrimaryContainerName());
+ Assert.assertEquals("karlkfi/kubexit:v0.3.2", config.getKubexitImage());
+ Assert.assertNull(config.getGraceTerminationPeriodSeconds());
+ Assert.assertTrue(config.isDisableClientProxy());
+ Assert.assertEquals(new Period("PT4H"), config.getTaskTimeout());
+ Assert.assertEquals(new Period("P2D"), config.getTaskCleanupDelay());
+ Assert.assertEquals(new Period("PT10m"), config.getTaskCleanupInterval());
+ Assert.assertEquals(new Period("PT1H"), config.getTaskLaunchTimeout());
+ Assert.assertEquals(ImmutableList.of(), config.getPeonMonitors());
+ Assert.assertEquals(ImmutableList.of(), config.getJavaOptsArray());
+ Assert.assertEquals(ImmutableMap.of(), config.getLabels());
+ Assert.assertEquals(ImmutableMap.of(), config.getAnnotations());
+ Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE),
config.getCapacity());
+ }
+
+ @Test
+ public void test_builder()
+ {
+ KubernetesTaskRunnerConfig config = KubernetesTaskRunnerConfig.builder()
+ .withNamespace("namespace")
+ .withDebugJob(true)
+ .withSidecarSupport(true)
+ .withPrimaryContainerName("primary")
+ .withKubexitImage("image")
+ .withGraceTerminationPeriodSeconds(0L)
+ .withDisableClientProxy(true)
+ .withTaskTimeout(new Period("PT2H"))
+ .withTaskCleanupDelay(new Period("P1D"))
+ .withTaskCleanupInterval(new Period("PT1H"))
+ .withK8sJobLaunchTimeout(new Period("PT1H"))
+ .withPeonMonitors(ImmutableList.of("monitor"))
+ .withJavaOptsArray(ImmutableList.of("option"))
+ .withLabels(ImmutableMap.of("key", "value"))
+ .withAnnotations(ImmutableMap.of("key", "value"))
+ .withCapacity(1)
+ .build();
+
+ Assert.assertEquals("namespace", config.getNamespace());
+ Assert.assertTrue(config.isDebugJobs());
+ Assert.assertTrue(config.isSidecarSupport());
Review Comment:
## Deprecated method or constructor invocation
Invoking [KubernetesTaskRunnerConfig.isSidecarSupport](1) should be avoided
because it has been deprecated.
[Show more
details](https://github.com/apache/druid/security/code-scanning/4890)
--
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]