Skip to content

Commit 11a4597

Browse files
committed
align helpers
1 parent 9f31d5a commit 11a4597

5 files changed

Lines changed: 23 additions & 3 deletions

File tree

garage/templates/_helpers.tpl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,28 @@ Name of the ServiceAccount to use.
4141
*/}}
4242
{{- define "garage.serviceAccountName" -}}
4343
{{- if .Values.serviceAccount.create }}
44-
{{- default (include "garage.fullname" .) .Values.serviceAccount.name }}
44+
{{- $baseName := .Values.serviceAccount.name | default (printf "sa-%s" (include "garage.fullname" .)) -}}
45+
{{- $baseName | trunc 63 | trimSuffix "-" }}
4546
{{- else }}
4647
{{- default "default" .Values.serviceAccount.name }}
4748
{{- end }}
4849
{{- end }}
4950

51+
{{/*
52+
Names for the ingress / HTTPRoute objects (prefixed for readability, overridable
53+
via .Values.<kind>.name). These name the routing object only — the backend still
54+
targets the Service (garage.fullname).
55+
*/}}
56+
{{- define "garage.ingressName" -}}
57+
{{- $baseName := .Values.ingress.name | default (printf "ingress-%s" (include "garage.fullname" .)) -}}
58+
{{- $baseName | trunc 63 | trimSuffix "-" }}
59+
{{- end }}
60+
61+
{{- define "garage.httpRouteName" -}}
62+
{{- $baseName := .Values.httpRoute.name | default (printf "httproute-%s" (include "garage.fullname" .)) -}}
63+
{{- $baseName | trunc 63 | trimSuffix "-" }}
64+
{{- end }}
65+
5066
{{/*
5167
Auto-generated RPC secret (inter-node clustering auth; loopback-only on a single
5268
node, so it is never consumed externally). `lookup` reuses the previously stored

garage/templates/httproute.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
apiVersion: gateway.networking.k8s.io/v1
1010
kind: HTTPRoute
1111
metadata:
12-
name: {{ $fullName }}
12+
name: {{ include "garage.httpRouteName" . }}
1313
labels:
1414
{{- include "garage.labels" . | nindent 4 }}
1515
{{- with .Values.httpRoute.labels }}

garage/templates/ingress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
apiVersion: networking.k8s.io/v1
55
kind: Ingress
66
metadata:
7-
name: {{ $fullName }}
7+
name: {{ include "garage.ingressName" . }}
88
labels:
99
{{- include "garage.labels" . | nindent 4 }}
1010
{{- with .Values.ingress.labels }}

garage/values.reference.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ service:
9494
ingress:
9595
# -- Enable the Ingress.
9696
enabled: false
97+
# -- Name of the Ingress object. Defaults to ingress-<fullname> when empty.
98+
name: ""
9799
# -- Ingress class name.
98100
className: ""
99101
# -- Ingress annotations.

garage/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ service:
3838

3939
ingress:
4040
enabled: false
41+
name: ""
4142
className: ""
4243
annotations: {}
4344
labels: {}
@@ -50,6 +51,7 @@ ingress:
5051

5152
httpRoute:
5253
enabled: false
54+
name: ""
5355
parentRefs: []
5456
hostnames: []
5557
annotations: {}

0 commit comments

Comments
 (0)