[incubator/orientdb] Initial commit for OrientDB chart (#9900)

* [incubator/orientdb] Initial commit for OrientDB chart

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] Added maintainers to chart

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] Trying to fix circle-ci lint fail

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] y u no lint??

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb]   error    no new line character at the end of file  (new-line-at-end-of-file)

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] will this nightmare ever end??

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] Using the github username...

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] Support regular and headless services

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] Updates for Hazelcast and service name

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] Using Orient 3.0.13; parameterized helm test

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] Using readiness and liveness probes. Disable testing in case it causes helm e2e to fail

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] Control jvm env vars

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>

* [incubator/orientdb] Bumping chart and app versions

Signed-off-by: Eli Kasik <soujiro32167@gmail.com>
This commit is contained in:
Eli Kasik
2019-03-04 14:44:55 -08:00
committed by Kubernetes Prow Robot
parent 16879ca3db
commit 466770997b
14 changed files with 562 additions and 0 deletions
+21
View File
@@ -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
+13
View File
@@ -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
+40
View File
@@ -0,0 +1,40 @@
# Infinity OrientDB helm chart
Orient DB helm chart
## Installation:
`helm install . --name <RELEASE-NAME> --namespace <NAMESPACE> --set rootpassword=<PASSWORD>`
If rootPassword is not set, a random one will be used.
## Scaling:
Get the name of your statefulset:
`kubectl get statefulsets -n <NAMESPACE>`
Then scale it:
`kubectl scale <STATEFULSET-NAME> --replicas=<DESIRED-SIZE>`
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 <RELEASE-NAME> --cleanup --timeout 1000`
## Accessing the UI
`kubectl port-forward <POD-NAME> 2480:2480 -n <NAMESPACE>`
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: <sommeliers@b-yond.com>
@@ -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": ["<NEW_NODE>"]
}
}
}
+53
View File
@@ -0,0 +1,53 @@
{{- $self := . -}}
{{- $fullname := include "orientdb.fullname" . -}}
<?xml version="1.0" encoding="UTF-8"?>
<!-- ~ Copyright (c) 2008-2012, Hazel Bilisim Ltd. All Rights Reserved. ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may
not use this file except in compliance with the License. ~ You may obtain
a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~
~ Unless required by applicable law or agreed to in writing, software ~ distributed
under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for
the specific language governing permissions and ~ limitations under the License. -->
<hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.3.xsd"
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
<name>{{ .Values.hazelcast.groupName }}</name>
<password>{{ .Values.hazelcast.groupPassword }}</password>
</group>
<properties>
<property name="hazelcast.phone.home.enabled">false</property>
<property name="hazelcast.mancenter.enabled">false</property>
<property name="hazelcast.memcache.enabled">false</property>
<property name="hazelcast.rest.enabled">false</property>
<property name="hazelcast.wait.seconds.before.join">5</property>
<property name="hazelcast.operation.thread.count">1</property>
<property name="hazelcast.io.thread.count">1</property>
<property name="hazelcast.operation.generic.thread.count">1</property>
<property name="hazelcast.client.event.thread.count">1</property>
<property name="hazelcast.event.thread.count">1</property>
<property name="hazelcast.heartbeat.interval.seconds">5</property>
<property name="hazelcast.max.no.heartbeat.seconds">30</property>
<property name="hazelcast.merge.next.run.delay.seconds">15</property>
</properties>
<network>
<port auto-increment="true">2434</port>
<join>
<multicast enabled="false">
<multicast-group>235.1.1.1</multicast-group>
<multicast-port>2434</multicast-port>
</multicast>
<!-- TODO: Use K8s hazelcast plugin: https://github.com/orientechnologies/orientdb-docker -->
<tcp-ip enabled="true">
{{- range $i, $e := until ( .Values.replicaCount | int ) }}
<member>{{ $fullname }}-{{$i}}.{{ $fullname }}-headless.{{ $self.Release.Namespace }}.svc.cluster.local</member>
{{- end }}
</tcp-ip>
</join>
</network>
<executor-service>
<pool-size>16</pool-size>
</executor-service>
</hazelcast>
+14
View File
@@ -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 }}
+34
View File
@@ -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 -}}
+11
View File
@@ -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 }}
+39
View File
@@ -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 }}
+15
View File
@@ -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 }}
+58
View File
@@ -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 }}
@@ -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}}
@@ -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 }}
+80
View File
@@ -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