Skip to content

Commit

Permalink
Modify the pod name suffix '_pod' to '-pod'
Browse files Browse the repository at this point in the history
Signed-off-by: aonoa <1991849113@qq.com>
  • Loading branch information
aonoa committed Apr 25, 2022
1 parent ba63562 commit 94d043b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions libpod/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,9 @@ func simplePodWithV1Containers(ctx context.Context, ctrs []*Container) (*v1.Pod,
}
podName := strings.ReplaceAll(ctrs[0].Name(), "_", "")
// Check if the pod name and container name will end up conflicting
// Append _pod if so
// Append -pod if so
if util.StringInSlice(podName, ctrNames) {
podName = podName + "_pod"
podName = podName + "-pod"
}

return newPodObject(
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/generate_kube_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var _ = Describe("Podman generate kube", func() {
Expect(pod.Spec.DNSConfig).To(BeNil())
Expect(pod.Spec.Containers[0].WorkingDir).To(Equal(""))
Expect(pod.Spec.Containers[0].Env).To(BeNil())
Expect(pod.Name).To(Equal("top_pod"))
Expect(pod.Name).To(Equal("top-pod"))

numContainers := 0
for range pod.Spec.Containers {
Expand Down

0 comments on commit 94d043b

Please sign in to comment.