Skip to content

Commit

Permalink
Export the const defaultContainerName
Browse files Browse the repository at this point in the history
  • Loading branch information
viveksinghggits committed Sep 8, 2023
1 parent d3da99f commit fcb9fc6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pkg/kube/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/kube/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -893,7 +893,7 @@ func (s *PodControllerTestSuite) TestContainerNameFromPodOptsOrDefault(c *C) {
},
{
podOptsContainerName: "",
expectedContainerName: defaultContainerName,
expectedContainerName: DefaultContainerName,
},
} {
name := ContainerNameFromPodOptsOrDefault(&PodOptions{
Expand All @@ -903,5 +903,5 @@ func (s *PodControllerTestSuite) TestContainerNameFromPodOptsOrDefault(c *C) {
}

name := ContainerNameFromPodOptsOrDefault(&PodOptions{})
c.Assert(name, Equals, defaultContainerName)
c.Assert(name, Equals, DefaultContainerName)
}

0 comments on commit fcb9fc6

Please sign in to comment.