From 12fccd29f9e66996b51bf630fa1c91f5eb894ed2 Mon Sep 17 00:00:00 2001 From: Corey O'Brien Date: Tue, 10 Jul 2018 22:03:49 -0400 Subject: [PATCH] Remap initContainers as well as containers in PodSpec --- pkg/kubemanifest/images.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/kubemanifest/images.go b/pkg/kubemanifest/images.go index 281e33db03..ed1fbef5e2 100644 --- a/pkg/kubemanifest/images.go +++ b/pkg/kubemanifest/images.go @@ -47,8 +47,10 @@ func (m *imageRemapVisitor) VisitString(path []string, v string, mutator func(st return nil } - // Deployments look like spec.template.spec.containers.[2].image - if n < 3 || path[n-3] != "containers" { + // Deployments/DaemonSets/Jobs/StatefulSets have two imapge fields + // - 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, ".")) return nil }