diff --git a/contrib/helm/README.md b/contrib/helm/README.md new file mode 100644 index 0000000..d1e5af0 --- /dev/null +++ b/contrib/helm/README.md @@ -0,0 +1,49 @@ +# Event Gateway Helm chart + +This chart deploys the Event Gateway with etcd onto a Kubernetes cluster. + +## Installation + +Make sure you have helm installed on you machine and run `helm init` on your K8s cluster. + +From the `event-gateway/contrib/helm` folder: + +First, install etcd operator: +``` +helm install stable/etcd-operator --name ego +``` + +Then, install the Event Gateway: +``` +helm install event-gateway --name eg +``` + +Note: to deploy the stack to a namespace other than the default, add `--namespace` option to both `helm install` commands. + +To get the Event Gateway load balancer IP: +``` +kubectl get svc +``` + +To delete the Event Gatway and etcd: +``` +helm delete eg +helm delete ego +``` + +## Configuration + +| Parameter | Description | Default | +|-----------------------------|----------------------------------------------|----------------------------| +| `images.repository` | Event Gateway image | `serverless/event-gateway` | +| `images.tag` | Event Gateway image tag | `0.9.0` | +| `replicaCount` | Number of containers | `3` | +| `service.type` | Type of Kubernetes service | `LoadBalancer` | +| `service.config.port` | Config API port number | `4001` | +| `service.events.port` | Events API port number | `4000` | +| `resources.limits.cpu` | CPU resource limits | `200m` | +| `resources.limits.memory` | Memory resource limits | `256Mi` | +| `resources.requests.cpu` | CPU resource requests | `200m` | +| `resources.requests.memory` | Memory resource requests | `256Mi` | +| `command` | Options to pass to `event-gateway` command | `[-db-hosts=eg-etcd-cluster-client:2379, -log-level=debug]`| +| `etcd_cluster_name` | Name of the etcd cluster. Must be passed to the `-db-host` option as `-client` | `eg-etcd-cluster`| \ No newline at end of file diff --git a/contrib/helm/event-gateway/.helmignore b/contrib/helm/event-gateway/.helmignore new file mode 100644 index 0000000..f0c1319 --- /dev/null +++ b/contrib/helm/event-gateway/.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/contrib/helm/event-gateway/Chart.yaml b/contrib/helm/event-gateway/Chart.yaml new file mode 100644 index 0000000..ef43380 --- /dev/null +++ b/contrib/helm/event-gateway/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: https://github.com/serverless/event-gateway +name: event-gateway +version: 0.1.0 diff --git a/contrib/helm/event-gateway/templates/_helpers.tpl b/contrib/helm/event-gateway/templates/_helpers.tpl new file mode 100644 index 0000000..23ad4eb --- /dev/null +++ b/contrib/helm/event-gateway/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "event-gateway.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 "event-gateway.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 "event-gateway.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/contrib/helm/event-gateway/templates/etcd-cluster.yaml b/contrib/helm/event-gateway/templates/etcd-cluster.yaml new file mode 100644 index 0000000..e975eea --- /dev/null +++ b/contrib/helm/event-gateway/templates/etcd-cluster.yaml @@ -0,0 +1,7 @@ +apiVersion: "etcd.database.coreos.com/v1beta2" +kind: "EtcdCluster" +metadata: + name: {{ .Values.etcd_cluster_name }} +spec: + size: 3 + version: "3.2.13" \ No newline at end of file diff --git a/contrib/helm/event-gateway/templates/event-gateway.yaml b/contrib/helm/event-gateway/templates/event-gateway.yaml new file mode 100644 index 0000000..90b2dae --- /dev/null +++ b/contrib/helm/event-gateway/templates/event-gateway.yaml @@ -0,0 +1,53 @@ +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + name: {{ template "event-gateway.fullname" . }} + labels: + app: {{ template "event-gateway.fullname" . }} + chart: {{ template "event-gateway.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "event-gateway.name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "event-gateway.name" . }} + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + {{- range .Values.command }} + - {{ . }} + {{- end }} + livenessProbe: + httpGet: + path: /v1/status + port: {{ .Values.service.config.port }} + readinessProbe: + httpGet: + path: /v1/status + port: {{ .Values.service.config.port }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template "event-gateway.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" +spec: + type: {{ .Values.service.type }} + ports: + - name: config + port: {{ .Values.service.config.port }} + - name: events + port: {{ .Values.service.events.port }} + selector: + app: {{ template "event-gateway.name" . }} diff --git a/contrib/helm/event-gateway/values.yaml b/contrib/helm/event-gateway/values.yaml new file mode 100644 index 0000000..cf30e93 --- /dev/null +++ b/contrib/helm/event-gateway/values.yaml @@ -0,0 +1,20 @@ +image: + repository: serverless/event-gateway + tag: 0.9.0 + pullPolicy: IfNotPresent +replicaCount: 3 +service: + type: LoadBalancer + config: + port: 4001 + events: + port: 4000 +resources: + limits: + cpu: 200m + memory: 256Mi + requests: + cpu: 200m + memory: 256Mi +command: ["-db-hosts=eg-etcd-cluster-client:2379", "-log-level=debug"] +etcd_cluster_name: eg-etcd-cluster \ No newline at end of file