Skip to content

Commit

Permalink
feat!: truncate fullname after 22 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
aboguszewski-sumo committed Sep 7, 2023
1 parent 8d8a3b9 commit f669dba
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .changelog/3248.breaking.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat!: truncate fullname after 22 characters
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| Parameter | Description | Default |
| ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `nameOverride` | Used to override the Chart name. | `Nil` |
| `fullnameOverride` | Used to override the chart's full name. | `Nil` |
| `fullnameOverride` | Used to override the chart's full name. Names longer than 22 characters will be truncated. | `Nil` |
| `namespaceOverride` | Used to override the chart's default target namepace. | `Nil` |
| `sumologic.setupEnabled` | If enabled, a pre-install hook will create Collector and Sources in Sumo Logic. | `true` |
| `sumologic.cleanupEnabled` | If enabled, a pre-delete hook will destroy Kubernetes secret and Sumo Logic Collector. | `false` |
Expand Down
7 changes: 4 additions & 3 deletions deploy/helm/sumologic/templates/_helpers/_common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ Expand the name of the chart.

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
We truncate at 22 chars because some Kubernetes name fields are limited to 63 characters (by the DNS naming spec).
In particular, some statefulsets will have too long names if the name is longer than 22 characters.
*/}}
{{- define "sumologic.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- .Values.fullnameOverride | trunc 22 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- printf "%s-%s" .Release.Name $name | trunc 22 | trimSuffix "-" }}
{{- end -}}
{{- end -}}

Expand Down
2 changes: 1 addition & 1 deletion tests/helm/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const (
otelConfigFileName = "config.yaml"
otelImageFIPSSuffix = "-fips"
otelContainerName = "otelcol"
maxHelmReleaseNameLength = 19 // Helm allows up to 53, this is our own limit
maxHelmReleaseNameLength = 22 // Helm allows up to 53, but for a name longer than 22 some statefulset names will be too long
k8sMaxNameLength = 253 // see https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
k8sMaxLabelLength = 63 // see https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
)
Expand Down

0 comments on commit f669dba

Please sign in to comment.