Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Support FoundationDB Document-Layer store, as an optional alternative to MongoDB #656

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Binary file added chart-repo
Binary file not shown.
22 changes: 22 additions & 0 deletions chart/monocular/local-helm/fdbdoclayer/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
5 changes: 5 additions & 0 deletions chart/monocular/local-helm/fdbdoclayer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: fdbdoclayer
version: 0.1.0
33 changes: 33 additions & 0 deletions chart/monocular/local-helm/fdbdoclayer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{/* vim: set filetype=mustache: */}}

{{/*
Expand the name of the chart.
*/}}
{{- define "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).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name for the document layer.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "doclayer.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s-%s" .Release.Name $name "fdbdoclayer" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Render image reference
*/}}
{{- define "fdb.image" -}}
{{ .registry }}/{{ .repository }}:{{ .tag }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "fullname" . }}-fdbdoclayer
labels:
app: {{ template "fullname" . }}-fdbdoclayer
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: {{ .Values.fdbdoclayer.replicas }}
selector:
matchLabels:
app: {{ template "fullname" . }}-fdbdoclayer
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "fullname" . }}-fdbdoclayer
release: {{ .Release.Name }}
spec:
{{- with .Values.securityContext }}
securityContext:
{{ toYaml . | indent 8 }}
{{- end }}
containers:
- name: fdbdoclayer
image: {{ template "fdb.image" .Values.fdbdoclayer.image }}
env:
- name: FDB_COORDINATOR
value: {{ template "fullname" . }}-fdbserver
- name: CLUSTER_ID
value: chartdb:erlklkg
ports:
- containerPort: {{ .Values.fdbdoclayer.service.port }}
livenessProbe:
tcpSocket:
port: {{ .Values.fdbdoclayer.service.port }}
initialDelaySeconds: 3
periodSeconds: 20
readinessProbe:
tcpSocket:
port: {{ .Values.fdbdoclayer.service.port }}
initialDelaySeconds: 3
periodSeconds: 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.networkPolicy.enabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ template "fullname" . }}-fdbdoclayer
labels:
app: {{ template "fullname" . }}-fdbdoclayer
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
podSelector:
matchLabels:
app: {{ template "fullname" . }}-fdbdoclayer
release: {{ .Release.Name }}
ingress:
ports:
port: {{ .Values.fdbdoclayer.service.port }}
protocol: TCP
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "doclayer.fullname" . }}
labels:
app: {{ template "fullname" . }}-fdbdoclayer
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
type: ClusterIP
ports:
- port: {{ .Values.fdbdoclayer.service.port }}
targetPort: {{ .Values.fdbdoclayer.service.port }}
protocol: TCP
name: {{ .Values.fdbdoclayer.service.name }}
selector:
app: {{ template "fullname" . }}-fdbdoclayer
release: {{ .Release.Name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "fullname" . }}-fdbserver
labels:
app: {{ template "fullname" . }}-fdbserver
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: {{ .Values.fdbserver.replicas }}
selector:
matchLabels:
app: {{ template "fullname" . }}-fdbserver
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "fullname" . }}-fdbserver
release: {{ .Release.Name }}
spec:
{{- with .Values.securityContext }}
securityContext:
{{ toYaml . | indent 8 }}
{{- end }}
containers:
- name: fdbserver
image: {{ template "fdb.image" .Values.fdbserver.image }}
env:
- name: FDB_COORDINATOR
value: {{ template "fullname" . }}-fdbserver.monocular.svc.cluster.local
- name: CLUSTER_ID
value: chartdb:erlklkg
ports:
- containerPort: {{ .Values.fdbserver.service.port }}
livenessProbe:
tcpSocket:
port: {{ .Values.fdbserver.service.port }}
initialDelaySeconds: 3
periodSeconds: 20
readinessProbe:
tcpSocket:
port: {{ .Values.fdbserver.service.port }}
initialDelaySeconds: 3
periodSeconds: 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.networkPolicy.enabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ template "fullname" . }}-fdbserver
labels:
app: {{ template "fullname" . }}-fdbserver
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
podSelector:
matchLabels:
app: {{ template "fullname" . }}-fdbserver
release: {{ .Release.Name }}
ingress:
- ports:
- port: {{ .Values.fdbserver.service.port }}
protocol: TCP
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}-fdbserver
labels:
app: {{ template "fullname" . }}-fdbserver
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
type: ClusterIP
ports:
- port: {{ .Values.fdbserver.service.port }}
targetPort: {{ .Values.fdbserver.service.port }}
protocol: TCP
name: {{ .Values.fdbserver.service.name }}
selector:
app: {{ template "fullname" . }}-fdbserver
release: {{ .Release.Name }}
26 changes: 26 additions & 0 deletions chart/monocular/local-helm/fdbdoclayer/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
fdbserver:
replicas: 1
image:
registry: docker.io
repository: kreinecke/foundationdb
tag: 6.0.18-k8s
pullPolicy: Always
service:
name: fdbserver
port: 4500

