Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
75 changes: 75 additions & 0 deletions k8s/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,78 @@ Create a list of pod names based the number of replica.
{{- end }}
{{- join "," $names -}}
{{- end }}

{{/*
Preparing a list of plugin ports to build plugin configurations.
*/}}
{{- define "_arcadedb.plugin.ports" -}}
{{- range $plugin, $config := .Values.arcadedb.plugins -}}
{{- if $config.enabled }}
{{- $port := int 0}}
{{- if eq $plugin "gremlin" }}
{{- $port = default 8082 $config.port }}
{{- else if eq $plugin "postgres" }}
{{- $port = default 5432 $config.port}}
Comment thread
carlos-rodrigues-8x8 marked this conversation as resolved.
Outdated
{{- else if eq $plugin "mongo" }}
{{- $port = default 27017 $config.port }}
{{- else if eq $plugin "redis" }}
{{- $port = default 6379 }}
Comment thread
carlos-rodrigues-8x8 marked this conversation as resolved.
Outdated
{{- else if eq $plugin "prometheus" }}
{{/*
Prometheus does not use a port in the plugin configuration. It is accessible from /prometheus endpoint.
*/}}
{{- $port = -1 }}
{{- else }}
{{- if not $config.port }}
{{- fail (printf "Custom plugin '%s' has no port specified." $plugin) -}}
{{- end }}
{{- end }}
{{ $plugin }}:
port: {{ $port }}
class: {{ default "" $config.class }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create a comma separated list of plugins to be enabled in arcadedb
*/}}
{{- define "arcadedb.plugin.parameters" -}}
{{- $plugins := list -}}
{{- range $plugin, $config := (include "_arcadedb.plugin.ports" . | fromYaml) }}
{{- if eq $plugin "gremlin" }}
{{- $plugins = append $plugins "GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin" }}
{{- else if eq $plugin "postgres" }}
{{- $plugins = append $plugins "Postgres:com.arcadedb.postgres.PostgresProtocolPlugin" }}
- {{- printf " -Darcadedb.postgres.port=%d" (int $config.port) -}}
{{- else if eq $plugin "mongo" }}
{{- $plugins = append $plugins "MongoDB:com.arcadedb.mongo.MongoDBProtocolPlugin" }}
- {{- printf " -Darcadedb.mongo.port=%d" (int $config.port) -}}
{{- else if eq $plugin "redis" }}
{{- $plugins = append $plugins "Redis:com.arcadedb.redis.RedisProtocolPlugin" }}
- {{- printf " -Darcadedb.redis.port=%d" (int $config.port) -}}
{{- else if eq $plugin "prometheus" }}
{{- $plugins = append $plugins "Prometheus:com.arcadedb.metrics.prometheus.PrometheusMetricsPlugin" }}
{{- else }}
{{- $plugins = append $plugins (printf "%s:%s" $plugin $config.class) }}
{{- end }}
{{- end }}
{{- if gt (len $plugins) 0 }}
- {{- printf " -Darcadedb.server.plugins=%s" (join "," $plugins) -}}
{{- end -}}
{{- end -}}
Comment thread
carlos-rodrigues-8x8 marked this conversation as resolved.

{{/*
Create service configuration for the enabled plugins
*/}}
{{- define "arcadedb.plugin.service" -}}
{{- $plugins := (include "_arcadedb.plugin.ports" . | fromYaml) }}
{{- range $plugin, $config := $plugins }}
{{- if (gt (int $config.port) 0) }}
- port: {{ $config.port }}
targetPort: {{ $config.port }}
protocol: TCP
name: {{ $plugin }}-port
{{- end -}}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions k8s/helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ spec:
targetPort: rpc
protocol: TCP
name: rpc
{{- include "arcadedb.plugin.service" . | nindent 4 }}
selector:
{{- include "arcadedb.selectorLabels" . | nindent 4 }}
1 change: 1 addition & 0 deletions k8s/helm/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ spec:
{{- with .Values.arcadedb.extraCommands }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- include "arcadedb.plugin.parameters" . | nindent 12 }}
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
Expand Down
34 changes: 34 additions & 0 deletions k8s/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,40 @@ arcadedb:
## @param arcadedb.credentials.rootPassword.secret.key Key to use in existing secret
key: null

## @section arcadedb.plugins in this section you can enable and configure the plugins available in ArcadeDB.
plugins: {}
# gremlin:
## @param arcadedb.plugins.gremlin.enabled Enable Gremlin plugin
# enabled: true
## @param arcadedb.plugins.gremlin.port Port for Gremlin HTTP service
# port: 8082
# postgres:
## @param arcadedb.plugins.postgres.enabled Enable Postgres plugin
# enabled: true
## @param arcadedb.plugins.postgres.port Port for Postgres service
# port: 5432
# mongo:
## @param arcadedb.plugins.mongo.enabled Enable Mongo plugin
# enabled: false
## @param arcadedb.plugins.mongo.port Port for Mongo service
# port: 27017
# redis:
## @param arcadedb.plugins.redis.enabled Enable Redis plugin
# enabled: false
## @param arcadedb.plugins.redis.port Port for Redis service
# port: 6379
# prometheus:
## @param arcadedb.plugins.prometheus.enabled Enable Prometheus plugin
# enabled: false
## The following plugin is commented out as they are an example how configure a custom plugin.
## custom:
## @param arcadedb.plugins.custom.enabled Enable custom plugin
## enabled: false
## @param arcadedb.plugins.custom.port Port for custom service
## port: 1234
## @param arcadedb.plugins.custom.class Class name for custom plugin
## class: com.example.CustomPlugin
Comment thread
carlos-rodrigues-8x8 marked this conversation as resolved.
Outdated

## @section image
## This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
image:
Expand Down
Loading