feat(falkordb): install FalkorDB

This commit is contained in:
Masaki Yatsu
2025-11-30 16:22:19 +09:00
parent 0032b0c4b4
commit 162d4241cd
15 changed files with 915 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -0,0 +1,15 @@
apiVersion: v2
name: falkordb
description: FalkorDB - A graph database with vector similarity search
type: application
version: 0.1.0
appVersion: "v4.14.8"
keywords:
- falkordb
- graph
- database
- redis
- cypher
home: https://www.falkordb.com/
sources:
- https://github.com/FalkorDB/FalkorDB

View File

@@ -0,0 +1,33 @@
FalkorDB has been deployed!
Get the connection information:
Host: {{ include "falkordb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
Port: {{ .Values.service.port }}
{{- if .Values.auth.enabled }}
Get the password:
kubectl get secret {{ .Values.auth.existingSecret | default (printf "%s-password" (include "falkordb.fullname" .)) }} \
-n {{ .Release.Namespace }} \
-o jsonpath="{.data.{{ .Values.auth.existingSecretPasswordKey }}}" | base64 -d
{{- end }}
Test the connection:
redis-cli -h {{ include "falkordb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local \
-p {{ .Values.service.port }} \
{{- if .Values.auth.enabled }}
-a <password> \
{{- end }}
PING
Run a Cypher query:
redis-cli -h {{ include "falkordb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local \
-p {{ .Values.service.port }} \
{{- if .Values.auth.enabled }}
-a <password> \
{{- end }}
GRAPH.QUERY mygraph "CREATE (:Person {name: 'Alice'})"

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "falkordb.name" -}}
{{- default .Chart.Name .Values.nameOverride | 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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "falkordb.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "falkordb.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "falkordb.labels" -}}
helm.sh/chart: {{ include "falkordb.chart" . }}
{{ include "falkordb.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "falkordb.selectorLabels" -}}
app.kubernetes.io/name: {{ include "falkordb.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "falkordb.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "falkordb.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,38 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "falkordb.fullname" . }}
labels:
{{- include "falkordb.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: redis
protocol: TCP
name: redis
{{- if .Values.metrics.enabled }}
- port: 9121
targetPort: metrics
protocol: TCP
name: metrics
{{- end }}
selector:
{{- include "falkordb.selectorLabels" . | nindent 4 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "falkordb.fullname" . }}-headless
labels:
{{- include "falkordb.labels" . | nindent 4 }}
spec:
type: ClusterIP
clusterIP: None
ports:
- port: {{ .Values.service.port }}
targetPort: redis
protocol: TCP
name: redis
selector:
{{- include "falkordb.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "falkordb.serviceAccountName" . }}
labels:
{{- include "falkordb.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "falkordb.fullname" . }}
labels:
{{- include "falkordb.labels" . | nindent 4 }}
{{- with .Values.metrics.serviceMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "falkordb.selectorLabels" . | nindent 6 }}
endpoints:
- port: metrics
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}

View File

@@ -0,0 +1,135 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "falkordb.fullname" . }}
labels:
{{- include "falkordb.labels" . | nindent 4 }}
spec:
serviceName: {{ include "falkordb.fullname" . }}-headless
replicas: 1
selector:
matchLabels:
{{- include "falkordb.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "falkordb.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "falkordb.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /bin/sh
- -c
- |
redis-server \
--loadmodule /var/lib/falkordb/bin/falkordb.so \
{{- if .Values.auth.enabled }}
--requirepass "$REDIS_PASSWORD"
{{- end }}
env:
{{- if .Values.auth.enabled }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.auth.existingSecret | default (printf "%s-password" (include "falkordb.fullname" .)) }}
key: {{ .Values.auth.existingSecretPasswordKey }}
- name: REDISCLI_AUTH
valueFrom:
secretKeyRef:
name: {{ .Values.auth.existingSecret | default (printf "%s-password" (include "falkordb.fullname" .)) }}
key: {{ .Values.auth.existingSecretPasswordKey }}
{{- end }}
ports:
- name: redis
containerPort: 6379
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /var/lib/falkordb/data
{{- if .Values.metrics.enabled }}
- name: metrics
image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}"
imagePullPolicy: {{ .Values.metrics.image.pullPolicy }}
securityContext:
runAsUser: 1001
runAsGroup: 1001
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
seccompProfile:
type: RuntimeDefault
capabilities:
drop:
- ALL
env:
{{- if .Values.auth.enabled }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.auth.existingSecret | default (printf "%s-password" (include "falkordb.fullname" .)) }}
key: {{ .Values.auth.existingSecretPasswordKey }}
{{- end }}
args:
- "--redis.addr=redis://localhost:6379"
{{- if .Values.auth.enabled }}
- "--redis.password=$(REDIS_PASSWORD)"
{{- end }}
ports:
- name: metrics
containerPort: 9121
protocol: TCP
resources:
{{- toYaml .Values.metrics.resources | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: data
labels:
{{- include "falkordb.labels" . | nindent 10 }}
spec:
accessModes:
{{- toYaml .Values.persistence.accessModes | nindent 10 }}
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- end }}

View File

@@ -0,0 +1,90 @@
image:
repository: falkordb/falkordb
pullPolicy: IfNotPresent
tag: ""
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
auth:
enabled: true
existingSecret: ""
existingSecretPasswordKey: "redis-password"
password: ""
persistence:
enabled: true
storageClass: ""
accessModes:
- ReadWriteOnce
size: 8Gi
serviceAccount:
create: true
automount: false
annotations: {}
name: ""
podAnnotations: {}
podLabels: {}
podSecurityContext: {}
securityContext: {}
service:
type: ClusterIP
port: 6379
resources:
requests:
cpu: 25m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
livenessProbe:
exec:
command:
- redis-cli
- ping
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
exec:
command:
- redis-cli
- ping
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
nodeSelector: {}
tolerations: []
affinity: {}
metrics:
enabled: false
image:
repository: oliver006/redis_exporter
tag: v1.66.0
pullPolicy: IfNotPresent
resources:
requests:
cpu: 15m
memory: 64Mi
limits:
cpu: 100m
memory: 128Mi
serviceMonitor:
enabled: false
interval: 30s
labels: {}