From 54ddcdce21cc557bf12a28b0cc4821c7962b2eaf Mon Sep 17 00:00:00 2001 From: Dipankar Das <65275144+dipankardas011@users.noreply.github.com> Date: Mon, 26 Sep 2022 21:50:08 +0530 Subject: [PATCH] Code Refactoring of Pod under pkg/api (#112085) * Code Refactoring - added some function comments - spelling errors Signed-off-by: Dipankar Das * Some typo fix in resource under pkg/api/v1 Signed-off-by: Dipankar Das * Grammer corrections in api/v1/pod Signed-off-by: Dipankar Das * Function description changes in pkg/api/v1 - pod - resource Signed-off-by: Dipankar Das Signed-off-by: Dipankar Das --- pkg/api/v1/pod/util.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/api/v1/pod/util.go b/pkg/api/v1/pod/util.go index 8cefc94641e..dc526b62eb2 100644 --- a/pkg/api/v1/pod/util.go +++ b/pkg/api/v1/pod/util.go @@ -61,7 +61,7 @@ const ( ) // AllContainers specifies that all containers be visited -const AllContainers ContainerType = (InitContainers | Containers | EphemeralContainers) +const AllContainers ContainerType = InitContainers | Containers | EphemeralContainers // AllFeatureEnabledContainers returns a ContainerType mask which includes all container // types except for the ones guarded by feature gate. @@ -188,6 +188,7 @@ func VisitPodSecretNames(pod *v1.Pod, visitor Visitor) bool { return true } +// visitContainerSecretNames returns true unless the visitor returned false when invoked with a secret reference func visitContainerSecretNames(container *v1.Container, visitor Visitor) bool { for _, env := range container.EnvFrom { if env.SecretRef != nil { @@ -236,6 +237,7 @@ func VisitPodConfigmapNames(pod *v1.Pod, visitor Visitor) bool { return true } +// visitContainerConfigmapNames returns true unless the visitor returned false when invoked with a configmap reference func visitContainerConfigmapNames(container *v1.Container, visitor Visitor) bool { for _, env := range container.EnvFrom { if env.ConfigMapRef != nil { @@ -300,7 +302,7 @@ func IsPodTerminal(pod *v1.Pod) bool { return IsPodPhaseTerminal(pod.Status.Phase) } -// IsPhaseTerminal returns true if the pod's phase is terminal. +// IsPodPhaseTerminal returns true if the pod's phase is terminal. func IsPodPhaseTerminal(phase v1.PodPhase) bool { return phase == v1.PodFailed || phase == v1.PodSucceeded }