Skip to content

RFC 952/1123 allows uppercase characters, but IsDNS1123Subdomain does not #71140

Closed

Description

@astrieanna

What happened:
IsDNS1123Subdomain and IsDNS1123Label do not allow uppercase letters.

I ran into this when trying to start kubelet on a node with an all-caps hostname. The node can't register when its node name defaults to the hostname and the hostname includes capital letters.

What you expected to happen:
They should allow uppercase letters.
RFC 952 says "No distinction is made between upper and lower case."
RFC 1123 doesn't change that (just allows the first character to be a number).

/kind bug

Activity

  1. added
    kind/bugCategorizes issue or PR as related to a bug.
    needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.
    on Nov 16, 2018
  2. astrieanna commented on Nov 16, 2018

    @astrieanna
    ContributorAuthor

    /sig api-machinery

  3. added
    sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.
    and removed
    needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.
    on Nov 16, 2018
  4. liggitt commented on Nov 16, 2018

    @liggitt
    Member

    we can change the documentation, but changing the validation rules isn't possible to do compatibly at this point

    /kind documentation

  5. removed
    kind/bugCategorizes issue or PR as related to a bug.
    on Nov 16, 2018
  6. astrieanna commented on Nov 16, 2018

    @astrieanna
    ContributorAuthor

    @liggitt could you explain more exactly what would be incompatible?

  7. liggitt commented on Nov 26, 2018

    @liggitt
    Member

    Two relevant examples:

    • many object names that use these validation rules are used as labels in kubernetes DNS names (or example, namespace, service, and pod names). Since DNS resolution is case-insensitive, allowing both upper and lower case letters would permit multiple objects to form colliding DNS labels (a service named FOO and a service named foo in the same namespace would produce colliding DNS labels)
    • the reason the kubelet originally used the detected hostname as the node name was that it was one of the more unique and identifiable attributes available to it. However, the detected hostname is also DNS-based, and should be treated case-insensitively, in this case normalizing to lower-case. Otherwise, different systems can think that case-variants of the same node hostname are actually different nodes. The particular issue of normalizing detected node hostnames to lower case was resolved in 1.12 in b3dfe0c
  8. jennybuckley commented on Nov 26, 2018

    @jennybuckley
  9. thockin commented on Dec 18, 2018

    @thockin
    Member

    Why do we need to change it? Case-insensitivity is a great way to write lots of subtle bugs. We didn't do it on purpose.

    We could normalize such fields to lower-case, but in general we do not modify user-input like that, so it would be a big deal.

  10. liggitt commented on Dec 18, 2018

    @liggitt
    Member

    Agree. We should not change the validation rule. We can change the documentation to clarify it must be dns conformant and lowercase

  11. thockin commented on Dec 18, 2018

    @thockin
    Member

    And for the record, normalizing names would cause churn on things like kubectl apply that we really don't want, I think.

  12. added
    sig/networkCategorizes an issue or PR as relevant to SIG Network.
    on Mar 7, 2019
  13. 1 remaining item

  14. freehan commented on Apr 4, 2019

    @freehan
    Contributor

    no fix yet. closing

  15. c3d commented on Oct 13, 2023

    @c3d

    And for the record, normalizing names would cause churn on things like kubectl apply that we really don't want, I think.

    All of Internet goes through that "churn" for what it is worth, because RFC1123, through RFC952, actually mandates it. There is no room for "we don't want to do it for performance reasons" in "No distinction is made between upper and lower case".

    It's OK to use your own validation rules. Just don't quote RFC1123 in them, if you can't follow it.

  16. maxlillo commented on Feb 9, 2024

    @maxlillo

    This is actually quite annoying for automations where you need the hostname the you don't normalize it because of this misimplemented fucntionality

  17. semik commented on Feb 11, 2025

    @semik

    Please can you remove RFC 1123 from error message? I just run into ingress.networking.k8s.io \"test\" is invalid: [spec.rules[0].host: Invalid value: \"TEST-HOSTNAME.LOCAL\": 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])?)*'), spec.tls[0].hosts[0]: Invalid value: \"TEST-HOSTNAME.LOCAL\": 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])?)*')

    That error message is misleading. Hostnames are case insensitive. If you have to limit case, do it, but make your own excuse. Do not blame 36 year old standard!

          The syntax of a legal Internet host name was specified in RFC-952
          [DNS:4].  One aspect of host name syntax is hereby changed: the
          restriction on the first character is relaxed to allow either a
          letter or a digit.  Host software MUST support this more liberal
          syntax.
    

    RFC 952 says:

       ASSUMPTIONS
    
       1. A "name" (Net, Host, Gateway, or Domain name) is a text string up
       to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus
       sign (-), and period (.).  Note that periods are only allowed when
       they serve to delimit components of "domain style names". (See
       [RFC-921](https://www.rfc-editor.org/rfc/rfc921), "Domain Name System Implementation Schedule", for
       background).  No blank or space characters are permitted as part of a
       name. No distinction is made between upper and lower case.  The first
       character must be an alpha character.
    
  18. thockin commented on Feb 11, 2025

    @thockin
    Member

    It says "a lowercase RFC 1123 subdomain ..."

    Anyway, I am hoping to make validation errors better in the next few releases, so this will likely be covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/documentationCategorizes issue or PR as related to documentation.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.sig/networkCategorizes an issue or PR as relevant to SIG Network.triage/unresolvedIndicates an issue that can not or will not be resolved.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions