File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ apiVersion: v2
33name : rabbitmq-cluster
44description : Helm chart to define a RabbitMQ cluster via official rabbitmq.com CRDs (RabbitmqCluster).
55type : application
6- version : " 2.3.0 "
6+ version : " 2.3.1 "
77appVersion : " 4.2-management"
88kubeVersion : " >= 1.33.0-0"
99home : https://www.rabbitmq.com/kubernetes/operator/operator-overview.html
Original file line number Diff line number Diff line change 33slugify the string to be (k8s) DNS name compatible
44*/ }}
55{{- define " com.klicktipp.slugify-string" -}}
6- {{- $r := . | lower | replace " ." " -" | replace " /" " -" | replace " _" " -" | replace " " " -" | replace " --" " -" | trimPrefix " -" | trunc 63 | trimSuffix " -" }}
7- {{- $r }}
6+ {{- /* 1) Make sure we’re working with a string, and lowercase it */ -}}
7+ {{- $text := . | toString | lower -}}
8+
9+ {{- /* 2) Replace “anything that is NOT a-z or 0-9” (in runs) with a dash */ -}}
10+ {{- $text = regexReplaceAll " [^a-z0-9]+" $text " -" -}}
11+
12+ {{- /* 3) Remove dashes at the start or end */ -}}
13+ {{- $text = trimAll " -" $text -}}
14+
15+ {{- /* 4) Limit to 63 characters, then remove a trailing dash if truncation created one */ -}}
16+ {{- $text = $text | trunc 63 | trimSuffix " -" -}}
17+
18+ {{- /* Step 5: If nothing is left (e.g. input was only symbols), fail fast */ -}}
19+ {{- if eq $text " " -}}
20+ {{- fail " slugify: input became empty after sanitizing (must contain at least one a-z/0-9)" -}}
21+ {{- end -}}
22+
23+ {{- /* Final: output the slug */ -}}
24+ {{- $text -}}
825{{- end -}}
You can’t perform that action at this time.
0 commit comments