From 12255827a34e2639e2139ed7dd2c5cf7c87f9414 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Tue, 29 Nov 2016 11:59:38 -0800 Subject: [PATCH] Add kapacitor chart --- stable/kapacitor/.helmignore | 21 ++++++++++++ stable/kapacitor/Chart.yaml | 4 +++ stable/kapacitor/README.md | 1 + stable/kapacitor/templates/NOTES.txt | 15 +++++++++ stable/kapacitor/templates/_helpers.tpl | 16 ++++++++++ stable/kapacitor/templates/deployment.yaml | 37 ++++++++++++++++++++++ stable/kapacitor/templates/pvc.yaml | 14 ++++++++ stable/kapacitor/templates/service.yaml | 13 ++++++++ stable/kapacitor/values.yaml | 34 ++++++++++++++++++++ 9 files changed, 155 insertions(+) create mode 100644 stable/kapacitor/.helmignore create mode 100755 stable/kapacitor/Chart.yaml create mode 100644 stable/kapacitor/README.md create mode 100644 stable/kapacitor/templates/NOTES.txt create mode 100644 stable/kapacitor/templates/_helpers.tpl create mode 100644 stable/kapacitor/templates/deployment.yaml create mode 100644 stable/kapacitor/templates/pvc.yaml create mode 100644 stable/kapacitor/templates/service.yaml create mode 100644 stable/kapacitor/values.yaml 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..984739048a --- /dev/null +++ b/stable/kapacitor/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: A Helm chart for Kubernetes +name: kapacitor +version: 0.1.0 diff --git a/stable/kapacitor/README.md b/stable/kapacitor/README.md new file mode 100644 index 0000000000..792f535cb0 --- /dev/null +++ b/stable/kapacitor/README.md @@ -0,0 +1 @@ +# `kapacitor` Chart \ 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..5c5e492b0a --- /dev/null +++ b/stable/kapacitor/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT/login +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }} +{{- end }} 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..2d5e3fb86f --- /dev/null +++ b/stable/kapacitor/templates/deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +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 }} \ 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..db19bb97d9 --- /dev/null +++ b/stable/kapacitor/templates/pvc.yaml @@ -0,0 +1,14 @@ +{{- if .Values.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + 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..ea8134a50c --- /dev/null +++ b/stable/kapacitor/templates/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + type: {{ .Values.service.type }} + ports: + - port: 9092 + targetPort: 9092 + selector: + app: {{ template "fullname" . }} diff --git a/stable/kapacitor/values.yaml b/stable/kapacitor/values.yaml new file mode 100644 index 0000000000..5152855542 --- /dev/null +++ b/stable/kapacitor/values.yaml @@ -0,0 +1,34 @@ +## 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 +## NodePort is default +## ref: http://kubernetes.io/docs/user-guide/services/ +service: + type: NodePort + +## Persist data to a persitent volume +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 url for kapacitor to point to +InfluxURL: http://influxdb-influxdb.tick:8086 \ No newline at end of file