diff --git a/incubator/orientdb/.helmignore b/incubator/orientdb/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/incubator/orientdb/.helmignore @@ -0,0 +1,21 @@ +# 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 diff --git a/incubator/orientdb/Chart.yaml b/incubator/orientdb/Chart.yaml new file mode 100644 index 0000000000..e900c97e46 --- /dev/null +++ b/incubator/orientdb/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +name: orientdb +home: https://orientdb.com +description: A Helm chart for Distributed OrientDB +version: 0.1.2 +icon: https://orientdb.com/wp-content/uploads/cropped-favicon-orientdb-192x192.png +maintainers: + - name: b-yond-infinite-network + email: sommeliers@b-yond.com + url: https://www.b-yond.com + - name: soujiro32167 + email: eli.kasik@b-yond.com +appVersion: 3.0.13 diff --git a/incubator/orientdb/README.md b/incubator/orientdb/README.md new file mode 100644 index 0000000000..3c310144b9 --- /dev/null +++ b/incubator/orientdb/README.md @@ -0,0 +1,40 @@ +# Infinity OrientDB helm chart + +Orient DB helm chart + +## Installation: + +`helm install . --name --namespace --set rootpassword=` + +If rootPassword is not set, a random one will be used. + +## Scaling: + +Get the name of your statefulset: + +`kubectl get statefulsets -n ` + +Then scale it: + +`kubectl scale --replicas=` + +This scaling is possible due to the hazelcast plugin used for node discovery. For more information check the config file under config/hazelcast.xml and at http://docs.hazelcast.org/docs/3.0/manual/html/ch12s02.html + +## Testing: + +`helm test --cleanup --timeout 1000` + +## Accessing the UI + +`kubectl port-forward 2480:2480 -n ` + +Note: POD-NAME is any pod from the statefulset. + +## Editing the hazelcast configuration + +The hazelcast configuration can be edited at runtime by editing the config.yaml file in the templates of the orient. As of right now only the hazelcast file can be edited dynamically + +## Maintainers + +Product Engineering Team (AKA The Sommeliers) @ [B-yond](https://www.b-yond.com) +E: \ No newline at end of file diff --git a/incubator/orientdb/config/default-distributed-db-config.json b/incubator/orientdb/config/default-distributed-db-config.json new file mode 100644 index 0000000000..0481c3076a --- /dev/null +++ b/incubator/orientdb/config/default-distributed-db-config.json @@ -0,0 +1,15 @@ +{ + "autoDeploy": {{ .Values.distributed.autoDeploy }}, + "executionMode": "{{ .Values.distributed.executionMode }}", + "readQuorum": {{ .Values.distributed.readQuorum }}, + "writeQuorum": "{{ .Values.distributed.writeQuorum }}", + "readYourWrites": {{ .Values.distributed.readYourWrites }}, + "newNodeStrategy": "{{ .Values.distributed.newNodeStrategy }}", + "servers": { "*": "master" }, + "clusters": { + "internal": {}, + "*": { + "servers": [""] + } + } +} \ No newline at end of file diff --git a/incubator/orientdb/config/hazelcast.xml b/incubator/orientdb/config/hazelcast.xml new file mode 100644 index 0000000000..323c7d9f5e --- /dev/null +++ b/incubator/orientdb/config/hazelcast.xml @@ -0,0 +1,53 @@ +{{- $self := . -}} +{{- $fullname := include "orientdb.fullname" . -}} + + + + + + {{ .Values.hazelcast.groupName }} + {{ .Values.hazelcast.groupPassword }} + + + false + false + false + false + 5 + 1 + 1 + 1 + 1 + 1 + 5 + 30 + 15 + + + 2434 + + + 235.1.1.1 + 2434 + + + + {{- range $i, $e := until ( .Values.replicaCount | int ) }} + {{ $fullname }}-{{$i}}.{{ $fullname }}-headless.{{ $self.Release.Namespace }}.svc.cluster.local + {{- end }} + + + + + 16 + + \ No newline at end of file diff --git a/incubator/orientdb/templates/NOTES.txt b/incubator/orientdb/templates/NOTES.txt new file mode 100644 index 0000000000..8068712b37 --- /dev/null +++ b/incubator/orientdb/templates/NOTES.txt @@ -0,0 +1,14 @@ +1. Get your 'root' user password by running: + printf $(kubectl get secret --namespace {{ .Release.Namespace }} {{ .Release.Name }}-secret -o jsonpath="{.data.root-password}" | base64 --decode);echo + +2. Access the UI using the following command + kubectl port-forward --namespace {{ .Release.Namespace }} {{ template "orientdb.fullname" . }}-0 2480:2480 + +{{- if .Values.persistence.enabled }} +{{- else }} +################################################################################# +###### WARNING: Persistence is disabled!!! You will lose your data when ##### +###### the Orient Cluster is terminated. ##### +################################################################################# +{{- end }} + diff --git a/incubator/orientdb/templates/_helpers.tpl b/incubator/orientdb/templates/_helpers.tpl new file mode 100644 index 0000000000..0a4361ffc6 --- /dev/null +++ b/incubator/orientdb/templates/_helpers.tpl @@ -0,0 +1,34 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "orientdb.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 "orientdb.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 "orientdb.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/incubator/orientdb/templates/config.yaml b/incubator/orientdb/templates/config.yaml new file mode 100644 index 0000000000..8e60ef702e --- /dev/null +++ b/incubator/orientdb/templates/config.yaml @@ -0,0 +1,11 @@ +{{- $self := . -}} + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "orientdb.fullname" . }}-configmap +data: + {{ range $path, $bytes := .Files.Glob "config/*" }} + {{ base $path }}: |- +{{ tpl ($self.Files.Get $path) $self | indent 4 }} + {{ end }} \ No newline at end of file diff --git a/incubator/orientdb/templates/ingress.yaml b/incubator/orientdb/templates/ingress.yaml new file mode 100644 index 0000000000..44a0f6addb --- /dev/null +++ b/incubator/orientdb/templates/ingress.yaml @@ -0,0 +1,39 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "orientdb.fullname" . -}} +{{- $servicePort := .Values.service.port -}} +{{- $ingressPath := .Values.ingress.path -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "orientdb.fullname" . }} + labels: + app: {{ template "orientdb.name" . }} + chart: {{ template "orientdb.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/incubator/orientdb/templates/secret.yaml b/incubator/orientdb/templates/secret.yaml new file mode 100644 index 0000000000..a9d7100093 --- /dev/null +++ b/incubator/orientdb/templates/secret.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "orientdb.fullname" . }}-secret + labels: + app: {{ template "orientdb.name" . }} + chart: {{ template "orientdb.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + {{ if .Values.rootPassword }} + root-password: {{ .Values.rootPassword | b64enc | quote }} + {{ else }} + root-password: {{ randAlphaNum 10 | b64enc | quote }} + {{ end }} \ No newline at end of file diff --git a/incubator/orientdb/templates/service.yaml b/incubator/orientdb/templates/service.yaml new file mode 100644 index 0000000000..4b03db0f83 --- /dev/null +++ b/incubator/orientdb/templates/service.yaml @@ -0,0 +1,58 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "orientdb.fullname" . }}-headless + labels: + app: {{ template "orientdb.name" . }} + chart: {{ template "orientdb.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.service.orientHttp }} + targetPort: http + name: http + - port: {{ .Values.service.hazelcast }} + targetPort: hazelcast + name: hazelcast + - port: {{ .Values.service.orientBinary }} + targetPort: binary + name: binary + - port: {{ .Values.service.gremlinWebsocket }} + targetPort: gremlin + name: gremlin + + # headless service + clusterIP: None + selector: + app: {{ template "orientdb.name" . }} + release: {{ .Release.Name }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template "orientdb.fullname" . }}-svc + labels: + app: {{ template "orientdb.name" . }} + chart: {{ template "orientdb.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.orientHttp }} + targetPort: http + name: http + - port: {{ .Values.service.hazelcast }} + targetPort: hazelcast + name: hazelcast + - port: {{ .Values.service.orientBinary }} + targetPort: binary + name: binary + - port: {{ .Values.service.gremlinWebsocket }} + targetPort: gremlin + name: gremlin + selector: + app: {{ template "orientdb.name" . }} + release: {{ .Release.Name }} diff --git a/incubator/orientdb/templates/statefulset.yaml b/incubator/orientdb/templates/statefulset.yaml new file mode 100644 index 0000000000..162093ef23 --- /dev/null +++ b/incubator/orientdb/templates/statefulset.yaml @@ -0,0 +1,145 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ template "orientdb.fullname" . }} + labels: + app: {{ template "orientdb.name" . }} + chart: {{ template "orientdb.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "orientdb.name" . }} + release: {{ .Release.Name }} + serviceName: {{ template "orientdb.fullname" . }}-headless + template: + metadata: + labels: + app: {{ template "orientdb.name" . }} + release: {{ .Release.Name }} + spec: + terminationGracePeriodSeconds: 10 + initContainers: + # orientdb-server-config.xml is an executable file while kubernetes mounts + # configmaps as read-only (since 1.94). This is a workaround to mount it as + # configmap first and then copy it over to its final location + - name: "fix-orientdb-server-config" + image: "busybox" + imagePullPolicy: IfNotPresent + command: [ "sh", "-c", "cp /configmap/* /config" ] + volumeMounts: + - name: orientdb-configmap-vol + mountPath: /configmap + - name: orientdb-config-vol + mountPath: /config + + containers: + - name: {{ template "orientdb.name" . }} + image: "{{ .Values.image.name }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.service.orientHttp }} + name: http + - containerPort: {{ .Values.service.hazelcast }} + name: hazelcast + - containerPort: {{ .Values.service.orientBinary }} + name: binary + - containerPort: {{ .Values.service.gremlinWebsocket }} + name: gremlin + env: + - name: ORIENTDB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "orientdb.fullname" . }}-secret + key: root-password + - name: ORIENTDB_NODE_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + {{- if .Values.jvm.memory }} + - name: ORIENTDB_OPTS_MEMORY + value: {{ .Values.jvm.memory | quote }} + {{- end }} + {{- if .Values.jvm.options }} + - name: JAVA_OPTS_SCRIPT + value: {{ .Values.jvm.options | quote }} + {{- end }} + {{- if .Values.jvm.settings }} + - name: ORIENTDB_SETTINGS + value: {{ .Values.jvm.settings | quote }} + {{- end }} + volumeMounts: + {{- if .Values.config.overrideHazelcastConfig }} + - name: orientdb-config-vol + mountPath: /orientdb/config/hazelcast.xml + subPath: hazelcast.xml + {{- end }} + {{- if .Values.config.overrideDistributedDbConfig}} + - name: orientdb-config-vol + mountPath: /orientdb/config/default-distributed-db-config.json + subPath: default-distributed-db-config.json + {{- end }} + {{- if .Values.persistence.enabled }} + - name: storage + mountPath: /orientdb/databases + - name: backup + mountPath: /orientdb/backup + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + tcpSocket: + port: http + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + tcpSocket: + port: http + {{- end }} +{{- if .Values.distributed.enabled }} + command: ["dserver.sh"] +{{- else }} + command: ["server.sh"] +{{- end}} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} + volumes: + - name: orientdb-configmap-vol + configMap: + name: {{ template "orientdb.fullname" . }}-configmap + - name: orientdb-config-vol + emptyDir: {} +{{- if .Values.image.pullSecret }} + imagePullSecrets: + - name: {{ .Values.image.pullSecret }} +{{- end }} +{{- if .Values.persistence.enabled }} + volumeClaimTemplates: + - metadata: + name: storage + spec: + accessModes: {{ .Values.persistence.storage.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.storage.size }} + - metadata: + name: backup + spec: + accessModes: {{ .Values.persistence.backup.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.backup.size }} +{{- end}} \ No newline at end of file diff --git a/incubator/orientdb/templates/tests/simple-crud-test.yaml b/incubator/orientdb/templates/tests/simple-crud-test.yaml new file mode 100644 index 0000000000..20a89ae2b1 --- /dev/null +++ b/incubator/orientdb/templates/tests/simple-crud-test.yaml @@ -0,0 +1,24 @@ +{{- if .Values.testing.enabled }} +apiVersion: v1 +kind: Pod +metadata: + name: {{ template "orientdb.fullname" .}}-simple-crud-test + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: {{ template "orientdb.fullname" .}}-simple-crud-test + image: "{{ .Values.image.name }}:{{ .Values.image.tag }}" + env: + - name: ORIENT_HOST + value: {{ template "orientdb.fullname" . }}-svc + - name: ORIENT_PORT + value: "2480" + - name: ORIENTDB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "orientdb.fullname" .}}-secret + key: root-password + command: ["sh", "-c", "wget --spider http://${ORIENT_HOST}:${ORIENT_PORT}" ] + restartPolicy: Never +{{- end }} \ No newline at end of file diff --git a/incubator/orientdb/values.yaml b/incubator/orientdb/values.yaml new file mode 100644 index 0000000000..3736303355 --- /dev/null +++ b/incubator/orientdb/values.yaml @@ -0,0 +1,80 @@ +replicaCount: 1 + +# random if not set +# rootPassword: root123 + +image: + name: orientdb + tag: 3.0.13 + pullPolicy: IfNotPresent + +# distributed settings for default-distributed-db-config.json +distributed: + enabled: false + autoDeploy: true + executionMode: undefined + readQuorum: 1 + writeQuorum: majority + newNodeStrategy: static + readYourWrites: true + +service: + type: ClusterIP + orientHttp: 2480 + hazelcast: 2434 + orientBinary: 2424 + gremlinWebsocket: 8182 + +ingress: + enabled: false + annotations: {} + +resources: + requests: + cpu: "500m" + memory: "2Gi" + limits: + cpu: "2000m" + memory: "8Gi" + +jvm: {} +# Optional jvm settings: +# memory: "-Xms800m -Xmx800m" +# options: "-Djna.nosys=true -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Dfile.encoding=UTF8 -Drhino.opt.level=9" +# settings: "-Dstorage.diskCache.bufferSize=7200" + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +readinessProbe: + enabled: true + +livenessProbe: + enabled: true + +hazelcast: + groupName: orientdb + groupPassword: orientdb + +persistence: + enabled: true + storage: + accessMode: + - ReadWriteOnce + size: 10Gi + backup: + accessMode: + - ReadWriteOnce + size: 2Gi + +config: + overrideHazelcastConfig: true + overrideOrientdbServerConfig: true + overrideGremlinServerConfig: true + overrideDistributedDbConfig: true + +testing: + enabled: false