-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Podman play kube adds _pod suffix if container is named like pod. #12722
Comments
This is expected. Podman maintains the invariant that all pod and container names must be globally unique. This is baked very deep into the code, and while I'd like to change it, it would be a major investment of time and I don't see us doing it for at least a year (and a potential Podman 5.0). |
Since the final container name of every container in a pod will be |
I think @mheon answered your question. But as he says, it is not likely to be fixed for a long time. |
The containers are not named |
Maybe we are talking about different names. I don't see any container named
|
Interesting. @baude Did we add renaming for containers at some point? |
I made a PR removing the renaming. In my research I found this code line, enforcing that the name of a container in a pod will never be equal to the pod name: https://github.com/containers/podman/blob/main/pkg/specgen/generate/kube/kube.go#L140 |
We enforce the naming scheme "<podname>-<containername>" here [1]. Therefore we must not rename the pod in case of a naming conflict between pod name and container name. Not renaming the pod increases the usability for the user and easies scripting based on the name. Otherwise a user must set some label to reliable find a pod after creation. Or have to implement the renaming logic in the script. [1] https://github.com/containers/podman/blob/main/pkg/specgen/generate/kube/kube.go#L140 Fixes containers#12722 Signed-off-by: Christoph Petrausch <[email protected]>
BUG REPORT
/kind bug
Description
I wanted to create a pod via
podman play kube
with the namenginx
and a single container also namednginx
. I got the warninga container exists with the same name ("nginx") as the pod in your YAML file; changing pod name to nginx_pod
and the resulting pod had the namenginx_pod
. I expected the pod to be namednginx
. If I name the podfancy
in the YAML, I get a pod namedfancy
.The created containers however are named
nginx_pod-nginx
andfancy-nginx
. There is no container namednginx
in my system.Steps to reproduce the issue:
pod.yaml
:podman play kube pod.yaml
Describe the results you received:
I get a pod named
nginx_pod
:Describe the results you expected:
I expect a pod named
nginx
and a container namednginx-nginx
.Like in this example:
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes
The text was updated successfully, but these errors were encountered: