diff --git a/pkg/kube/pod.go b/pkg/kube/pod.go index e19c8cc0560..92967c7236f 100644 --- a/pkg/kube/pod.go +++ b/pkg/kube/pod.go @@ -45,7 +45,7 @@ const ( // PodReadyWaitTimeoutEnv is the env var to get pod ready wait timeout PodReadyWaitTimeoutEnv = "KANISTER_POD_READY_WAIT_TIMEOUT" errAccessingNode = "Failed to get node" - defaultContainerName = "container" + DefaultContainerName = "container" ) // PodOptions specifies options for `CreatePod` @@ -113,7 +113,7 @@ func GetPodObjectFromPodOptions(cli kubernetes.Interface, opts *PodOptions) (*v1 defaultSpecs := v1.PodSpec{ Containers: []v1.Container{ { - Name: defaultContainerName, + Name: DefaultContainerName, Image: opts.Image, Command: opts.Command, ImagePullPolicy: v1.PullPolicy(v1.PullIfNotPresent), @@ -143,7 +143,7 @@ func GetPodObjectFromPodOptions(cli kubernetes.Interface, opts *PodOptions) (*v1 // Always put the main container the first sort.Slice(patchedSpecs.Containers, func(i, j int) bool { - return patchedSpecs.Containers[i].Name == defaultContainerName + return patchedSpecs.Containers[i].Name == DefaultContainerName }) pod := &v1.Pod{ @@ -207,7 +207,7 @@ func ContainerNameFromPodOptsOrDefault(po *PodOptions) string { return po.ContainerName } - return defaultContainerName + return DefaultContainerName } // CreatePod creates a pod with a single container based on the specified image diff --git a/pkg/kube/pod_test.go b/pkg/kube/pod_test.go index 69a16d0de38..6fb99117d02 100644 --- a/pkg/kube/pod_test.go +++ b/pkg/kube/pod_test.go @@ -239,7 +239,7 @@ func (s *PodSuite) TestPod(c *C) { case po.ContainerName != "": c.Assert(pod.Spec.Containers[0].Name, Equals, po.ContainerName) default: - c.Assert(pod.Spec.Containers[0].Name, Equals, defaultContainerName) + c.Assert(pod.Spec.Containers[0].Name, Equals, DefaultContainerName) } switch { @@ -893,7 +893,7 @@ func (s *PodControllerTestSuite) TestContainerNameFromPodOptsOrDefault(c *C) { }, { podOptsContainerName: "", - expectedContainerName: defaultContainerName, + expectedContainerName: DefaultContainerName, }, } { name := ContainerNameFromPodOptsOrDefault(&PodOptions{ @@ -903,5 +903,5 @@ func (s *PodControllerTestSuite) TestContainerNameFromPodOptsOrDefault(c *C) { } name := ContainerNameFromPodOptsOrDefault(&PodOptions{}) - c.Assert(name, Equals, defaultContainerName) + c.Assert(name, Equals, DefaultContainerName) }