diff --git a/stable/aerospike/.helmignore b/stable/aerospike/.helmignore new file mode 100644 index 000000000000..f0c131944441 --- /dev/null +++ b/stable/aerospike/.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/stable/aerospike/Chart.yaml b/stable/aerospike/Chart.yaml new file mode 100644 index 000000000000..5f4b694bb0a2 --- /dev/null +++ b/stable/aerospike/Chart.yaml @@ -0,0 +1,14 @@ +appVersion: v3.14.1.2 +description: A Helm chart for Aerospike in Kubernetes +name: aerospike +keywords: + - aerospike + - big-data +home: http://aerospike.com +version: 0.1.5 +icon: https://s3-us-west-1.amazonaws.com/aerospike-fd/wp-content/uploads/2016/06/Aerospike_square_logo.png +sources: +- https://github.com/aerospike/aerospike-server +maintainers: +- name: kavehmzta + email: k.mousavizamani@travelaudience.com diff --git a/stable/aerospike/README.md b/stable/aerospike/README.md new file mode 100644 index 000000000000..9a16011911bd --- /dev/null +++ b/stable/aerospike/README.md @@ -0,0 +1,69 @@ +# Aerospike Helm Chart + +This is an implementation of Aerospike StatefulSet found here: + + * https://github.com/aerospike/aerospike-kubernetes + +## Pre Requisites: + +* Kubernetes 1.7+ with beta APIs enabled and support for statefulsets + +* PV support on underlying infrastructure (only if you are provisioning persistent volume). + +* Requires at least `v2.5.0` version of helm to support + +## StatefulSet Details + +* https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/ + +## StatefulSet Caveats + +* https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#limitations + +## Chart Details + +This chart will do the following: + +* Implement a dynamically scalable Aerospike cluster using Kubernetes StatefulSets + +### Installing the Chart + +To install the chart with the release name `my-aerospike` using a dedicated namespace(recommended): + +``` +$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator +$ helm install --name my-aerospike --namespace aerospike incubator/aerospike +``` + +The chart can be customized using the following configurable parameters: + +| Parameter | Description | Default | +| ------------------------------- | ----------------------------------------------------------------| -----------------------------| +| `image.repository` | Aerospike Container image name | `aerospike/aerospike-server` | +| `image.tag` | Aerospike Container image tag | `3.14.1.2` | +| `image.pullPolicy` | Aerospike Container pull policy | `Always` | +| `replicaCount` | Aerospike Brokers | `1` | +| `persistentVolume` | config of persistent volumes for storage-engine | `{}` | +| `confFile` | config filename. This file should be included in the chart path | `aerospike.conf` | +| `resources` | resource requests and limits | `{}` | +| `nodeSelector` | Labels for pod assignment | `{}` | +| `terminationGracePeriodSeconds` | wit time before forcefully terminating container | `30` | + +Specify parameters using `--set key=value[,key=value]` argument to `helm install` + +Alternatively a YAML file that specifies the values for the parameters can be provided like this: + +```bash +$ helm install --name my-aerospike -f values.yaml incubator/aerospike +``` + +### Conf files for Aerospike + +There is one conf file added to each Aerospike release. This conf file can be replaced with a custom file and updating the `confFile` value. + +If you modify the `aerospike.conf` (and you use more than 1 replica), you want to add the `#REPLACE_THIS_LINE_WITH_MESH_CONFIG` comment to the config file (see the default conf file). This will update your mesh to connect each replica. + +## Known Limitations + +* Persistent volume claims tested only on GCP +* Aerospike cluster is not accessible via an external endpoint diff --git a/stable/aerospike/templates/NOTES.txt b/stable/aerospike/templates/NOTES.txt new file mode 100644 index 000000000000..80fa0d328c9a --- /dev/null +++ b/stable/aerospike/templates/NOTES.txt @@ -0,0 +1,8 @@ +The Aerospike can be accessed via port 3000 on the following DNS name from within your cluster: + + {{ template "aerospike.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local + +You can connect to aeropike in your local machine using port-forwarding: + + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "aerospike.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 3000:3000 diff --git a/stable/aerospike/templates/_helpers.tpl b/stable/aerospike/templates/_helpers.tpl new file mode 100644 index 000000000000..e2cfaaa6424f --- /dev/null +++ b/stable/aerospike/templates/_helpers.tpl @@ -0,0 +1,26 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "aerospike.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). +*/}} +{{- define "aerospike.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create aerospike mesh setup +*/}} +{{- define "aerospike.mesh" -}} + {{- $fullname := include "aerospike.fullname" . -}} + {{- range $i, $e := until (.Values.replicaCount|int) }} + {{ printf "mesh-seed-address-port %s-%d.%s-mesh 3002" $fullname $i $fullname }} + {{- end -}} +{{- end -}} diff --git a/stable/aerospike/templates/configmap.yaml b/stable/aerospike/templates/configmap.yaml new file mode 100644 index 000000000000..91b2cd8a09c8 --- /dev/null +++ b/stable/aerospike/templates/configmap.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "aerospike.fullname" . }} + labels: + app: {{ template "aerospike.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + aerospike.conf: | + # aerospike configuration + {{- $mesh := include "aerospike.mesh" . }} + {{ .Values.confFile |replace "#REPLACE_THIS_LINE_WITH_MESH_CONFIG" $mesh | indent 4}} \ No newline at end of file diff --git a/stable/aerospike/templates/mesh-service.yaml b/stable/aerospike/templates/mesh-service.yaml new file mode 100644 index 000000000000..4decc44063f9 --- /dev/null +++ b/stable/aerospike/templates/mesh-service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "aerospike.fullname" . }}-mesh + labels: + app: {{ template "aerospike.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" + {{- range $key, $value := .Values.meshService.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + clusterIP: None + type: ClusterIP + ports: + - port: 3002 + protocol: TCP + name: aerospike-mesh + selector: + app: {{ template "aerospike.name" . }} + release: {{ .Release.Name }} diff --git a/stable/aerospike/templates/service.yaml b/stable/aerospike/templates/service.yaml new file mode 100644 index 000000000000..341512a153f0 --- /dev/null +++ b/stable/aerospike/templates/service.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "aerospike.fullname" . }} + labels: + app: {{ template "aerospike.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" + {{- range $key, $value := .Values.service.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: +{{ if .Values.service.clusterIP }} + clusterIP: {{ .Values.service.clusterIP | quote }} +{{ end }} + type: {{ .Values.service.type }} + {{ if eq .Values.service.type "LoadBalancer" -}} {{ if .Values.service.loadBalancerIP -}} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{ end -}} + {{- end -}} + ports: + - port: 3000 + protocol: TCP + name: aerospike-client + - port: 3002 + protocol: TCP + name: aerospike-mesh + selector: + app: {{ template "aerospike.name" . }} + release: {{ .Release.Name }} diff --git a/stable/aerospike/templates/statefulset.yaml b/stable/aerospike/templates/statefulset.yaml new file mode 100644 index 000000000000..b1246c826538 --- /dev/null +++ b/stable/aerospike/templates/statefulset.yaml @@ -0,0 +1,64 @@ +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: {{ template "aerospike.fullname" . }} + labels: + app: {{ template "aerospike.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + serviceName: {{ template "aerospike.fullname" . }}-mesh + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "aerospike.name" . }} + release: {{ .Release.Name }} + spec: + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + containers: + - name: {{ template "aerospike.fullname" . }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: 3000 + name: aero-clients + - containerPort: 3002 + name: aero-mesh + - containerPort: 3003 + name: aero-info + readinessProbe: + tcpSocket: + port: 3000 + initialDelaySeconds: 15 + timeoutSeconds: 1 + volumeMounts: + - name: config-volume + mountPath: /etc/aerospike + {{- range $pv := .Values.persistentVolume }} + - name: {{ $pv.name | quote }} + mountPath: {{ $pv.mountPath | quote }} + {{- end }} + resources: +{{ toYaml .Values.resources | indent 10 }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 8 }} + {{- end }} + volumes: + - name: config-volume + configMap: + name: {{ template "aerospike.fullname" . }} + items: + - key: aerospike.conf + path: aerospike.conf + volumeClaimTemplates: + {{- range $pv := .Values.persistentVolume }} + - metadata: + name: {{ $pv.name | quote }} + spec: +{{ toYaml $pv.template | indent 6 }} + {{- end }} diff --git a/stable/aerospike/values.yaml b/stable/aerospike/values.yaml new file mode 100644 index 000000000000..79cc6ae6e6ef --- /dev/null +++ b/stable/aerospike/values.yaml @@ -0,0 +1,99 @@ +# Default values for aerospike. +terminationGracePeriodSeconds: 30 +replicaCount: 1 +nodeSelector: {} +image: + repository: aerospike/aerospike-server + tag: 3.14.1.2 + pullPolicy: IfNotPresent + +# Set as empty object {} if no volumes need to be created +# See confFile below +persistentVolume: {} + # - mountPath: /opt/aerospike/data + # name: aerospike-data + # template: + # accessModes: [ "ReadWriteOnce" ] + # # storageClassName: "standard" + # resources: + # requests: + # storage: "36G" + # selector: + # matchLabels: + # diskname: "aerospike-data" + +service: + type: ClusterIP + annotations: {} + loadBalancerIP: + clusterIP: None + +meshService: + annotations: {} + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +confFile: |- + #default config file + service { + user root + group root + paxos-single-replica-limit 1 + pidfile /var/run/aerospike/asd.pid + service-threads 4 + transaction-queues 4 + transaction-threads-per-queue 4 + proto-fd-max 15000 + } + logging { + file /var/log/aerospike/aerospike.log { + context any info + } + + console { + context any info + } + } + network { + service { + address any + port 3000 + } + heartbeat { + address any + interval 150 + #REPLACE_THIS_LINE_WITH_MESH_CONFIG + mode mesh + port 3002 + timeout 20 + protocol v3 + + } + fabric { + port 3001 + } + + info { + port 3003 + } + } + + namespace test { + replication-factor 2 + memory-size 1G + default-ttl 5d + storage-engine device { + file /opt/aerospike/data/test.dat + filesize 4G + } + }