Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(template): add major version suffix to deployment names #202

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion charts/cryostat/tests/cryostat_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tests:
value: Deployment
- equal:
path: metadata.name
value: RELEASE-NAME-cryostat
value: RELEASE-NAME-cryostat-v4
- equal:
path: spec.replicas
value: 1
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/tests/db_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tests:
value: Deployment
- equal:
path: metadata.name
value: RELEASE-NAME-cryostat-db
value: RELEASE-NAME-cryostat-v4-db
- equal:
path: spec.replicas
value: 1
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/tests/reports_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tests:
value: Deployment
- equal:
path: metadata.name
value: RELEASE-NAME-cryostat-reports
value: RELEASE-NAME-cryostat-v4-reports
- equal:
path: spec.replicas
value: 2
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/tests/storage_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tests:
value: Deployment
- equal:
path: metadata.name
value: RELEASE-NAME-cryostat-storage
value: RELEASE-NAME-cryostat-v4-storage
- equal:
path: spec.replicas
value: 1
Expand Down