Remap initContainers as well as containers in PodSpec

This commit is contained in:
Corey O'Brien 2018-07-10 22:03:49 -04:00
parent 617ce047e6
commit 12fccd29f9
1 changed files with 4 additions and 2 deletions

View File

@ -47,8 +47,10 @@ func (m *imageRemapVisitor) VisitString(path []string, v string, mutator func(st
return nil return nil
} }
// Deployments look like spec.template.spec.containers.[2].image // Deployments/DaemonSets/Jobs/StatefulSets have two imapge fields
if n < 3 || path[n-3] != "containers" { // - spec.template.spec.containers.[2].image
// - spec.template.spec.initContainers.[2].image
if n < 3 || (path[n-3] != "containers" && path[n-3] != "initContainers") {
glog.Warningf("Skipping likely image field: %s", strings.Join(path, ".")) glog.Warningf("Skipping likely image field: %s", strings.Join(path, "."))
return nil return nil
} }