1+ { {/*
2+ Copyright 2025 Google LLC
3+
4+ Licensed under the Apache License, Version 2.0 (the " License" );
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ https://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an " AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+ */} }
16+ { {/*
17+ Expand the name of the chart.
18+ */} }
19+ { {- define " gemma.name" -} }
20+ { {- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix " -" } }
21+ { {- end } }
22+
23+ { {/*
24+ Create a default fully qualified app name.
25+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
26+ If release name contains chart name it will be used as a full name.
27+ */} }
28+ { {- define " gemma.fullname" -} }
29+ { {- if .Values.fullnameOverride } }
30+ { {- .Values.fullnameOverride | trunc 63 | trimSuffix " -" } }
31+ { {- else } }
32+ { {- $name := default .Chart.Name .Values.nameOverride } }
33+ { {- if contains $name .Release.Name } }
34+ { {- .Release.Name | trunc 63 | trimSuffix " -" } }
35+ { {- else } }
36+ { {- printf " %s-%s" .Release.Name $name | trunc 63 | trimSuffix " -" } }
37+ { {- end } }
38+ { {- end } }
39+ { {- end } }
40+
41+ { {/*
42+ Create chart labels for a chart.
43+ */} }
44+ { {- define " gemma.chart" -} }
45+ { {- printf " %s-%s" .Chart.Name .Chart.Version | replace " +" " _" | trunc 63 | trimSuffix " -" } }
46+ { {- end } }
47+
48+ { {/*
49+ Common labels
50+ */} }
51+ { {- define " gemma.labels" -} }
52+ helm.sh/chart: { { include " gemma.chart" . } }
53+ { { include " gemma.selectorLabels" . } }
54+ { {- if .Chart.AppVersion } }
55+ app.kubernetes.io/version: { { .Chart.AppVersion | quote } }
56+ { {- end } }
57+ app.kubernetes.io/managed-by: { { .Release.Service } }
58+ { {- end } }
59+
60+ { {/*
61+ Selector labels
62+ */} }
63+ { {- define " gemma.selectorLabels" -} }
64+ app.kubernetes.io/name: { { include " gemma.name" . } }
65+ app.kubernetes.io/instance: { { .Release.Name } }
66+ { {- end } }
0 commit comments