Skip to content

Commit

Permalink
feat(template): add major version suffix to deployment names
Browse files Browse the repository at this point in the history
Signed-off-by: Thuan Vo <[email protected]>
  • Loading branch information
tthvo committed Sep 24, 2024
1 parent 12879aa commit 4310b80
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions charts/cryostat/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,11 @@ Get or generate a default secret key for auth proxy cookies.
{{- end -}}
{{- join "," (default list $l | compact | uniq) | quote -}}
{{- end -}}

{{/*
Get the name for managed deployments.
*/}}
{{- define "cryostat.deploymentName" -}}
{{- $version := semver .Chart.AppVersion -}}
{{- printf "%s-v%d" (include "cryostat.fullname" .) $version.Major -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/cryostat/templates/cryostat_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cryostat.fullname" . }}
name: {{ include "cryostat.deploymentName" . }}
labels:
{{- include "cryostat.labels" . | nindent 4 }}
app.kubernetes.io/component: cryostat
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/templates/db_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cryostat.fullname" . }}-db
name: {{ include "cryostat.deploymentName" . }}-db
labels:
{{- include "cryostat.labels" . | nindent 4 }}
app.kubernetes.io/component: db
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/templates/reports_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cryostat.fullname" . }}-reports
name: {{ include "cryostat.deploymentName" . }}-reports
labels:
{{- include "cryostat.labels" . | nindent 4 }}
app.kubernetes.io/component: reports
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/templates/storage_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cryostat.fullname" . }}-storage
name: {{ include "cryostat.deploymentName" . }}-storage
labels:
{{- include "cryostat.labels" . | nindent 4 }}
app.kubernetes.io/component: storage
Expand Down

0 comments on commit 4310b80

Please sign in to comment.