Grypse commented on code in PR #20516:
URL: https://github.com/apache/flink/pull/20516#discussion_r943256165
##########
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/utils/KubernetesUtils.java:
##########
@@ -419,12 +420,18 @@ public static FlinkPod loadPodFromTemplateFile(
final List<Container> otherContainers = new ArrayList<>();
Container mainContainer = null;
- for (Container container :
pod.getInternalResource().getSpec().getContainers()) {
- if (mainContainerName.equals(container.getName())) {
- mainContainer = container;
- } else {
- otherContainers.add(container);
+ if (null != pod.getInternalResource().getSpec()) {
+ for (Container container :
pod.getInternalResource().getSpec().getContainers()) {
+ if (mainContainerName.equals(container.getName())) {
+ mainContainer = container;
+ } else {
+ otherContainers.add(container);
+ }
}
+ pod.getInternalResource().getSpec().setContainers(otherContainers);
+ } else {
+ // Set empty spec for taskmanager pod template
Review Comment:
Right, it's also called by jobmanager pod template, but when no spec field
on template, otherContainers is empty, and the PodSpec containers initial value
is an empty `new ArrayList<Containers>` ,So there is no need to set an empty
otherContainers to pod Spec.
PodSpec containers property:
```
@JsonProperty("containers")
private List<Container> containers = new ArrayList();
```
--
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]