From 9107cb0aa2fa44530e316f002838bd371369368a Mon Sep 17 00:00:00 2001 From: Sam Stoelinga Date: Fri, 22 Jul 2022 06:47:44 -0700 Subject: [PATCH] Check InitContainers and EphemeralContainers too --- pspmutating.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pspmutating.go b/pspmutating.go index 7b43034..65e81b2 100644 --- a/pspmutating.go +++ b/pspmutating.go @@ -33,6 +33,12 @@ func GetContainerSecurityContexts(podSpec v1.PodSpec) []*v1.SecurityContext { for _, c := range podSpec.Containers { scs = append(scs, c.SecurityContext) } + for _, c := range podSpec.InitContainers { + scs = append(scs, c.SecurityContext) + } + for _, c := range podSpec.EphemeralContainers { + scs = append(scs, c.SecurityContext) + } return scs }