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

Enforce RFC 1123 on procfile process types #251

Open
joshwlewis opened this issue Dec 11, 2024 · 1 comment
Open

Enforce RFC 1123 on procfile process types #251

joshwlewis opened this issue Dec 11, 2024 · 1 comment

Comments

@joshwlewis
Copy link
Member

Kubernetes restricts some resource names to RFC 1123, requiring that names match rules for subdomains. This buildpack produces process types that may be inconsistent with this spec. Notable inconsistencies:

  • This buildpack supports capital letters (e.g. Web)
  • This buildpack supports underscores (e.g. my_worker)
  • This buildpack supports non-alphanumerics at the start or end of the string (e.g. worker2, 2nd-worker)

Process types like these may cause issues when running the build result in a k8s environment, resulting in errors like these:

a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

We could:

  • Coerce the entries to proper casing (downcasing)
  • Coerce the entries to use dashes (gsub _ -)
  • Write warning messages for non-compliant naming (e.g. "The fast_worker process has an underscore. This may cause problems in kubernetes environments. Consider changing this to fast-worker.")
  • Throw errors and fail the build for non-compliant naming
@schneems
Copy link
Contributor

Coerce the entries to proper casing (downcasing)

That seems fine. Issue a warning. Error on duplicate names i.e. Web and weB

Coerce the entries to use dashes (gsub _ -)

Also fine, and issue a warning.

Write warning messages for non-compliant naming (e.g. "The fast_worker process has an underscore. This may cause > problems in kubernetes environments. Consider changing this to fast-worker.")

👍🏻

Throw errors and fail the build for non-compliant naming

I think we try to infer intent when we can. When we can't then we error.

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

2 participants