Skip to content

Commit

Permalink
fix: modify mongodb sharding label (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
kizuna-lek authored Nov 22, 2023
1 parent 1990eb8 commit 9a6ec83
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions addons/mongodb/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "mongodb-sharding.name" -}}
{{- default "mongodb-sharding" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
Expand Down Expand Up @@ -42,6 +46,26 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Mongodb-sharding Common labels
*/}}
{{- define "mongodb-sharding.labels" -}}
helm.sh/chart: {{ include "mongodb.chart" . }}
{{ include "mongodb-sharding.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Mongodb-sharding Selector labels
*/}}
{{- define "mongodb-sharding.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mongodb-sharding.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Selector labels
*/}}
Expand Down
2 changes: 1 addition & 1 deletion addons/mongodb/templates/sharding-clusterdefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: ClusterDefinition
metadata:
name: mongodb-sharding
labels:
{{- include "mongodb.labels" . | nindent 4 }}
{{- include "mongodb-sharding.labels" . | nindent 4 }}
spec:
type: mongodb
connectionCredential:
Expand Down

0 comments on commit 9a6ec83

Please sign in to comment.