mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 01:23:48 +00:00
sync api/v1/pod/util with api/pod/util and remove DefaultContainers
This commit is contained in:
@@ -283,7 +283,7 @@ func FormatPod(pod *Pod) string {
|
||||
// GetContainerSpec gets the container spec by containerName.
|
||||
func GetContainerSpec(pod *v1.Pod, containerName string) *v1.Container {
|
||||
var containerSpec *v1.Container
|
||||
podutil.VisitContainers(&pod.Spec, func(c *v1.Container) bool {
|
||||
podutil.VisitContainers(&pod.Spec, podutil.AllFeatureEnabledContainers(), func(c *v1.Container, containerType podutil.ContainerType) bool {
|
||||
if containerName == c.Name {
|
||||
containerSpec = c
|
||||
return false
|
||||
@@ -296,7 +296,7 @@ func GetContainerSpec(pod *v1.Pod, containerName string) *v1.Container {
|
||||
// HasPrivilegedContainer returns true if any of the containers in the pod are privileged.
|
||||
func HasPrivilegedContainer(pod *v1.Pod) bool {
|
||||
var hasPrivileged bool
|
||||
podutil.VisitContainers(&pod.Spec, func(c *v1.Container) bool {
|
||||
podutil.VisitContainers(&pod.Spec, podutil.AllFeatureEnabledContainers(), func(c *v1.Container, containerType podutil.ContainerType) bool {
|
||||
if c.SecurityContext != nil && c.SecurityContext.Privileged != nil && *c.SecurityContext.Privileged {
|
||||
hasPrivileged = true
|
||||
return false
|
||||
|
Reference in New Issue
Block a user