churromorales commented on code in PR #13655:
URL: https://github.com/apache/druid/pull/13655#discussion_r1084506665
##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/common/K8sTaskAdapter.java:
##########
@@ -275,4 +280,28 @@ protected PodTemplateSpec createTemplateFromSpec(
return podTemplate;
}
+ @VisibleForTesting
+ static void massageSpec(PodSpec spec, String primaryContainerName)
+ {
+ // find the primary container and make it first,
+ if (StringUtils.isNotBlank(primaryContainerName)) {
+ int i = 0;
+ while (i < spec.getContainers().size()) {
+ if
(primaryContainerName.equals(spec.getContainers().get(i).getName())) {
+ break;
+ }
+ i++;
+ }
+ // if the primaryContainer is not found, assume the primary container is
the first container.
+ if (i >= spec.getContainers().size()) {
+ throw new IllegalArgumentException("Could not find container named: "
Review Comment:
you can log here, but the next line of execution will throw a
NoSuchElementException because you are trying to access an element not in the
array list. I figured it might be better to just throw here with a reason.
Either way, I am okay with whatever you want. Let me know if you feel strongly
about this and I can change it.
--
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]