Skip to content

Commit

Permalink
Voltdb helm chart (#6)
Browse files Browse the repository at this point in the history
* feat: voltdb helm chart
* chore: add values.yaml for ci
* fix: license key in configmap
* chore: address pr review comments
* feat: allow custom voltdb configuration
* chore: update ci values
* fix: children and indentation in deployment.xml
---------

Signed-off-by: Akshay Patidar <akshaypatidar1999@gmail.com>
  • Loading branch information
akshaypatidar1999 authored Aug 11, 2023
1 parent 58539bb commit f3ffb7c
Show file tree
Hide file tree
Showing 16 changed files with 1,141 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/voltdb/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
6 changes: 6 additions & 0 deletions charts/voltdb/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
version: 1.17.1
digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690
generated: "2023-08-09T19:27:57.595439+05:30"
16 changes: 16 additions & 0 deletions charts/voltdb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v2
name: voltdb
description: Voltdb helm chart
version: 0.1.0
appVersion: "9.2.1"
keywords:
- voltdb
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
tags:
- bitnami-common
version: 1.x.x
maintainers:
- name: Dream11
url: https://www.dream11.com/
170 changes: 170 additions & 0 deletions charts/voltdb/README.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions charts/voltdb/ci/cluster-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
voltdb:
deployment:
cluster:
kfactor: 2
hostcount: 3
replicaCount: 3
33 changes: 33 additions & 0 deletions charts/voltdb/ci/configuration-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
voltdb:
deployment:
import:
configuration:
- type: kafka
enabled: false
format: csv
version: 10
properties:
- name: topics
value: employees
- name: procedure
value: EMPLOYEE.insert
- name: brokers
value: kafkasvr:9092

export:
configuration:
- type: kafka
enabled: false
target: target
properties:
- name: bootstrap.servers
value: kafkasvr:9092
- name: topic.prefix
value: employees
- name: skipinternals
value: true
- name: acks
value: 1

snapshot:
enabled: true
2 changes: 2 additions & 0 deletions charts/voltdb/ci/version-8-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
image:
tag: 8.4.1
9 changes: 9 additions & 0 deletions charts/voltdb/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}

** Please be patient while the chart is being deployed **

Check the cluster status by running:

kubectl exec -it --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app.kubernetes.io/name={{ include "common.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }} -o jsonpath='{.items[0].metadata.name}') -- sqlcmd
124 changes: 124 additions & 0 deletions charts/voltdb/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{{/* vim: set filetype=mustache: */}}

{{/*
Return the proper voltdb image name
*/}}
{{- define "voltdb.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "voltdb.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Return the voltdb configuration configmap
*/}}
{{- define "voltdb.configmapName" -}}
{{- printf "%s-configuration" (include "common.names.fullname" .) -}}
{{- end -}}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "voltdb.imagePullSecrets" -}}
{{ include "common.images.pullSecrets" (dict "images" (list .Values.image) "global" .Values.global) }}
{{- end -}}

{{/*
Return the list of voltdb hosts
*/}}
{{- define "voltdb.hosts" -}}
{{- $hosts := list }}
{{- $fullname := include "common.names.fullname" . }}
{{- $releaseNamespace := .Release.Namespace }}
{{- $clusterDomain := .Values.clusterDomain }}
{{- $hostCount := .Values.replicaCount | int }}
{{- range $e, $i := until $hostCount }}
{{- $hosts = append $hosts (printf "%s-%d.%s-headless.%s.svc.%s" $fullname $i $fullname $releaseNamespace $clusterDomain) }}
{{- end }}
{{- join "," $hosts }}
{{- end -}}

{{/*
Return path to deployment.xml
*/}}
{{- define "voltdb.configPath" -}}
{{- printf "%s/deployment.xml" .Values.voltdb.directorySpec -}}
{{- end -}}

{{/*
Return path to license.xml
*/}}
{{- define "voltdb.licensePath" -}}
{{- printf "%s/license.xml" .Values.voltdb.directorySpec -}}
{{- end -}}

{{/*
Return path to voltdbroot
*/}}
{{- define "voltdb.rootPath" -}}
{{- printf "%s/voltdbroot" .Values.voltdb.directorySpec -}}
{{- end -}}

{{/*
Return terminal paths in a dictionary
Usage: {{ include "util.terminalPaths" dict }}
*/}}
{{- define "util.terminalPaths" -}}
{{- $terminalPaths := list }}
{{- range $k, $v := . }}
{{- if not (or (kindIs "map" $v) (kindIs "slice" $v)) -}}
{{- $terminalPaths = append $terminalPaths (printf "%s=\"%v\"" $k $v) }}
{{- end }}
{{- end }}
{{- join " " $terminalPaths }}
{{- end -}}

