github-advanced-security[bot] commented on code in PR #18591: URL: https://github.com/apache/druid/pull/18591#discussion_r2394090355
########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10466) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerEffectiveConfig.java: ########## @@ -0,0 +1,185 @@ +/* + * 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.base.Supplier; +import org.apache.druid.k8s.overlord.execution.KubernetesTaskRunnerDynamicConfig; +import org.apache.druid.k8s.overlord.execution.PodTemplateSelectStrategy; +import org.joda.time.Period; + +import java.util.List; +import java.util.Map; + +/** + * Effective config object that combines static {@link KubernetesTaskRunnerConfig} + * with dynamic overrides from {@link KubernetesTaskRunnerDynamicConfig}. + */ +public class KubernetesTaskRunnerEffectiveConfig implements KubernetesTaskRunnerConfig +{ + private final KubernetesTaskRunnerStaticConfig staticConfig; + private final Supplier<KubernetesTaskRunnerDynamicConfig> dynamicConfigSupplier; + + public KubernetesTaskRunnerEffectiveConfig( + KubernetesTaskRunnerStaticConfig staticConfig, + Supplier<KubernetesTaskRunnerDynamicConfig> dynamicConfigSupplier + ) + { + this.staticConfig = staticConfig; + this.dynamicConfigSupplier = dynamicConfigSupplier; + } + + @Override + public String getNamespace() + { + return staticConfig.getNamespace(); + } + + @Override + public String getOverlordNamespace() + { + return staticConfig.getOverlordNamespace(); + } + + @Override + public String getK8sTaskPodNamePrefix() + { + return staticConfig.getK8sTaskPodNamePrefix(); + } + + @Override + public boolean isDebugJobs() + { + return staticConfig.isDebugJobs(); + } + + @Override + public boolean isSidecarSupport() + { + return staticConfig.isSidecarSupport(); Review Comment: ## Deprecated method or constructor invocation Invoking [KubernetesTaskRunnerStaticConfig.isSidecarSupport](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10464) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10468) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10469) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); + this.k8sjobLaunchTimeout = ObjectUtils.defaultIfNull( + k8sjobLaunchTimeout, + this.k8sjobLaunchTimeout + ); + this.taskJoinTimeout = ObjectUtils.defaultIfNull( + taskJoinTimeout, + this.taskJoinTimeout + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10475) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); + this.k8sjobLaunchTimeout = ObjectUtils.defaultIfNull( + k8sjobLaunchTimeout, + this.k8sjobLaunchTimeout + ); + this.taskJoinTimeout = ObjectUtils.defaultIfNull( + taskJoinTimeout, + this.taskJoinTimeout + ); + this.logSaveTimeout = ObjectUtils.defaultIfNull( + logSaveTimeout, + this.logSaveTimeout + ); + this.peonMonitors = ObjectUtils.defaultIfNull( + peonMonitors, + this.peonMonitors + ); + this.javaOptsArray = ObjectUtils.defaultIfNull( + javaOptsArray, + this.javaOptsArray + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10478) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); + this.k8sjobLaunchTimeout = ObjectUtils.defaultIfNull( + k8sjobLaunchTimeout, + this.k8sjobLaunchTimeout + ); + this.taskJoinTimeout = ObjectUtils.defaultIfNull( + taskJoinTimeout, + this.taskJoinTimeout + ); + this.logSaveTimeout = ObjectUtils.defaultIfNull( + logSaveTimeout, + this.logSaveTimeout + ); + this.peonMonitors = ObjectUtils.defaultIfNull( + peonMonitors, + this.peonMonitors + ); + this.javaOptsArray = ObjectUtils.defaultIfNull( + javaOptsArray, + this.javaOptsArray + ); + this.cpuCoreInMicro = ObjectUtils.defaultIfNull( + cpuCoreInMicro, + this.cpuCoreInMicro + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10479) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); + this.k8sjobLaunchTimeout = ObjectUtils.defaultIfNull( + k8sjobLaunchTimeout, + this.k8sjobLaunchTimeout + ); + this.taskJoinTimeout = ObjectUtils.defaultIfNull( + taskJoinTimeout, + this.taskJoinTimeout + ); + this.logSaveTimeout = ObjectUtils.defaultIfNull( + logSaveTimeout, + this.logSaveTimeout + ); + this.peonMonitors = ObjectUtils.defaultIfNull( + peonMonitors, + this.peonMonitors + ); + this.javaOptsArray = ObjectUtils.defaultIfNull( + javaOptsArray, + this.javaOptsArray + ); + this.cpuCoreInMicro = ObjectUtils.defaultIfNull( + cpuCoreInMicro, + this.cpuCoreInMicro + ); + this.labels = ObjectUtils.defaultIfNull( + labels, + this.labels + ); + this.annotations = ObjectUtils.defaultIfNull( + annotations, + this.annotations + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10481) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10467) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10470) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); + this.k8sjobLaunchTimeout = ObjectUtils.defaultIfNull( + k8sjobLaunchTimeout, + this.k8sjobLaunchTimeout + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10474) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); + this.k8sjobLaunchTimeout = ObjectUtils.defaultIfNull( + k8sjobLaunchTimeout, + this.k8sjobLaunchTimeout + ); + this.taskJoinTimeout = ObjectUtils.defaultIfNull( + taskJoinTimeout, + this.taskJoinTimeout + ); + this.logSaveTimeout = ObjectUtils.defaultIfNull( + logSaveTimeout, + this.logSaveTimeout + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10476) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10465) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10471) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10472) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10473) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); + this.k8sjobLaunchTimeout = ObjectUtils.defaultIfNull( + k8sjobLaunchTimeout, + this.k8sjobLaunchTimeout + ); + this.taskJoinTimeout = ObjectUtils.defaultIfNull( + taskJoinTimeout, + this.taskJoinTimeout + ); + this.logSaveTimeout = ObjectUtils.defaultIfNull( + logSaveTimeout, + this.logSaveTimeout + ); + this.peonMonitors = ObjectUtils.defaultIfNull( + peonMonitors, + this.peonMonitors + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10477) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); + this.k8sjobLaunchTimeout = ObjectUtils.defaultIfNull( + k8sjobLaunchTimeout, + this.k8sjobLaunchTimeout + ); + this.taskJoinTimeout = ObjectUtils.defaultIfNull( + taskJoinTimeout, + this.taskJoinTimeout + ); + this.logSaveTimeout = ObjectUtils.defaultIfNull( + logSaveTimeout, + this.logSaveTimeout + ); + this.peonMonitors = ObjectUtils.defaultIfNull( + peonMonitors, + this.peonMonitors + ); + this.javaOptsArray = ObjectUtils.defaultIfNull( + javaOptsArray, + this.javaOptsArray + ); + this.cpuCoreInMicro = ObjectUtils.defaultIfNull( + cpuCoreInMicro, + this.cpuCoreInMicro + ); + this.labels = ObjectUtils.defaultIfNull( + labels, + this.labels + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10480) ########## extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunnerStaticConfig.java: ########## @@ -0,0 +1,562 @@ +/* + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.apache.commons.lang3.ObjectUtils; +import org.joda.time.Period; + +import javax.annotation.Nonnull; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class KubernetesTaskRunnerStaticConfig implements KubernetesTaskRunnerConfig +{ + @JsonProperty + @NotNull + private String namespace; + + @JsonProperty + private String k8sTaskPodNamePrefix = ""; + + // This property is the namespace that the Overlord is running in. + // For cases where we want task pods to run on different namespace from the overlord, we need to specify the namespace of the overlord here. + // Else, we can simply leave this field alone. + @JsonProperty + private String overlordNamespace = ""; + + @JsonProperty + private boolean debugJobs = false; + + /** + * Deprecated, please specify adapter type runtime property instead + * <p> + * I.E `druid.indexer.runner.k8s.adapter.type: overlordMultiContainer` + */ + @Deprecated + @JsonProperty + private boolean sidecarSupport = false; + + @JsonProperty + // if this is not set, then the first container in your pod spec is assumed to be the overlord container. + // usually this is fine, but when you are dynamically adding sidecars like istio, the service mesh could + // in fact place the istio-proxy container as the first container. Thus, you would specify this value to + // the name of your primary container. e.g. druid-overlord + private String primaryContainerName = null; + + @JsonProperty + // for multi-container jobs, we need this image to shut down sidecars after the main container + // has completed + private String kubexitImage = "karlkfi/kubexit:v0.3.2"; + + // how much time to wait for preStop hooks to execute + // lower number speeds up pod termination time to release locks + // faster, defaults to your k8s setup, usually 30 seconds. + private Long graceTerminationPeriodSeconds = null; + + @JsonProperty + // disable using http / https proxy environment variables + private boolean disableClientProxy; + + @JsonProperty + @NotNull + private Period maxTaskDuration = new Period("PT4H"); + + @JsonProperty + @NotNull + // how long to wait for the jobs to be cleaned up. + private Period taskCleanupDelay = new Period("P2D"); + + @JsonProperty + @NotNull + // interval for k8s job cleanup to run + private Period taskCleanupInterval = new Period("PT10m"); + + @JsonProperty + @NotNull + // how long to wait to join peon k8s jobs on startup + private Period taskJoinTimeout = new Period("PT1M"); + + + @JsonProperty + @NotNull + // how long to wait for the peon k8s job to launch + private Period k8sjobLaunchTimeout = new Period("PT1H"); + + @JsonProperty + @NotNull + // how long to wait for log saving operations to complete + private Period logSaveTimeout = new Period("PT300S"); + + @JsonProperty + // ForkingTaskRunner inherits the monitors from the MM, in k8s mode + // the peon inherits the monitors from the overlord, so if someone specifies + // a TaskCountStatsMonitor in the overlord for example, the peon process + // fails because it can not inject this monitor in the peon process. + private List<String> peonMonitors = ImmutableList.of(); + + @JsonProperty + @NotNull + private List<String> javaOptsArray = ImmutableList.of(); + + @JsonProperty + @NotNull + private int cpuCoreInMicro = 0; + + @JsonProperty + @NotNull + private Map<String, String> labels = ImmutableMap.of(); + + @JsonProperty + @NotNull + private Map<String, String> annotations = ImmutableMap.of(); + + @JsonProperty + @Min(1) + @Max(Integer.MAX_VALUE) + @NotNull + private Integer capacity = Integer.MAX_VALUE; + + public KubernetesTaskRunnerStaticConfig() + { + } + + private KubernetesTaskRunnerStaticConfig( + @Nonnull String namespace, + String overlordNamespace, + String k8sTaskPodNamePrefix, + boolean debugJobs, + boolean sidecarSupport, + String primaryContainerName, + String kubexitImage, + Long graceTerminationPeriodSeconds, + boolean disableClientProxy, + Period maxTaskDuration, + Period taskCleanupDelay, + Period taskCleanupInterval, + Period k8sjobLaunchTimeout, + Period logSaveTimeout, + List<String> peonMonitors, + List<String> javaOptsArray, + int cpuCoreInMicro, + Map<String, String> labels, + Map<String, String> annotations, + Integer capacity, + Period taskJoinTimeout + ) + { + this.namespace = namespace; + this.overlordNamespace = ObjectUtils.defaultIfNull( + overlordNamespace, + this.overlordNamespace + ); + this.k8sTaskPodNamePrefix = k8sTaskPodNamePrefix; + this.debugJobs = ObjectUtils.defaultIfNull( + debugJobs, + this.debugJobs + ); + this.sidecarSupport = ObjectUtils.defaultIfNull( + sidecarSupport, + this.sidecarSupport + ); + this.primaryContainerName = ObjectUtils.defaultIfNull( + primaryContainerName, + this.primaryContainerName + ); + this.kubexitImage = ObjectUtils.defaultIfNull( + kubexitImage, + this.kubexitImage + ); + this.graceTerminationPeriodSeconds = ObjectUtils.defaultIfNull( + graceTerminationPeriodSeconds, + this.graceTerminationPeriodSeconds + ); + this.disableClientProxy = disableClientProxy; + this.maxTaskDuration = ObjectUtils.defaultIfNull( + maxTaskDuration, + this.maxTaskDuration + ); + this.taskCleanupDelay = ObjectUtils.defaultIfNull( + taskCleanupDelay, + this.taskCleanupDelay + ); + this.taskCleanupInterval = ObjectUtils.defaultIfNull( + taskCleanupInterval, + this.taskCleanupInterval + ); + this.k8sjobLaunchTimeout = ObjectUtils.defaultIfNull( + k8sjobLaunchTimeout, + this.k8sjobLaunchTimeout + ); + this.taskJoinTimeout = ObjectUtils.defaultIfNull( + taskJoinTimeout, + this.taskJoinTimeout + ); + this.logSaveTimeout = ObjectUtils.defaultIfNull( + logSaveTimeout, + this.logSaveTimeout + ); + this.peonMonitors = ObjectUtils.defaultIfNull( + peonMonitors, + this.peonMonitors + ); + this.javaOptsArray = ObjectUtils.defaultIfNull( + javaOptsArray, + this.javaOptsArray + ); + this.cpuCoreInMicro = ObjectUtils.defaultIfNull( + cpuCoreInMicro, + this.cpuCoreInMicro + ); + this.labels = ObjectUtils.defaultIfNull( + labels, + this.labels + ); + this.annotations = ObjectUtils.defaultIfNull( + annotations, + this.annotations + ); + this.capacity = ObjectUtils.defaultIfNull( + capacity, + this.capacity + ); Review Comment: ## Deprecated method or constructor invocation Invoking [ObjectUtils.defaultIfNull](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/druid/security/code-scanning/10482) -- 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]
