diff --git a/stable/kapacitor/.helmignore b/stable/kapacitor/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/kapacitor/.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/kapacitor/Chart.yaml b/stable/kapacitor/Chart.yaml new file mode 100755 index 0000000000..503df12f51 --- /dev/null +++ b/stable/kapacitor/Chart.yaml @@ -0,0 +1,13 @@ +name: kapacitor +version: 0.1.0 +description: Chart for Chronograf +keywords: +- kapacitor +- stream +- etl +- timeseries +home: https://www.influxdata.com/time-series-platform/kapacitor/ +maintainers: +- name: Jack Zampolin + email: jack@influxdb.com +engine: gotpl \ No newline at end of file diff --git a/stable/kapacitor/README.md b/stable/kapacitor/README.md new file mode 100644 index 0000000000..bac50c283b --- /dev/null +++ b/stable/kapacitor/README.md @@ -0,0 +1,72 @@ +# Kapacitor + +## An Open-Source Time Series ETL and Alerting Engine + +[Kapacitor](https://github.com/influxdata/kapacitor) is an open-source framework built by the folks over at [InfluxData](https://influxdata.com) and written in Go for processing, monitoring, and alerting on time series data + +## QuickStart + +```bash +$ helm install stable/kapacitor --name foo --namespace bar +``` + +## Introduction + +This chart bootstraps A Kapacitor deployment and service on a Kubernetes cluster using the Helm Package manager. + +## Prerequisites + +- Kubernetes 1.4+ +- PV provisioner support in the underlying infrastructure (optional) + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install --name my-release stable/kapacitor +``` + +The command deploys Kapacitor on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```bash +$ helm delete my-release --purge +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The configurable parameters of the Kapacitor chart and the default values are listed in `values.yaml`. + +The [full image documentation](https://hub.docker.com/_/kapacitor/) contains more information about running Kapacitor in docker. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install --name my-release \ + --set influxURL=http://myinflux.mytld:8086,persistence.enabled=true \ + stable/kapacitor +``` + +The above command enables persistence and changes the size of the requested data volume to 200GB. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install --name my-release -f values.yaml stable/kapacitor +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Persistence + +The [Kapacitor](https://hub.docker.com/_/kapacitor/) image stores data in the `/var/lib/kapacitor` directory in the container. + +The chart optionally mounts a [Persistent Volume](kubernetes.io/docs/user-guide/persistent-volumes/) volume at this location. The volume is created using dynamic volume provisioning. \ No newline at end of file diff --git a/stable/kapacitor/templates/NOTES.txt b/stable/kapacitor/templates/NOTES.txt new file mode 100644 index 0000000000..a6b85c135e --- /dev/null +++ b/stable/kapacitor/templates/NOTES.txt @@ -0,0 +1,29 @@ +{{- $bl := empty .Values.influxURL }} +{{- if not $bl }} +Kapacitor can be accessed via port 9092 on the following DNS name from within your cluster: + +- http://{{ template "fullname" . }}.{{ .Release.Namespace }}:9092 + +You can easily connect to the remote instance from a local kapacitor cli. Forward the api port to localhost:9092 + +- kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{ .items[0].metadata.name }') 9092:9092 + +You can also connect to the container running Kapacitor. To open a shell session in the pod run the following: + +- kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh + +To tail the logs for the Kapacitor pod run the following: + +- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{ .items[0].metadata.name }') + +{{- if eq .Values.service.type "LoadBalancer" }} + +To watch for the LoadBalancer IP or Hostname to populate run the following: + +- kubectl get svc -w --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} +{{- end }} +{{- end }} + +{{- if empty .Values.influxURL }} +You have not set .Values.influxURL. Kapacitor needs an InfluxDB instance to create a subscription on. Please set that value to deploy kapacitor +{{- end }} \ No newline at end of file diff --git a/stable/kapacitor/templates/_helpers.tpl b/stable/kapacitor/templates/_helpers.tpl new file mode 100644 index 0000000000..234480de71 --- /dev/null +++ b/stable/kapacitor/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 24 -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 24 -}} +{{- end -}} diff --git a/stable/kapacitor/templates/deployment.yaml b/stable/kapacitor/templates/deployment.yaml new file mode 100644 index 0000000000..abffaaabe7 --- /dev/null +++ b/stable/kapacitor/templates/deployment.yaml @@ -0,0 +1,43 @@ +{{- $bl := empty .Values.influxURL }} +{{- if not $bl }} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + app: {{ template "fullname" . }} +spec: + replicas: 1 + template: + metadata: + labels: + app: {{ template "fullname" . }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: KAPACITOR_HOSTNAME + value: {{ template "fullname" . }}.{{ .Release.Namespace }} + - name: KAPACITOR_INFLUXDB_0_URLS_0 + value: {{ .Values.influxURL }} + ports: + - containerPort: 9092 + volumeMounts: + - name: data + mountPath: /var/lib/kapacitor + resources: +{{ toYaml .Values.resources | indent 12 }} + volumes: + - name: data + {{ if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }} + {{ else }} + emptyDir: {} + {{ end }} +{{- end }} \ No newline at end of file diff --git a/stable/kapacitor/templates/pvc.yaml b/stable/kapacitor/templates/pvc.yaml new file mode 100644 index 0000000000..a50862753d --- /dev/null +++ b/stable/kapacitor/templates/pvc.yaml @@ -0,0 +1,19 @@ +{{- if .Values.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + labels: + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + app: {{ template "fullname" . }} + name: {{ template "fullname" . }} + annotations: + volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end }} diff --git a/stable/kapacitor/templates/service.yaml b/stable/kapacitor/templates/service.yaml new file mode 100644 index 0000000000..d5012e44f6 --- /dev/null +++ b/stable/kapacitor/templates/service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + app: {{ template "fullname" . }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 9092 + targetPort: 9092 + name: api + selector: + app: {{ template "fullname" . }} diff --git a/stable/kapacitor/values.yaml b/stable/kapacitor/values.yaml new file mode 100644 index 0000000000..517ab92b15 --- /dev/null +++ b/stable/kapacitor/values.yaml @@ -0,0 +1,38 @@ +## influxdb image version +## ref: https://hub.docker.com/r/library/influxdb/tags/ +## +image: + repository: "kapacitor" + tag: "1.1.0" + pullPolicy: "IfNotPresent" + +## Specify a service type, defaults to NodePort +## ref: http://kubernetes.io/docs/user-guide/services/ +## +service: + type: ClusterIP + +## Persist data to a persitent volume +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: false + storageClass: generic + accessMode: ReadWriteOnce + size: 8Gi + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + requests: + memory: 256Mi + cpu: 0.1 + limits: + memory: 2Gi + cpu: 2 + +## Set the URL of InfluxDB instance to create subscription on +## ref: https://docs.influxdata.com/kapacitor/v1.1/introduction/getting_started/ +## +# influxURL: http://influxdb-influxdb.tick:8086