Skip to content

Commit b8ecf24

Browse files
committed
Use DNS Label instead of host name
Signed-off-by: Josh W Lewis <josh.w.lewis@gmail.com>
1 parent 766fde5 commit b8ecf24

1 file changed

Lines changed: 25 additions & 17 deletions

File tree

text/0000-hostname-process-types.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Meta
22

3-
- Name: Hostname Compatible Process Types
3+
- Name: DNS Label Compatible Process Types
44
- Start Date: 2025-03-30
55
- Author(s): @joshwlewis
66
- Status: Draft <!-- Acceptable values: Draft, Approved, On Hold, Superseded -->
@@ -11,19 +11,19 @@
1111

1212
# Summary
1313

14-
Process types in the Cloud Native Buildpacks Buildpack specification are less restrictive than the RFC 1123 2.1 host name definition. Therefore, CNB process types may not be compatible with internet routing or kubernetes resource naming. This RFC proposes to restrict CNB process types to meet RFC 1123 2.1 and increase usage compatibility with other CNCF / OSS usage.
14+
Process types in the Cloud Native Buildpacks buildpack specification are less restrictive than the RFC 1123 DNS label definition. Therefore, CNB process types may not be compatible with internet routing or kubernetes resource naming. This RFC proposes to restrict CNB process types to meet RFC 1123 and increase usage compatibility with other CNCF / OSS usage.
1515

1616
# Definitions
1717

18-
RFC 1123 Requirements for Internet Hosts Section 2.1: The IETF ["Requirements for Internet Hosts" RFC](https://datatracker.ietf.org/doc/html/rfc1123#section-2.1) describes the syntax for host names on the internet.
19-
Kubernetes Resource Names: Many resource names are restricted to RFC 1123, as outlined [here](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names).
20-
Process Types: The name of a process in a Cloud Native Buildpacks result as [described in `launch.toml`](https://github.com/buildpacks/spec/blob/main/buildpack.md#launchtoml-toml).
18+
**RFC 1123**: The IETF ["Requirements for Internet Hosts" RFC](https://datatracker.ietf.org/doc/html/rfc1123#section-2.1) describes the syntax for DNS host names, domain names, and labels.
19+
**Kubernetes Resource Names**: Many resource names are restricted to RFC 1123, as outlined [here](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names).
20+
**Process Types**: The name of a process in a Cloud Native Buildpacks result as [described in `launch.toml`](https://github.com/buildpacks/spec/blob/main/buildpack.md#launchtoml-toml).
2121

2222
# Motivation
2323

2424
The images resulting from CNB builds are often deployed to internet connected environments, where it's useful to connect or manage the image lifecycle with a domain name.
2525

26-
For example, after building a web service image with Cloud Native Buildpacks, developers might want to expose various processes to the internet like static-assets.myapp.com and api.myapp.com. However, process types may currently include `_`, `.`, and/or `[A-Z]`, making process types like `Static_Assets` allowed, but not internet routable -- `Static_Assets.myapp.com` is not a valid domain name.
26+
For example, after building a web service image with Cloud Native Buildpacks, developers might want to expose various processes to the internet like static-assets.myapp.com and api.myapp.com. However, process types may currently include `_`, making process types like `Static_Assets` allowed, but not internet routable -- `Static_Assets.myapp.com` is not a valid domain name.
2727

2828
Or, developers might want to manage Kubernetes resources dynamically using process types defined in the resulting image:
2929

@@ -37,33 +37,27 @@ However, while CNB allows a `Static_Assets` process type, Kubernetes rejects it
3737
object name does not conform to Kubernetes naming requirements: "Static_Assets"
3838
```
3939

40-
These incompatibilities make using process types in dynamic scenarios challenging and/or impossible.
40+
These incompatibilities make using process types in dynamic scenarios challenging.
4141

4242
# What it is
4343

4444
The current Buildpack specification defines these process type restrictions:
4545

4646
> MUST only contain numbers, letters, and the characters ., \_, and -.
4747
48-
While RFC 1123 uses a stricter syntax with these notable differences:
48+
While DNS Labels as defined in RFC 1123 are more restrictive. Some notable differences:
4949

5050
- Underscores (`_`) are not allowed
5151
- Periods (`.`) are not allowed
5252
- Dashes ('-') are not allowed as the first or last character
5353
- Uppercase and lowercase letters are not differentiated
54-
- Must be 63 characters or less
54+
- Must be less than 63 characters
5555

56-
The buildpack specification will be modified to match RFC 1123 2.1.
56+
The buildpack specification will be modified to match RFC 1123 for DNS Labels.
5757

5858
# How it Works
5959

60-
The platform specification will be changed to reject process types that do not comply with RFC 1123 2.1. For maximum compatibility with Kubernetes resource names, the Kubernetes regular expression will be used:
61-
62-
```
63-
/[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/
64-
```
65-
66-
When a process type fails to meet this expression, appropriate error messaging may be given by the platform, for example:
60+
The platform specification will be changed to reject process types that do not comply with RFC 1123 DNS Labels. When a process type fails to meet this expression, appropriate error messaging may be given by the platform, for example:
6761

6862
```
6963
The "Static_Assets" process type must comply with RFC 1123 host name syntax. Underscores are not allowed. Uppercase letters are not allowed."
@@ -83,6 +77,20 @@ This may require buildpacks to change the way process types are defined. For bui
8377

8478
# Alternatives
8579

80+
## Enforce RFC 1123 host names
81+
82+
Instead of enforcing the DNS label syntax, enforce the host name syntax. This would allow periods (in correct postions) and allow up to 254 characters.
83+
84+
Pros:
85+
86+
- Less restrictive
87+
- would allow internet routing and kubernetes compatibility.
88+
89+
Cons:
90+
91+
- Buildpacks are unlikely to know/set the correct fully qualified domain for an image that might be deployed many places
92+
- Deployment platforms couldn't use use process types as a subdomain (since the buildpack may have chosen a 254 character process type)
93+
8694
## Do Nothing
8795

8896
If we do nothing, developers in our ecosystem will not be able to use process types for internet routing or kubernetes resource names.

0 commit comments

Comments
 (0)