Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Charts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
魏国强
Charts
Commits
0e1ee81f
Commit
0e1ee81f
authored
Jan 30, 2021
by
Waqar Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add name suffix for chart releases having more then 1 deployments
parent
f1c99176
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
9 deletions
+29
-9
library/common/templates/classes/_service.tpl
library/common/templates/classes/_service.tpl
+0
-3
library/common/templates/lib/chart/_labels.tpl
library/common/templates/lib/chart/_labels.tpl
+1
-1
library/common/templates/lib/chart/_names.tpl
library/common/templates/lib/chart/_names.tpl
+28
-5
No files found.
library/common/templates/classes/_service.tpl
View file @
0e1ee81f
...
...
@@ -5,9 +5,6 @@ within the common library.
{{- define "common.classes.service" -}}
{{- $values := .service -}}
{{- $serviceName := include "common.names.fullname" . -}}
{{- if hasKey $values "nameSuffix" -}}
{{- $serviceName = printf "%v-%v" $serviceName $values.nameSuffix -}}
{{ end -}}
{{- $svcType := $values.type | default "" -}}
apiVersion: v1
kind: Service
...
...
library/common/templates/lib/chart/_labels.tpl
View file @
0e1ee81f
...
...
@@ -15,5 +15,5 @@ Selector labels shared across objects.
*/
}
}
{{- define "common.labels.selectorLabels" -}}
app.kubernetes.io/name: {{ include "common.names.name" . }}
app.kubernetes.io/instance: {{
.Release.Name
}}
app.kubernetes.io/instance: {{
include "common.names.releaseName" .
}}
{{- end }}
library/common/templates/lib/chart/_names.tpl
View file @
0e1ee81f
...
...
@@ -2,7 +2,12 @@
Expand
the
name
of
the
chart
.
*/
}}
{{- define "common.names.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- $values := . -}}
{{- $name := (default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-") }}
{{- if hasKey $values "nameSuffix" -}}
{{- $name = (printf "%v-%v" $name $values.nameSuffix) -}}
{{ end -}}
{{- print $name -}}
{{- end }}
{
{
/*
...
...
@@ -11,12 +16,16 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
If
release
name
contains
chart
name
it
will
be
used
as
a
full
name
.
*/
}
}
{{- define "common.names.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- $values := . -}}
{{- if $values.fullnameOverride }}
{{- $values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- $name := default .Chart.Name $values.nameOverride }}
{{- if hasKey $values "nameSuffix" -}}
{{- $name = (printf "%v-%v" $name $values.nameSuffix) -}}
{{ end -}}
{{- if contains $name .Release.Name }}
{{-
.Release.Name | trunc 63 | trimSuffix "-"
}}
{{-
$name = (.Release.Name | trunc 63 | trimSuffix "-")
}}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
...
...
@@ -36,3 +45,17 @@ Determine service account name for deployment or statefulset.
{{- define "common.names.serviceAccountName" -}}
{{- (include "common.names.fullname" .) | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{
{
/*
Determine
release
name
This
will
add
a
suffix
to
the
release
name
if
nameSuffix
is
set
*/
}
}
{{- define "common.names.releaseName" -}}
{{- $values := . -}}
{{- if hasKey $values "nameSuffix" -}}
{{- printf "%v-%v" .Release.Name $values.nameSuffix -}}
{{- else -}}
{{- print .Release.Name -}}
{{ end -}}
{{- end -}}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment