Skip to content
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

kube generate must transform invalid names or throw fatal fault #16542

Closed
sanmai-NL opened this issue Nov 17, 2022 · 10 comments · Fixed by #24852
Closed

kube generate must transform invalid names or throw fatal fault #16542

sanmai-NL opened this issue Nov 17, 2022 · 10 comments · Fixed by #24852
Labels
kind/bug Categorizes issue or PR as related to a bug. kube macos MacOS (OSX) related

Comments

@sanmai-NL
Copy link
Contributor

sanmai-NL commented Nov 17, 2022

/kind bug

Description

podman kube generate takes e.g., volume names as is, but Kubernetes has naming rules that seem to differ from Docker Engine's.

Steps to reproduce the issue:

  1. Create a container using Kubernetes-invalid names for volumes.

  2. Run podman kube generate > manifest.yml.

  3. kubectl apply --filename=manifest.yml.

Describe the results you received:

The Pod "xenodochialmaxwell-pod" is invalid: 
* spec.volumes[0].name: Invalid value: "Users-myuser-devel-gitlab.com-bla-hui-lern-host-0": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')
* spec.volumes[1].name: Invalid value: "Users-myuser-.config-git-host-1": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')
* spec.volumes[2].name: Invalid value: "lern_vscodeserver-pvc": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')

Describe the results you expected:

Valid names and ability to apply the Kubernetes manifest.
This applies to volume names, indeed to any type name.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

  podman version
Client:       Podman Engine
Version:      4.3.1
API Version:  4.3.1
Go Version:   go1.18.8
Built:        Wed Nov  9 21:43:58 2022
OS/Arch:      darwin/amd64

Server:       Podman Engine
Version:      4.3.0
API Version:  4.3.0
Go Version:   go1.19.2
Built:        Fri Oct 21 10:09:51 2022
OS/Arch:      linux/amd64

Output of podman info:

Not applicable.

Package info (e.g. output of rpm -q podman or apt list podman or brew info podman):

Not applicable.

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes.

Additional environment details (AWS, VirtualBox, physical, etc.):
macOS. Container created is VS Code dev container.

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 17, 2022
@github-actions github-actions bot added the macos MacOS (OSX) related label Nov 17, 2022
@rhatdan
Copy link
Member

rhatdan commented Nov 18, 2022

Care to open a PR to fix this to make the generated volume names compatibile?

@rhatdan
Copy link
Member

rhatdan commented Nov 18, 2022

@umohnani8 PTAL

@rhatdan rhatdan added kube and removed macos MacOS (OSX) related labels Nov 18, 2022
@rhatdan
Copy link
Member

rhatdan commented Nov 18, 2022

Could you give us the podman run command you used to generate the container.

@sanmai-NL
Copy link
Contributor Author

Could you give us the podman run command you used to generate the container.

I'll try to, but the catch 22 is: I generated a running container as created by VS Code Dev Containers. So I didn't control the command line nor used a Compose file.

@sanmai-NL
Copy link
Contributor Author

sanmai-NL commented Nov 18, 2022

Care to open a PR to fix this to make the generated volume names compatibile?

It would be helpful if your team points out where in the source tree to look. Time spent on overhead makes it less attractive to contribute, for some reason. ;)

@rhatdan
Copy link
Member

rhatdan commented Nov 18, 2022

I would start here: pkg/specgen/generate/kube/kube.go

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 29, 2023

@sanmai-NL @umohnani8 Is this still an issue?

@bricecamus
Copy link

@rhatdan I can confirm its still an issue, I had to rename a folder in my project path (example: ~/Playground/project to ~/playground/project) to be able to use podman kube apply to my kind cluster.

@github-actions github-actions bot added the macos MacOS (OSX) related label Dec 16, 2024
rhatdan added a commit to rhatdan/podman that referenced this issue Dec 16, 2024
Fixes: containers#16542

Kubernetes only allows lower case persistent volume names.

Signed-off-by: Daniel J Walsh <[email protected]>
@sanmai-NL
Copy link
Contributor Author

@rhatdan Underscores aren't supported either so the issue can 't be closed yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kube macos MacOS (OSX) related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants