Skip to content

Commit c25a919

Browse files
[ENG-3021]: Add memgraph subchart
1 parent 8fd1eac commit c25a919

File tree

9 files changed

+324
-1
lines changed

9 files changed

+324
-1
lines changed

charts/datafold/Chart.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: datafold
33
description: Helm chart package to deploy Datafold on kubernetes.
44
type: application
5-
version: 0.10.43
5+
version: 0.10.44
66
appVersion: "1.0.0"
77
icon: https://www.datafold.com/logo.png
88

@@ -122,6 +122,10 @@ dependencies:
122122
version: "0.1.0"
123123
repository: file://charts/nginx
124124
condition: nginx.install
125+
- name: memgraph
126+
version: "*.*.*"
127+
repository: file://charts/memgraph
128+
condition: memgraph.install
125129
- name: datadog
126130
version: "*.*.*"
127131
repository: file://charts/datadog
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: memgraph
3+
description: A Helm chart for Memgraph graph database
4+
type: application
5+
version: 0.1.0
6+
appVersion: "latest"
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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 }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: {{ include "memgraph.pvc.name" . }}
5+
labels:
6+
{{- include "memgraph.labels" . | nindent 4 }}
7+
{{- with .Values.chartLabels }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
annotations:
11+
{{- with .Values.chartAnnotations }}
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
accessModes:
16+
- ReadWriteOnce
17+
resources:
18+
requests:
19+
storage: {{ .Values.storage.dataSize | quote }}
20+
{{- if .Values.storage.volumeId }}
21+
volumeName: {{ include "memgraph.pv.name" . }}
22+
{{- end }}
23+
{{- include "datafold.storageClass" . | nindent 2 }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "datafold.memgraph.server" . }}
5+
labels:
6+
{{- include "memgraph.labels" . | nindent 4 }}
7+
{{- with .Values.chartLabels }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
{{- with .Values.chartAnnotations }}
11+
annotations:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
type: {{ .Values.service.type }}
16+
ports:
17+
- port: {{ include "datafold.memgraph.port" . }}
18+
targetPort: bolt
19+
protocol: TCP
20+
selector:
21+
{{- include "memgraph.selectorLabels" . | nindent 4 }}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
name: {{ include "memgraph.fullname" . }}
5+
labels:
6+
{{- include "memgraph.labels" . | nindent 4 }}
7+
{{- with .Values.chartLabels }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
{{- with .Values.chartAnnotations }}
11+
annotations:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
serviceName: {{ include "memgraph.fullname" . }}
16+
replicas: 1
17+
selector:
18+
matchLabels:
19+
{{- include "memgraph.selectorLabels" . | nindent 6 }}
20+
template:
21+
metadata:
22+
annotations:
23+
{{- include "memgraph.datadog.annotations" . | nindent 8 }}
24+
labels:
25+
{{- include "memgraph.labels" . | nindent 8 }}
26+
{{- with .Values.podLabels }}
27+
{{- toYaml . | nindent 8 }}
28+
{{- end }}
29+
spec:
30+
{{- with .Values.imagePullSecrets }}
31+
imagePullSecrets:
32+
{{- toYaml . | nindent 8 }}
33+
{{- end }}
34+
securityContext:
35+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
36+
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
37+
initContainers:
38+
- name: init-chown
39+
image: busybox:latest
40+
command: ["sh", "-c", "chown -R 101:103 /var/lib/memgraph"]
41+
securityContext:
42+
{{- toYaml .Values.initSecurityContext | nindent 12 }}
43+
volumeMounts:
44+
{{- include "memgraph.volume.mounts" . | nindent 12 }}
45+
containers:
46+
- name: {{ .Chart.Name }}
47+
securityContext:
48+
{{- toYaml .Values.securityContext | nindent 12 }}
49+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
50+
imagePullPolicy: {{ .Values.image.pullPolicy }}
51+
args:
52+
- "--storage-snapshot-on-exit=true"
53+
- "--log-level=WARNING"
54+
- "--also-log-to-stderr=true"
55+
ports:
56+
- name: bolt
57+
containerPort: 7687
58+
protocol: TCP
59+
livenessProbe:
60+
tcpSocket:
61+
port: bolt
62+
initialDelaySeconds: 30
63+
periodSeconds: 10
64+
timeoutSeconds: 5
65+
failureThreshold: 6
66+
readinessProbe:
67+
tcpSocket:
68+
port: bolt
69+
initialDelaySeconds: 5
70+
periodSeconds: 5
71+
timeoutSeconds: 3
72+
failureThreshold: 3
73+
resources:
74+
{{- toYaml .Values.resources | nindent 12 }}
75+
volumeMounts:
76+
{{- include "memgraph.volume.mounts" . | nindent 12 }}
77+
{{- with .Values.volumeMounts }}
78+
{{- toYaml . | nindent 12 }}
79+
{{- end }}
80+
volumes:
81+
{{- include "memgraph.volumes" . | nindent 8 }}
82+
{{- with .Values.volumes }}
83+
{{- toYaml . | nindent 8 }}
84+
{{- end }}
85+
{{- with .Values.nodeSelector }}
86+
nodeSelector:
87+
{{- toYaml . | nindent 8 }}
88+
{{- end }}
89+
{{- with .Values.affinity }}
90+
affinity:
91+
{{- toYaml . | nindent 8 }}
92+
{{- end }}
93+
{{- with .Values.tolerations }}
94+
tolerations:
95+
{{- toYaml . | nindent 8 }}
96+
{{- end }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
replicaCount: 1
2+
3+
image:
4+
repository: memgraph/memgraph
5+
pullPolicy: IfNotPresent
6+
tag: ""
7+
8+
imagePullSecrets: []
9+
nameOverride: ""
10+
fullnameOverride: ""
11+
terminationGracePeriodSeconds: 60
12+
13+
storage:
14+
dataSize: 50Gi
15+
storageClass: ""
16+
volumeId: ""
17+
18+
podAnnotations: {}
19+
20+
chartLabels: {}
21+
chartAnnotations: {}
22+
23+
podSecurityContext:
24+
fsGroup: 103
25+
26+
securityContext:
27+
allowPrivilegeEscalation: false
28+
29+
initSecurityContext:
30+
runAsUser: 0
31+
runAsGroup: 0
32+
33+
service:
34+
type: ClusterIP
35+
port: 7687
36+
37+
resources:
38+
requests:
39+
cpu: 500m
40+
memory: 512Mi
41+
limits:
42+
memory: 4Gi
43+
44+
nodeSelector: {}
45+
46+
tolerations: []
47+
48+
affinity: {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{/*
2+
Return the memgraph host
3+
*/}}
4+
{{- define "datafold.memgraph.server" -}}
5+
{{- if not .Values.global.memgraph.server -}}
6+
{{ printf "%s-%s" .Release.Name "memgraph" }}
7+
{{- else -}}
8+
{{ .Values.global.memgraph.server }}
9+
{{- end -}}
10+
{{- end -}}
11+
12+
{{/*
13+
Return the memgraph port
14+
*/}}
15+
{{- define "datafold.memgraph.port" -}}
16+
{{- print $.Values.global.memgraph.port -}}
17+
{{- end -}}

charts/datafold/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ global:
2525
port: 9000
2626
storageOnPV: "true"
2727
database: "clickhouse"
28+
memgraph:
29+
port: 7687
30+
storageOnPV: "true"
2831
postgres:
2932
server: ""
3033
port: 5432
@@ -72,6 +75,9 @@ kept:
7275
clickhouse:
7376
install: true
7477

78+
memgraph:
79+
install: false
80+
7581
dfshell:
7682
install: true
7783

0 commit comments

Comments
 (0)