Skip to content

Commit be35433

Browse files
Datastore charts (#12)
* opentsdb helm chart * surrealdb helm chart * updated surrealdb to cronjob and service * add charts dgrapgh and index helm chart * fix dgraph chart description --------- Co-authored-by: jaya-kops <jaya.ryali@kops.dev>
1 parent 6fecf89 commit be35433

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2165
-20
lines changed

charts/cron-job/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
appVersion: "1.0"
33
description: Helm chart creates a cron-job, service, alerts along with serviceMonitor etc
44
name: cron-job
5-
version: 0.0.5
5+
version: 0.0.6
66
icon: "https://zop.dev/logo.png"
77
maintainers:
88
- name: ZopDev

charts/cron-job/templates/cronJob.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@ spec:
9999
name: {{ $k.datastore }}-redis-service-configmap
100100
{{- end }}
101101
{{- end }}
102+
{{- if and .Values.datastores .Values.datastores.surrealdb }}
103+
{{- range $i, $k := .Values.datastores.surrealdb }}
104+
- configMapRef:
105+
name: {{ $k.datastore }}-surrealdb-service-configmap
106+
{{- end }}
107+
{{- end }}
108+
{{- if and .Values.datastores .Values.datastores.opentsdb }}
109+
{{- range $i, $k := .Values.datastores.opentsdb }}
110+
- configMapRef:
111+
name: {{ $k.datastore }}-opentsdb-configmap
112+
{{- end }}
113+
{{- end }}
114+
{{- if and .Values.datastores .Values.datastores.dgraph }}
115+
{{- range $i, $k := .Values.datastores.dgraph }}
116+
- configMapRef:
117+
name: {{ $k.datastore }}-dgraph-configmap
118+
{{- end }}
119+
{{- end }}
102120
env:
103121
{{- range $k,$v := .Values.env }}
104122
{{- if ne (toString $v) ""}}

charts/cron-job/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ alerts:
5252
cronjobFailedThreshold: 0
5353
datastores:
5454
mysql:
55-
redis:
55+
redis:
56+
surrealdb:

charts/dgraph/Chart.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
appVersion: "1.0"
3+
description: Helm chart for deploying dgraph datastore
4+
name: dgraph
5+
version: 0.0.1
6+
icon: "https://zop.dev/logo.png"
7+
maintainers:
8+
- name: ZopDev
9+
url: zop.dev

charts/dgraph/templates/_helpers.tpl

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "dgraph.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 24 -}}
7+
{{- end -}}
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
*/}}
12+
{{- define "dgraph.fullname" -}}
13+
{{- if .Values.fullnameOverride -}}
14+
{{- .Values.fullnameOverride | trunc 24 | trimSuffix "-" -}}
15+
{{- else -}}
16+
{{- $name := default .Chart.Name .Values.nameOverride -}}
17+
{{- printf "%s-%s" .Release.Name $name | trunc 24 -}}
18+
{{- end -}}
19+
{{- end -}}
20+
{{/*
21+
Create chart name and version as used by the chart label.
22+
*/}}
23+
{{- define "dgraph.chart" -}}
24+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create a default fully qualified data name.
29+
*/}}
30+
{{- define "dgraph.zero.fullname" -}}
31+
{{ template "dgraph.fullname" . }}-{{ .Values.zero.name }}
32+
{{- end -}}
33+
34+
{{/*
35+
Create a default fully qualified data name.
36+
*/}}
37+
{{- define "dgraph.backups.fullname" -}}
38+
{{ template "dgraph.fullname" . }}-{{ .Values.backups.name }}
39+
{{- end -}}
40+
41+
{{/*
42+
Create a semVer/calVer version from image.tag so that it can be safely use in
43+
version comparisions used to toggle features or behavior.
44+
*/}}
45+
{{- define "dgraph.version" -}}
46+
{{- $safeVersion := .Values.image.tag -}}
47+
{{- if (eq $safeVersion "shuri") -}}
48+
{{- $safeVersion = "v20.07.1" -}}
49+
{{- else if (regexMatch "^[^v].*" $safeVersion) -}}
50+
{{- $safeVersion = "v50.0.0" -}}
51+
{{- end -}}
52+
{{- printf "%s" $safeVersion -}}
53+
{{- end -}}
54+
55+
56+
{{/*
57+
Return the backups image name
58+
*/}}
59+
{{- define "dgraph.backups.image" -}}
60+
{{- $registryName := .Values.backups.image.registry -}}
61+
{{- $repositoryName := .Values.backups.image.repository -}}
62+
{{- $tag := .Values.backups.image.tag | toString -}}
63+
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
64+
{{- end -}}
65+
66+
{{/*
67+
Return the ratel image name
68+
*/}}
69+
{{- define "dgraph.ratel.image" -}}
70+
{{- $registryName := .Values.ratel.image.registry -}}
71+
{{- $repositoryName := .Values.ratel.image.repository -}}
72+
{{- $tag := .Values.ratel.image.tag | toString -}}
73+
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
74+
{{- end -}}
75+
76+
77+
{{/*
78+
Return empty string if minio keys are not defined
79+
*/}}
80+
{{- define "dgraph.backups.keys.minio.enabled" -}}
81+
{{- $minioEnabled := "" -}}
82+
{{- $backupsEnabled := or .Values.backups.full.enabled .Values.backups.incremental.enabled }}
83+
{{- if $backupsEnabled -}}
84+
{{- if .Values.backups.keys -}}
85+
{{- if .Values.backups.keys.minio -}}
86+
{{- if and .Values.backups.keys.minio.access .Values.backups.keys.minio.secret -}}
87+
{{- $minioEnabled = true -}}
88+
{{- end -}}
89+
{{- end -}}
90+
{{- end -}}
91+
{{- end -}}
92+
{{- printf "%s" $minioEnabled -}}
93+
{{- end -}}
94+
95+
{{/*
96+
Return empty string if s3 keys are not defined
97+
*/}}
98+
{{- define "dgraph.backups.keys.s3.enabled" -}}
99+
{{- $s3Enabled := "" -}}
100+
{{- $backupsEnabled := or .Values.backups.full.enabled .Values.backups.incremental.enabled }}
101+
{{- if $backupsEnabled -}}
102+
{{- if .Values.backups.keys -}}
103+
{{- if .Values.backups.keys.s3 -}}
104+
{{- if and .Values.backups.keys.s3.access .Values.backups.keys.s3.secret -}}
105+
{{- $s3Enabled = true -}}
106+
{{- end -}}
107+
{{- end -}}
108+
{{- end -}}
109+
{{- end -}}
110+
{{- printf "%s" $s3Enabled -}}
111+
{{- end -}}
112+
113+
{{/*
114+
Return the initContainers image name
115+
*/}}
116+
{{- define "dgraph.initContainers.init.image" -}}
117+
{{- $registryName := .Values.alpha.initContainers.init.image.registry -}}
118+
{{- $repositoryName := .Values.alpha.initContainers.init.image.repository -}}
119+
{{- $tag := .Values.alpha.initContainers.init.image.tag | toString -}}
120+
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
121+
{{- end -}}
122+
123+
{{/*
124+
Return the proper image name (for the metrics image)
125+
*/}}
126+
{{- define "dgraph.image" -}}
127+
{{- $registryName := .Values.image.registry -}}
128+
{{- $repositoryName := .Values.image.repository -}}
129+
{{- $tag := .Values.image.tag | toString -}}
130+
{{/*
131+
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
132+
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
133+
Also, we can't use a single if because lazy evaluation is not an option
134+
*/}}
135+
{{- if .Values.global }}
136+
{{- if .Values.global.imageRegistry }}
137+
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
138+
{{- else -}}
139+
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
140+
{{- end -}}
141+
{{- else -}}
142+
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
143+
{{- end -}}
144+
{{- end -}}
145+
146+
{{/*
147+
Return the proper Docker Image Registry Secret Names
148+
*/}}
149+
{{- define "dgraph.imagePullSecrets" -}}
150+
{{/*
151+
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
152+
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
153+
Also, we can't use a single if because lazy evaluation is not an option
154+
*/}}
155+
{{- if .Values.global }}
156+
{{- if .Values.global.imagePullSecrets }}
157+
imagePullSecrets:
158+
{{- range .Values.global.imagePullSecrets }}
159+
- name: {{ . }}
160+
{{- end }}
161+
{{- else if .Values.image.pullSecrets }}
162+
imagePullSecrets:
163+
{{- range .Values.image.pullSecrets }}
164+
- name: {{ . }}
165+
{{- end }}
166+
{{- end -}}
167+
{{- else if .Values.image.pullSecrets }}
168+
imagePullSecrets:
169+
{{- range .Values.image.pullSecrets }}
170+
- name: {{ . }}
171+
{{- end }}
172+
{{- end -}}
173+
{{- end -}}
174+
175+
{{/*
176+
Create a default fully qualified alpha name.
177+
*/}}
178+
{{- define "dgraph.alpha.fullname" -}}
179+
{{ template "dgraph.fullname" . }}-{{ .Values.alpha.name }}
180+
{{- end -}}
181+
182+
{{/*
183+
Create the name of the service account to use
184+
*/}}
185+
{{- define "dgraph.serviceAccountName" -}}
186+
{{- if .Values.serviceAccount.create }}
187+
{{- default (include "dgraph.fullname" .) .Values.serviceAccount.name }}
188+
{{- else }}
189+
{{- default "default" .Values.serviceAccount.name }}
190+
{{- end }}
191+
{{- end }}
192+
193+
{{/*
194+
Create a default fully qualified ratel name.
195+
*/}}
196+
{{- define "dgraph.ratel.fullname" -}}
197+
{{ template "dgraph.fullname" . }}-{{ .Values.ratel.name }}
198+
{{- end -}}
199+
200+
{{/*
201+
Allow overriding namespace
202+
*/}}
203+
{{- define "dgraph.namespace" -}}
204+
{{- default .Release.Namespace .Values.namespaceOverride -}}
205+
{{- end -}}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{ if .Values.alpha.configFile }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ template "dgraph.alpha.fullname" . }}-config
6+
namespace: {{ include "dgraph.namespace" . }}
7+
labels:
8+
app: {{ template "dgraph.name" . }}
9+
chart: {{ template "dgraph.chart" . }}
10+
component: {{ .Values.alpha.name }}
11+
release: {{ .Release.Name }}
12+
heritage: {{ .Release.Service }}
13+
data:
14+
{{- with .Values.alpha.configFile }}
15+
{{- toYaml . | trimSuffix "\n" | nindent 2 }}
16+
{{- end }}
17+
{{ end }}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{{- /* Generate ingress path */}}
2+
{{- define "path" -}}
3+
{{- $path := "/" -}}
4+
{{- if .Values.global.ingress.ingressClassName -}}
5+
{{- if eq .Values.global.ingress.ingressClassName "gce" "alb" "nsx" }}
6+
{{- $path = "/*" -}}
7+
{{- else }}
8+
{{- $path = "/" -}}
9+
{{- end }}
10+
{{- else if index $.Values.global.ingress "annotations" -}}
11+
{{- if eq (index $.Values.global.ingress.annotations "kubernetes.io/ingress.class" | default "") "gce" "alb" "nsx" }}
12+
{{- $path = "/*" -}}
13+
{{- else }}
14+
{{- $path = "/" -}}
15+
{{- end }}
16+
{{- end -}}
17+
{{- printf "%s" $path -}}
18+
{{- end -}}
19+
{{- /* Alpha ingress resource */}}
20+
{{- if and (eq .Values.alpha.ingress.enabled true) (eq .Values.global.ingress.enabled false) -}}
21+
apiVersion: networking.k8s.io/v1
22+
kind: Ingress
23+
metadata:
24+
name: {{ template "dgraph.alpha.fullname" . }}-ingress
25+
namespace: {{ include "dgraph.namespace" . }}
26+
labels:
27+
app: {{ template "dgraph.name" . }}
28+
chart: {{ template "dgraph.chart" . }}
29+
component: {{ .Values.alpha.name }}
30+
release: {{ .Release.Name }}
31+
heritage: {{ .Release.Service }}
32+
{{- with .Values.alpha.ingress.annotations }}
33+
annotations:
34+
{{- toYaml . | trimSuffix "\n" | nindent 4 }}
35+
{{- end }}
36+
spec:
37+
{{- if .Values.alpha.ingress.ingressClassName }}
38+
ingressClassName: {{ .Values.alpha.ingress.ingressClassName }}
39+
{{- end }}
40+
{{- if .Values.alpha.ingress.tls }}
41+
tls:
42+
{{- range .Values.alpha.ingress.tls }}
43+
- hosts:
44+
{{- range .hosts }}
45+
- {{ . | quote }}
46+
{{- end }}
47+
secretName: {{ .secretName }}
48+
{{- end }}
49+
{{- end }}
50+
rules:
51+
- http:
52+
paths:
53+
- backend:
54+
service:
55+
name: {{ template "dgraph.alpha.fullname" . }}
56+
port:
57+
number: 8080
58+
pathType: ImplementationSpecific
59+
path: {{ template "path" . }}
60+
{{- if .Values.alpha.ingress.hostname }}
61+
host: {{ .Values.alpha.ingress.hostname }}
62+
{{- end }}
63+
{{- end }}
64+
{{- /* Alpha grpc ingress resource */}}
65+
{{- if and (eq .Values.alpha.ingress_grpc.enabled true) (eq .Values.global.ingress_grpc.enabled false) -}}
66+
---
67+
apiVersion: networking.k8s.io/v1
68+
kind: Ingress
69+
metadata:
70+
name: {{ template "dgraph.alpha.fullname" . }}-ingress-grpc
71+
namespace: {{ include "dgraph.namespace" . }}
72+
labels:
73+
app: {{ template "dgraph.name" . }}
74+
chart: {{ template "dgraph.chart" . }}
75+
component: {{ .Values.alpha.name }}
76+
release: {{ .Release.Name }}
77+
heritage: {{ .Release.Service }}
78+
{{- with .Values.alpha.ingress_grpc.annotations }}
79+
annotations:
80+
{{- toYaml . | trimSuffix "\n" | nindent 4 }}
81+
{{- end }}
82+
spec:
83+
{{- if .Values.alpha.ingress_grpc.ingressClassName }}
84+
ingressClassName: {{ .Values.alpha.ingress_grpc.ingressClassName }}
85+
{{- end }}
86+
{{- if .Values.alpha.ingress_grpc.tls }}
87+
tls:
88+
{{- range .Values.alpha.ingress_grpc.tls }}
89+
- hosts:
90+
{{- range .hosts }}
91+
- {{ . | quote }}
92+
{{- end }}
93+
secretName: {{ .secretName }}
94+
{{- end }}
95+
{{- end }}
96+
rules:
97+
- http:
98+
paths:
99+
- backend:
100+
service:
101+
name: {{ template "dgraph.alpha.fullname" . }}
102+
port:
103+
number: 9080
104+
pathType: ImplementationSpecific
105+
path: {{ template "path" . }}
106+
{{- if .Values.alpha.ingress_grpc.hostname }}
107+
host: {{ .Values.alpha.ingress_grpc.hostname }}
108+
{{- end }}
109+
{{- end }}

0 commit comments

Comments
 (0)