You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issues with using helm generated names in resource name with truncation #1071
I am wondering if we should just decide on a safe naming convention and compute it prior to rendering templates. Then we could just expose something like Release.Id, Chart.Id, or Template.Id that would meet the Kubernetes restrictions.
One idea would be to simply compute a hash of the chart path relative to root, and then append that to a release name. Pseudo-code would be something like:
So Chart.Id would be something like fluffy-panda-aa56c8.
Since we'd compute against the path to the chart, subcharts could even have duplicate names, but still have unique Chart.Id. Yet Chart.Id would be stable over upgrades.
In a template, this would just be referenced via the {{.Chart.Id}} computed value.
Correct me if I'm wrong, but this would mean that multiple of a resource type in the same (parent) chart won't both be able to use {{.Chart.Id}} as the name. This would be an issue if, for example, you had a MariaDB cluster chart with a master and slave service.
The other (perhaps smaller) issue with this is you lose visibility into what the service is. If my MariaDB deployment is called fluffy-panda-aa56c8, I'll need to run helm list to realise that fluffy-panda is a MariaDB chart.
What we could do, is truncate the release name so that we always have a deterministic length, and leave enough space for the chart developer to extend the name. So, for example, document that {{.Release.Name}} will always have (at-most) length 14 (n), so the chart developer can extend with 10 (24-n) characters reliably.
The issue with truncating the release name is that it will be harder to associate it with the actual release, so ideally we can force the moniker to abide by the maximum length. Is that possible?
Oh... hit a snag. Does that mean I need to enforce a limit on the length of the -n flag for install? That won't be a popular decision, but I can do it.
Oh yes, there will need to be a limit on custom release names too. I guess as long the maximum length is long enough to minimise a 'release name too long' error, it might be okay? I'm not sure what the ideal length should be though.
Some examples of service names:
mariadb-master 15
zeppelin-controller 20 (could be shortened to zeppelin-ctrl 14)
Alright, the PR on #1080 limits the release name to 14. It doesn't totally fix the original issue, though, since a release name could accidentally end in -. I will do a separate PR to address that particular fact by providing the trimSuffix function to templates. That way, at least there is a way to run a sanitizing trunc 24 | trimSuffix "-" sequence.
Also, wondering if we can add a lint rule to check the reliability of the generated names. A simple check would be to ensure that the length of the generated template name when .Release.Name = "" is <= 10 (in the case where the max for the release name is 14), as this would ensure that the whole name will never be cut off.
Okay, so the merged version has 14 as the length. We can shorten later if we need. I'd still be interested in exploring some generated compact unique names or prefixes. Even something like a truncated hash (a la Git commit hashes) might be useful for some of these name fields.
I'm marking this issue as closed since both related PRs are merged. If we hit additional problems, we should track in a separate issue.
Activity
technosophos commentedon Aug 18, 2016
I am wondering if we should just decide on a safe naming convention and compute it prior to rendering templates. Then we could just expose something like
Release.Id,Chart.Id, orTemplate.Idthat would meet the Kubernetes restrictions.One idea would be to simply compute a hash of the chart path relative to root, and then append that to a release name. Pseudo-code would be something like:
So
Chart.Idwould be something likefluffy-panda-aa56c8.Since we'd compute against the path to the chart, subcharts could even have duplicate names, but still have unique
Chart.Id. Yet Chart.Id would be stable over upgrades.In a template, this would just be referenced via the
{{.Chart.Id}}computed value.prydonius commentedon Aug 19, 2016
Correct me if I'm wrong, but this would mean that multiple of a resource type in the same (parent) chart won't both be able to use
{{.Chart.Id}}as the name. This would be an issue if, for example, you had a MariaDB cluster chart with a master and slave service.The other (perhaps smaller) issue with this is you lose visibility into what the service is. If my MariaDB deployment is called
fluffy-panda-aa56c8, I'll need to runhelm listto realise thatfluffy-pandais a MariaDB chart.What we could do, is truncate the release name so that we always have a deterministic length, and leave enough space for the chart developer to extend the name. So, for example, document that
{{.Release.Name}}will always have (at-most) length 14 (n), so the chart developer can extend with 10 (24-n) characters reliably.The issue with truncating the release name is that it will be harder to associate it with the actual release, so ideally we can force the moniker to abide by the maximum length. Is that possible?
technosophos commentedon Aug 19, 2016
I think we could enforce a max length on the
.Release.Name. Lemme give that a try really quickly.technosophos commentedon Aug 19, 2016
Oh... hit a snag. Does that mean I need to enforce a limit on the length of the
-nflag for install? That won't be a popular decision, but I can do it.prydonius commentedon Aug 19, 2016
Oh yes, there will need to be a limit on custom release names too. I guess as long the maximum length is long enough to minimise a 'release name too long' error, it might be okay? I'm not sure what the ideal length should be though.
Some examples of service names:
feat(tiller): limit the max len of Release.Name
technosophos commentedon Aug 19, 2016
Alright, the PR on #1080 limits the release name to 14. It doesn't totally fix the original issue, though, since a release name could accidentally end in
-. I will do a separate PR to address that particular fact by providing thetrimSuffixfunction to templates. That way, at least there is a way to run a sanitizingtrunc 24 | trimSuffix "-"sequence.fix(tiller): upgrade Sprig to 2.5.0
prydonius commentedon Aug 19, 2016
Given the examples above, I'm wondering if 14 is too big for the release name?
prydonius commentedon Aug 19, 2016
Also, wondering if we can add a lint rule to check the reliability of the generated names. A simple check would be to ensure that the length of the generated template name when
.Release.Name = ""is <= 10 (in the case where the max for the release name is 14), as this would ensure that the whole name will never be cut off.technosophos commentedon Aug 19, 2016
Oops... #1081 shouldn't really have closed this. Sorry.
technosophos commentedon Aug 22, 2016
Okay, so the merged version has 14 as the length. We can shorten later if we need. I'd still be interested in exploring some generated compact unique names or prefixes. Even something like a truncated hash (a la Git commit hashes) might be useful for some of these name fields.
I'm marking this issue as closed since both related PRs are merged. If we hit additional problems, we should track in a separate issue.
build(deps): bump github.com/helmfile/vals from 0.28.0 to 0.28.1 (hel…