Container can be null

In case of deployment with "same-pod" label, the container can be not
found in the deployment.
This commit is contained in:
2024-04-19 11:27:48 +02:00
parent 57b274e345
commit 77e8be4e63

View File

@@ -389,6 +389,9 @@ func buildVolumes(service types.ServiceConfig, chart *HelmChart, deployments map
// add the bound configMaps files to the deployment containers // add the bound configMaps files to the deployment containers
for _, d := range deployments { for _, d := range deployments {
container, index := utils.GetContainerByName(service.Name, d.Spec.Template.Spec.Containers) container, index := utils.GetContainerByName(service.Name, d.Spec.Template.Spec.Containers)
if container == nil { // may append for the same-pod services
break
}
for volumeName, config := range d.configMaps { for volumeName, config := range d.configMaps {
var y []byte var y []byte
var err error var err error