From f669dba777aa58c58848f453d60a23e7deed8f1d Mon Sep 17 00:00:00 2001 From: Adam Boguszewski Date: Thu, 7 Sep 2023 11:46:16 +0200 Subject: [PATCH] feat!: truncate fullname after 22 characters --- .changelog/3248.breaking.txt | 1 + deploy/helm/sumologic/README.md | 2 +- deploy/helm/sumologic/templates/_helpers/_common.tpl | 7 ++++--- tests/helm/const.go | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .changelog/3248.breaking.txt diff --git a/.changelog/3248.breaking.txt b/.changelog/3248.breaking.txt new file mode 100644 index 0000000000..44171f1433 --- /dev/null +++ b/.changelog/3248.breaking.txt @@ -0,0 +1 @@ +feat!: truncate fullname after 22 characters \ No newline at end of file diff --git a/deploy/helm/sumologic/README.md b/deploy/helm/sumologic/README.md index 71b53617d4..e89113ef3c 100644 --- a/deploy/helm/sumologic/README.md +++ b/deploy/helm/sumologic/README.md @@ -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` | diff --git a/deploy/helm/sumologic/templates/_helpers/_common.tpl b/deploy/helm/sumologic/templates/_helpers/_common.tpl index 76ef205e55..0279404795 100644 --- a/deploy/helm/sumologic/templates/_helpers/_common.tpl +++ b/deploy/helm/sumologic/templates/_helpers/_common.tpl @@ -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 -}} diff --git a/tests/helm/const.go b/tests/helm/const.go index ff20af642a..770030fd33 100644 --- a/tests/helm/const.go +++ b/tests/helm/const.go @@ -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/ )