{{/*
Return if a dictionary is nested
Usage: {{ include "util.isNested" dict }}
*/}}
{{- define "util.isNested" -}}
{{- $isNested := false -}}
{{- range $k, $v := . }}
{{- if or (kindIs "map" $v) (kindIs "slice" $v) -}}
{{- $isNested = true -}}
{{- end }}
{{- end }}
{{- $isNested }}
{{- end -}}

{{/*
Return voltdb configuration
*/}}
{{- define "voltdb.configuration" -}}
{{- $currentIndentation:= ($.indentation | default "") -}}
{{- range $k, $v := .object }}
{{- if or (eq "import" $k) (eq "export" $k) -}}
{{- else if kindIs "map" $v -}}

{{- if eq "false" (include "util.isNested" $v) -}}
{{- printf "%s<%s %s/>\n" $currentIndentation $k (include "util.terminalPaths" $v ) }}
{{- else -}}
{{- printf "%s<%s %s>\n" $currentIndentation $k (include "util.terminalPaths" $v ) }}
{{- printf "%s" (include "voltdb.configuration" (dict "object" $v "indentation" (printf "%s " $currentIndentation))) }}
{{- printf "%s</%s>\n" $currentIndentation $k -}}
{{- end -}}
{{- else if kindIs "slice" $v -}}
{{- range $dict := $v }}
{{- printf "%s" (include "voltdb.configuration" (dict "object" (dict $k $dict) "indentation" (printf "%s" $currentIndentation))) }}
{{- end }}
{{- else -}}
{{- end -}}
{{- end }}
{{- end -}}


48 changes: 48 additions & 0 deletions charts/voltdb/templates/configmap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "voltdb.configmapName" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
data:
deployment.xml: |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<deployment>
<paths>
<voltdbroot path="{{ include "voltdb.rootPath" . }}"/>
<snapshots path="{{ include "voltdb.rootPath" . }}/snapshots"/>
<exportoverflow path="{{ include "voltdb.rootPath" . }}/export_overflow"/>
<droverflow path="{{ include "voltdb.rootPath" . }}/dr_overflow"/>
<commandlog path="{{ include "voltdb.rootPath" . }}/command_log"/>
<commandlogsnapshot path="{{ include "voltdb.rootPath" . }}/command_log_snapshot"/>
<largequeryswap path="{{ include "voltdb.rootPath" . }}/large_query_swap"/>
</paths>
{{- include "voltdb.configuration" (dict "object" .Values.voltdb.deployment) | nindent 6 }}
<import>
{{- range .Values.voltdb.deployment.import.configuration }}
<configuration type="{{ .type }}" enabled="{{ .enabled }}" format="{{ .format }}" version="{{ .version }}">
{{- range .properties }}
<property name="{{ .name }}">{{ .value }}</property>
{{- end }}
</configuration>
{{- end }}
</import>
<export>
{{- range .Values.voltdb.deployment.export.configuration }}
<configuration type="{{ .type }}" enabled="{{ .enabled }}" target="{{ .target }}">
{{- range .properties }}
<property name="{{ .name }}">{{ .value }}</property>
{{- end }}
</configuration>
{{- end }}
</export>
</deployment>
{{- if .Values.voltdb.license }}
license.xml: |
{{ .Values.voltdb.license | indent 4 }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/voltdb/templates/extra-list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{- range .Values.extraDeploy }}
---
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
{{- end }}
37 changes: 37 additions & 0 deletions charts/voltdb/templates/headless-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-headless" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.service.headless.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.service.headless.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.service.headless.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- end }}

spec:
clusterIP: None
type: ClusterIP
publishNotReadyAddresses: true
ports:
- port: 21212
name: client
- port: 21211
name: admin
- port: 8080
name: web
- port: 3021
name: internal
- port: 5555
name: replication
- port: 7181
name: zookeeper
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
51 changes: 51 additions & 0 deletions charts/voltdb/templates/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.service.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }}
loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }}
{{- end }}
{{- if and .Values.service.clusterIP (eq .Values.service.type "ClusterIP") }}
clusterIP: {{ .Values.service.clusterIP }}
{{- end }}
{{- if .Values.service.sessionAffinity }}
sessionAffinity: {{ .Values.service.sessionAffinity }}
{{- end }}
{{- if .Values.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
{{- end }}
ports:
- name: client
port: {{ .Values.service.ports.client }}
targetPort: client
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.client)) }}
nodePort: {{ .Values.service.nodePorts.client }}
{{- else if eq .Values.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
19 changes: 19 additions & 0 deletions charts/voltdb/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "voltdb.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.serviceAccount.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.serviceAccount.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- end }}
Loading

0 comments on commit f3ffb7c

Please sign in to comment.