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

Why Helm release name is a DNS label with max length of 53 characters? #6006

Open
stevebail opened this issue Jul 10, 2019 · 18 comments · May be fixed by #8384
Open

Why Helm release name is a DNS label with max length of 53 characters? #6006

stevebail opened this issue Jul 10, 2019 · 18 comments · May be fixed by #8384

Comments

@stevebail
Copy link

@stevebail stevebail commented Jul 10, 2019

Helm documentation states the following:
-1) (k8s) metadata.name is restricted to a maximum length of 63 characters because of limitations to the DNS system
-2) For that reasons, release names are (DNS labels that are) limited to 53 characters

Statement 1) is not correct.
k8s does not impose a max length of 63 characters on resource names.
The actual max length for a resource name is 253 characters.
The k8s resource name is in fact a DNS subdomain (that can be made of one or more DNS labels).

Should we make the release name a DNS subdomain?

@bacongobbler
Copy link
Member

@bacongobbler bacongobbler commented Jul 10, 2019

Long ago Kubernetes service names were restricted to 53 characters. More recent versions of Kubernetes allow longer service names, though there was a time that some users were using the older version of Kubernetes so we couldn't relax the constraint. We can probably relax that constraint now.

@valoricDe
Copy link

@valoricDe valoricDe commented Nov 11, 2019

Which parts would have to be updated to relax the constrain?

@JacobHayes
Copy link

@JacobHayes JacobHayes commented Nov 13, 2019

Not sure if much has changed since #1560, but looks like that bumped it last time.

@bacongobbler
Copy link
Member

@bacongobbler bacongobbler commented Nov 13, 2019

Here is where it resides today.

// releaseNameMaxLen is the maximum length of a release name.
//
// As of Kubernetes 1.4, the max limit on a name is 63 chars. We reserve 10 for
// charts to add data. Effectively, that gives us 53 chars.
// See https://github.com/helm/helm/issues/1528
const releaseNameMaxLen = 53

@brunohms
Copy link

@brunohms brunohms commented Dec 18, 2019

@bacongobbler shouldn't helm be up to 63 characters as weel?

Because when a chart is create it limits to 63 characters in the _helpers.tpl file.

@bacongobbler
Copy link
Member

@bacongobbler bacongobbler commented Dec 18, 2019

See the comment in the code linked above.

// As of Kubernetes 1.4, the max limit on a name is 63 chars. We reserve 10 for
// charts to add data. Effectively, that gives us 53 chars.
// See #1528

@vaibhav-si
Copy link

@vaibhav-si vaibhav-si commented Feb 1, 2020

We upgraded to Helm3 but now helm render fails with "release name exceeds max length of 53" error. What is the resolution here? Is Helm planning to increase the character limit?

@tomcruise81
Copy link

@tomcruise81 tomcruise81 commented Feb 3, 2020

It's not perfect, but we run our release names through a little bash function ahead of time:

function normalizeHelmReleaseName {
    # See https://github.com/helm/helm/issues/6006#issuecomment-553184466
    if [ ${#1} -gt 53 ]; then
        printf "%s-%s" $(echo -n $1 | cut -c -44) $(echo -n $1 | sha256sum | cut -c -8)
    else
        echo -n $1
    fi
}
@bacongobbler
Copy link
Member

@bacongobbler bacongobbler commented Feb 3, 2020

@vaibhav-si we'd welcome PRs to increase the character limit to whatever's reasonable in more recent Kubernetes versions. It's open source! Feel free to contribute.

@vaibhav-si
Copy link

@vaibhav-si vaibhav-si commented Feb 3, 2020

@bacongobbler I would love to contribute, is there a documented process for contributing? How does the build system work?

@damodhar22
Copy link

@damodhar22 damodhar22 commented Feb 25, 2020

See the comment in the code linked above.

// As of Kubernetes 1.4, the max limit on a name is 63 chars. We reserve 10 for
// charts to add data. Effectively, that gives us 53 chars.
// See #1528

What is the rationale behind choosing 53 chars for release_name and 10 for chart data

With recent versions of kubernetes supporting 253 characters what should be this ratio now?

@damodhar22
Copy link

@damodhar22 damodhar22 commented Feb 26, 2020

See the comment in the code linked above.

// As of Kubernetes 1.4, the max limit on a name is 63 chars. We reserve 10 for
// charts to add data. Effectively, that gives us 53 chars.
// See #1528

What is the rationale behind choosing 53 chars for release_name and 10 for chart data

With recent versions of kubernetes supporting 253 characters what should be this ratio now?

@bacongobbler could you answer this?

@bacongobbler
Copy link
Member

@bacongobbler bacongobbler commented Feb 26, 2020

I think I already answered that question earlier in the thread. #6006 (comment)

@renatosuero
Copy link

@renatosuero renatosuero commented Jun 30, 2020

hi @bacongobbler I'd love to fix that as my first PR here. The goal is change to 243 and keep 10 for chart data,right ?

@bacongobbler
Copy link
Member

@bacongobbler bacongobbler commented Jun 30, 2020

Just to be sure, I would advise doing some testing (and some digging in kubernetes/kubernetes to make sure that assumption of 253 characters for a service name still holds true today). But assuming that works, then yes, bumping the release name maximum character length to 243 characters should be fine.

@hickeyma
Copy link
Contributor

@hickeyma hickeyma commented Jul 1, 2020

@renatosuero It seems to be 253 alright: https://kubernetes.io/docs/concepts/overview/working-with-objects/names

You would need to take into account that a release is stored as a Secret/ConfigMap in the cluster with the following nomenclature for its name: sh.helm.release.v1.<release_name>.v1. This means then it would be 253 -22 (prefix + postfix of name) = 231 characters

@renatosuero renatosuero linked a pull request that will close this issue Jul 1, 2020
0 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

10 participants
You can’t perform that action at this time.