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

Unsafe kubernetes name generation #24

Open
ichbinfrog opened this issue Apr 13, 2021 · 0 comments
Open

Unsafe kubernetes name generation #24

ichbinfrog opened this issue Apr 13, 2021 · 0 comments

Comments

@ichbinfrog
Copy link

Kubernetes services must also follow the DNS-1035 naming convention (Cf. k8s issue and the appropriate rfc) so in order to safely generate kubernetes names (for both services, namespaces and other objects) the generated name should:

  • be lowercase
  • <= 253 characters
  • start with an alphabetic character
  • end with an alphanumeric character

So I don't think lowercasing is safe enough:

/**
* K8S names must be in lower case and can't contain _
*/
public static String generateKubeName(String candidate) {
return candidate.toLowerCase().replaceAll("_", "-");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant