|
| 1 | +{{/* |
| 2 | +Expand the name of the chart. |
| 3 | +*/}} |
| 4 | +{{- define "memgraph.name" -}} |
| 5 | +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} |
| 6 | +{{- end }} |
| 7 | + |
| 8 | +{{/* |
| 9 | +Create a default fully qualified app name. |
| 10 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 11 | +If release name contains chart name it will be used as a full name. |
| 12 | +*/}} |
| 13 | +{{- define "memgraph.fullname" -}} |
| 14 | +{{- if .Values.fullnameOverride }} |
| 15 | +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} |
| 16 | +{{- else }} |
| 17 | +{{- $name := default .Chart.Name .Values.nameOverride }} |
| 18 | +{{- if contains $name .Release.Name }} |
| 19 | +{{- .Release.Name | trunc 63 | trimSuffix "-" }} |
| 20 | +{{- else }} |
| 21 | +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} |
| 22 | +{{- end }} |
| 23 | +{{- end }} |
| 24 | +{{- end }} |
| 25 | + |
| 26 | +{{/* |
| 27 | +Create chart name and version as used by the chart label. |
| 28 | +*/}} |
| 29 | +{{- define "memgraph.chart" -}} |
| 30 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} |
| 31 | +{{- end }} |
| 32 | + |
| 33 | +{{/* |
| 34 | +Common labels |
| 35 | +*/}} |
| 36 | +{{- define "memgraph.labels" -}} |
| 37 | +helm.sh/chart: {{ include "memgraph.chart" . }} |
| 38 | +app.kubernetes.io/component: database |
| 39 | +{{ include "memgraph.selectorLabels" . }} |
| 40 | +{{- if .Chart.AppVersion }} |
| 41 | +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 42 | +{{- end }} |
| 43 | +{{ include "datafold.labels" . }} |
| 44 | +{{- end }} |
| 45 | + |
| 46 | +{{/* |
| 47 | +Selector labels |
| 48 | +*/}} |
| 49 | +{{- define "memgraph.selectorLabels" -}} |
| 50 | +app.kubernetes.io/name: {{ include "memgraph.name" . }} |
| 51 | +{{- end }} |
| 52 | + |
| 53 | +{{/* |
| 54 | +Name of the memgraph data volume claim |
| 55 | +*/}} |
| 56 | +{{- define "memgraph.pvc.name" -}} |
| 57 | +{{- include "memgraph.name" . }}-data-claim |
| 58 | +{{- end -}} |
| 59 | + |
| 60 | +{{/* |
| 61 | +Name of the memgraph data volume |
| 62 | +*/}} |
| 63 | +{{- define "memgraph.pv.name" -}} |
| 64 | +{{- include "memgraph.name" . }}-data-volume |
| 65 | +{{- end -}} |
| 66 | + |
| 67 | +{{/* |
| 68 | +Volume mounts when PV is used |
| 69 | +*/}} |
| 70 | +{{- define "memgraph.volume.mounts" -}} |
| 71 | +{{- if (ne .Values.global.memgraph.storageOnPV "false") }} |
| 72 | +- name: data |
| 73 | + mountPath: /var/lib/memgraph |
| 74 | +{{- end -}} |
| 75 | +{{- end -}} |
| 76 | + |
| 77 | +{{/* |
| 78 | +Volumes when PV is used |
| 79 | +*/}} |
| 80 | +{{- define "memgraph.volumes" -}} |
| 81 | +{{- if (ne .Values.global.memgraph.storageOnPV "false") }} |
| 82 | +- name: data |
| 83 | + persistentVolumeClaim: |
| 84 | + claimName: {{ include "memgraph.pvc.name" . }} |
| 85 | +{{- end }} |
| 86 | +{{- end -}} |
| 87 | + |
| 88 | +{{/* |
| 89 | +Datadog annotations |
| 90 | +*/}} |
| 91 | +{{- define "memgraph.datadog.annotations" -}} |
| 92 | +{{- if (eq .Values.global.datadog.install true) }} |
| 93 | +ad.datadoghq.com/{{ .Chart.Name }}.logs: >- |
| 94 | + [{ |
| 95 | + "source": "memgraph", |
| 96 | + "service": "memgraph" |
| 97 | + }] |
| 98 | +{{- end }} |
| 99 | +{{- with .Values.podAnnotations }} |
| 100 | +{{- toYaml . | nindent 0 }} |
| 101 | +{{- end }} |
| 102 | +{{- end }} |
0 commit comments