fdbdoclayer:
replicas: 1
image:
registry: docker.io
repository: kreinecke/fdb-document-layer
tag: 1.6.3-k8s
pullPolicy: Always
service:
name: fdbdoclayer
port: 27016

# Installs networkPolicy for the services. This will allow communication betweeen the services in
# environments where the default policy is deny
networkPolicy:
enabled: false
7 changes: 5 additions & 2 deletions chart/monocular/requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ dependencies:
- name: mongodb
repository: https://kubernetes-charts.storage.googleapis.com
version: 7.2.10
digest: sha256:314dea8ef057af9180610aeec4be4491ab6e8779be41076411a93360e92a3f40
generated: "2019-09-28T21:49:40.948575+01:00"
- name: fdbdoclayer
repository: file://./local-helm/fdbdoclayer/
version: 0.1.0
digest: sha256:1d62539fb9fab5c5d069d9d33e456ff46286c2d8630f05018683df180f8b31cd
generated: "2019-12-03T08:55:49.128951283Z"
4 changes: 4 additions & 0 deletions chart/monocular/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ dependencies:
version: 7.2.10
repository: https://kubernetes-charts.storage.googleapis.com
condition: mongodb.enabled
- name: fdbdoclayer
version: 0.1.0
repository: file://./local-helm/fdbdoclayer/
condition: fdbserver.enabled
20 changes: 18 additions & 2 deletions chart/monocular/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ Render image reference
{{ .registry }}/{{ .repository }}:{{ .tag }}
{{- end -}}

{{/*
Create a default fully qualified app name for the document layer.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "doclayer.fullname" -}}
{{- printf "%s-%s" .Release.Name "fdbdoclayer" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Sync job pod template
*/}}
Expand All @@ -48,25 +56,33 @@ spec:
image: {{ template "monocular.image" $global.Values.sync.image }}
args:
- sync
- --debug={{ default false $global.Values.debug }}
- --user-agent-comment=monocular/{{ $global.Chart.AppVersion }}
{{- if and $global.Values.global.mongoUrl (not $global.Values.mongodb.enabled) }}
{{- if and $global.Values.global.mongoUrl (and (not $global.Values.mongodb.enabled) (not $global.Values.fdbserver.enabled))}}
- --mongo-url={{ $global.Values.global.mongoUrl }}
- --db-type=mongodb
{{- else if $global.Values.fdbserver.enabled}}
- --doclayer-url=mongodb://{{ template "doclayer.fullname" $global }}:27016
- --db-type=fdb
{{- else }}
- --mongo-url={{ template "mongodb.fullname" $global }}
- --mongo-user=root
- --db-type=mongodb
{{- end }}
- {{ $repo.name }}
- {{ $repo.url }}
command:
- /chart-repo
{{- if $global.Values.mongodb.enabled }}
{{- if or $global.Values.mongodb.enabled $global.Values.fdbserver.enabled}}
env:
- name: HTTP_PROXY
value: {{ $global.Values.sync.httpProxy }}
- name: HTTPS_PROXY
value: {{ $global.Values.sync.httpsProxy }}
- name: NO_PROXY
value: {{ $global.Values.sync.noProxy }}
{{- end }}
{{- if not $global.Values.fdbserver.enabled }}
- name: MONGO_PASSWORD
valueFrom:
secretKeyRef:
Expand Down
16 changes: 12 additions & 4 deletions chart/monocular/templates/chartsvc-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,25 @@ spec:
command:
- /chartsvc
args:
{{- if and .Values.global.mongoUrl (not .Values.mongodb.enabled) }}
- --debug={{ default false .Values.dbDebug }}
{{- if and .Values.global.mongoUrl (and (not .Values.mongodb.enabled) (not .Values.fdbserver.enabled))}}
- --mongo-url={{ .Values.global.mongoUrl }}
- --db-type=mongodb
{{- else if .Values.fdbserver.enabled}}
- --doclayer-url=mongodb://{{ template "doclayer.fullname" . }}:27016
- --db-type=fdb
{{- else }}
- --mongo-user=root
- --mongo-url={{ template "mongodb.fullname" . }}
env:
- --mongo-user=root
- --db-type=mongodb
{{- end }}
{{- if not .Values.fdbserver.enabled }}
env:
- name: MONGO_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "mongodb.fullname" . }}
key: mongodb-root-password
name: {{ template "mongodb.fullname" . }}
{{- end }}
ports:
- name: http
Expand Down
Loading