Check InitContainers and EphemeralContainers too

This commit is contained in:
Sam Stoelinga 2022-07-22 06:47:44 -07:00
parent 66c65322a6
commit 9107cb0aa2

View File

@ -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
}