From 12255827a34e2639e2139ed7dd2c5cf7c87f9414 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Tue, 29 Nov 2016 11:59:38 -0800 Subject: [PATCH 1/8] 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 From 054879f86d623d26c56fbbec64fbc56b345e5a90 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Tue, 29 Nov 2016 16:29:49 -0800 Subject: [PATCH 2/8] Add NOTES.txt and README.md --- stable/kapacitor/Chart.yaml | 13 +++- stable/kapacitor/README.md | 93 +++++++++++++++++++++++++++- stable/kapacitor/templates/NOTES.txt | 37 ++++++----- stable/kapacitor/values.yaml | 2 +- 4 files changed, 126 insertions(+), 19 deletions(-) diff --git a/stable/kapacitor/Chart.yaml b/stable/kapacitor/Chart.yaml index 984739048a..503df12f51 100755 --- a/stable/kapacitor/Chart.yaml +++ b/stable/kapacitor/Chart.yaml @@ -1,4 +1,13 @@ -apiVersion: v1 -description: A Helm chart for Kubernetes 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 index 792f535cb0..7e74883db9 100644 --- a/stable/kapacitor/README.md +++ b/stable/kapacitor/README.md @@ -1 +1,92 @@ -# `kapacitor` Chart \ No newline at end of file +# 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 following tables lists the configurable parameters of the Kapacitor chart and +their default values. + +```yaml +image.repository: "kapacitor" +image.tag: "1.1.0" +image.pullPolicy: "IfNotPresent" +service.type: NodePort +persistence.enabled: false +persistence.storageClass: generic +persistence.accessMode: ReadWriteOnce +persistence.size: 8Gi +resources.requests.memory: 256Mi +resources.requests.cpu: 0.1 +resources.limits.memory: 2Gi +resources.limits.cpu: 2 + +# This is the location where kapacitor will look for an Influxdb +# instance to create a subscription on. +InfluxURL: http://influxdb-influxdb.tick:8086 +``` + +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 index 5c5e492b0a..6ff7a04d50 100644 --- a/stable/kapacitor/templates/NOTES.txt +++ b/stable/kapacitor/templates/NOTES.txt @@ -1,15 +1,22 @@ -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 }} +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 trail 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 run the following + +- kubectl get svc -w --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} +{{- end }} \ No newline at end of file diff --git a/stable/kapacitor/values.yaml b/stable/kapacitor/values.yaml index 5152855542..5d101bc7d8 100644 --- a/stable/kapacitor/values.yaml +++ b/stable/kapacitor/values.yaml @@ -31,4 +31,4 @@ resources: cpu: 2 # Set url for kapacitor to point to -InfluxURL: http://influxdb-influxdb.tick:8086 \ No newline at end of file +InfluxURL: http://influxdb-influxdb.tick:8086 From f9372ff93d8daf6c6b03825873d6b59be954d3c5 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Wed, 30 Nov 2016 14:30:51 -0800 Subject: [PATCH 3/8] Add release and heritage to labels on deployment, pvc and service --- stable/kapacitor/templates/deployment.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stable/kapacitor/templates/deployment.yaml b/stable/kapacitor/templates/deployment.yaml index 2d5e3fb86f..f1d0ed4ec1 100644 --- a/stable/kapacitor/templates/deployment.yaml +++ b/stable/kapacitor/templates/deployment.yaml @@ -4,6 +4,8 @@ metadata: name: {{ template "fullname" . }} labels: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" spec: replicas: 1 template: From a9089a7043bd051be947a373bc77a0aa2a346303 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Wed, 30 Nov 2016 14:31:18 -0800 Subject: [PATCH 4/8] Add release and heritage to labels on deployment, pvc and service --- stable/kapacitor/templates/pvc.yaml | 3 +++ stable/kapacitor/templates/service.yaml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/stable/kapacitor/templates/pvc.yaml b/stable/kapacitor/templates/pvc.yaml index db19bb97d9..7f2a2b6b98 100644 --- a/stable/kapacitor/templates/pvc.yaml +++ b/stable/kapacitor/templates/pvc.yaml @@ -2,6 +2,9 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" name: {{ template "fullname" . }} annotations: volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} diff --git a/stable/kapacitor/templates/service.yaml b/stable/kapacitor/templates/service.yaml index ea8134a50c..29ec020851 100644 --- a/stable/kapacitor/templates/service.yaml +++ b/stable/kapacitor/templates/service.yaml @@ -4,6 +4,8 @@ metadata: name: {{ template "fullname" . }} labels: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" spec: type: {{ .Values.service.type }} ports: From faca0df84ac0f066b9cc5f5ce1e60d80de3f2a08 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Wed, 30 Nov 2016 15:05:27 -0800 Subject: [PATCH 5/8] Fix labels --- stable/kapacitor/templates/deployment.yaml | 1 + stable/kapacitor/templates/pvc.yaml | 8 +++++--- stable/kapacitor/templates/service.yaml | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/stable/kapacitor/templates/deployment.yaml b/stable/kapacitor/templates/deployment.yaml index f1d0ed4ec1..a160b69845 100644 --- a/stable/kapacitor/templates/deployment.yaml +++ b/stable/kapacitor/templates/deployment.yaml @@ -6,6 +6,7 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + app: {{ template "fullname" . }} spec: replicas: 1 template: diff --git a/stable/kapacitor/templates/pvc.yaml b/stable/kapacitor/templates/pvc.yaml index 7f2a2b6b98..a50862753d 100644 --- a/stable/kapacitor/templates/pvc.yaml +++ b/stable/kapacitor/templates/pvc.yaml @@ -3,9 +3,11 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" - name: {{ template "fullname" . }} + 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: diff --git a/stable/kapacitor/templates/service.yaml b/stable/kapacitor/templates/service.yaml index 29ec020851..d6c9250ffe 100644 --- a/stable/kapacitor/templates/service.yaml +++ b/stable/kapacitor/templates/service.yaml @@ -6,6 +6,7 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + app: {{ template "fullname" . }} spec: type: {{ .Values.service.type }} ports: From 80e4aa51213c4b63756027770b81ad4786fadbff Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Thu, 1 Dec 2016 09:32:01 -0800 Subject: [PATCH 6/8] Address PR comments --- stable/kapacitor/README.md | 30 +++++++++++----------- stable/kapacitor/templates/NOTES.txt | 4 +-- stable/kapacitor/templates/deployment.yaml | 2 +- stable/kapacitor/templates/service.yaml | 1 + stable/kapacitor/values.yaml | 12 ++++++--- 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/stable/kapacitor/README.md b/stable/kapacitor/README.md index 7e74883db9..d8ddb52ffa 100644 --- a/stable/kapacitor/README.md +++ b/stable/kapacitor/README.md @@ -44,25 +44,25 @@ The command removes all the Kubernetes components associated with the chart and ## Configuration The following tables lists the configurable parameters of the Kapacitor chart and -their default values. +the meaning of the field. The default values are listed in `values.yaml`. ```yaml -image.repository: "kapacitor" -image.tag: "1.1.0" -image.pullPolicy: "IfNotPresent" -service.type: NodePort -persistence.enabled: false -persistence.storageClass: generic -persistence.accessMode: ReadWriteOnce -persistence.size: 8Gi -resources.requests.memory: 256Mi -resources.requests.cpu: 0.1 -resources.limits.memory: 2Gi -resources.limits.cpu: 2 +image.repository: Docker image repo to use +image.tag: Docker image tag to use +image.pullPolicy: Image pull policy (IfNotPresent, Always) +service.type: Type of service (NodePort, LoadBalancer) +persistence.enabled: Set to true to enable automatic provisioning of a persistent disk +persistence.storageClass: Sorage class for the persistent disk +persistence.accessMode: Access mode for the persistent disk +persistence.size: Size of the persistent disk in Gi or Mi +resources.requests.memory: Min amount of memory the pod requires +resources.requests.cpu: Min amount of cpu required by the pod +resources.limits.memory: Max amount of memory the pod requires +resources.limits.cpu: Max amount of cpu required by the pod # This is the location where kapacitor will look for an Influxdb # instance to create a subscription on. -InfluxURL: http://influxdb-influxdb.tick:8086 +influxURL: An InfluxDB url with port. ``` The [full image documentation](https://hub.docker.com/_/kapacitor/) contains more information about running Kapacitor in docker. @@ -71,7 +71,7 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm ```bash $ helm install --name my-release \ - --set InfluxURL=http://myinflux.mytld:8086,persistence.enabled=true \ + --set influxURL=http://myinflux.mytld:8086,persistence.enabled=true \ stable/kapacitor ``` diff --git a/stable/kapacitor/templates/NOTES.txt b/stable/kapacitor/templates/NOTES.txt index 6ff7a04d50..dfc2e3d6a7 100644 --- a/stable/kapacitor/templates/NOTES.txt +++ b/stable/kapacitor/templates/NOTES.txt @@ -10,13 +10,13 @@ You can also connect to the container running Kapacitor. To open a shell session - 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 trail the logs for the Kapacitor pod run the following: +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 run the following +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 }} \ No newline at end of file diff --git a/stable/kapacitor/templates/deployment.yaml b/stable/kapacitor/templates/deployment.yaml index a160b69845..57ace19716 100644 --- a/stable/kapacitor/templates/deployment.yaml +++ b/stable/kapacitor/templates/deployment.yaml @@ -22,7 +22,7 @@ spec: - name: KAPACITOR_HOSTNAME value: {{ template "fullname" . }}.{{ .Release.Namespace }} - name: KAPACITOR_INFLUXDB_0_URLS_0 - value: {{ .Values.InfluxURL }} + value: {{ .Values.influxURL }} ports: - containerPort: 9092 volumeMounts: diff --git a/stable/kapacitor/templates/service.yaml b/stable/kapacitor/templates/service.yaml index d6c9250ffe..d5012e44f6 100644 --- a/stable/kapacitor/templates/service.yaml +++ b/stable/kapacitor/templates/service.yaml @@ -12,5 +12,6 @@ spec: ports: - port: 9092 targetPort: 9092 + name: api selector: app: {{ template "fullname" . }} diff --git a/stable/kapacitor/values.yaml b/stable/kapacitor/values.yaml index 5d101bc7d8..7eda55243b 100644 --- a/stable/kapacitor/values.yaml +++ b/stable/kapacitor/values.yaml @@ -6,13 +6,15 @@ image: tag: "1.1.0" pullPolicy: "IfNotPresent" -## Specify a service type -## NodePort is default +## Specify a service type, defaults to NodePort ## ref: http://kubernetes.io/docs/user-guide/services/ +## service: type: NodePort ## Persist data to a persitent volume +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## persistence: enabled: false storageClass: generic @@ -30,5 +32,7 @@ resources: memory: 2Gi cpu: 2 -# Set url for kapacitor to point to -InfluxURL: http://influxdb-influxdb.tick:8086 +## 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 From f5a754f6c5cfafcfafed09da6cdd1dafb50784da Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Mon, 5 Dec 2016 11:47:17 -0800 Subject: [PATCH 7/8] NodePort -> ClusterIP and remove values.yaml from README.md --- stable/kapacitor/README.md | 22 +--------------------- stable/kapacitor/values.yaml | 2 +- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/stable/kapacitor/README.md b/stable/kapacitor/README.md index d8ddb52ffa..bac50c283b 100644 --- a/stable/kapacitor/README.md +++ b/stable/kapacitor/README.md @@ -43,27 +43,7 @@ The command removes all the Kubernetes components associated with the chart and ## Configuration -The following tables lists the configurable parameters of the Kapacitor chart and -the meaning of the field. The default values are listed in `values.yaml`. - -```yaml -image.repository: Docker image repo to use -image.tag: Docker image tag to use -image.pullPolicy: Image pull policy (IfNotPresent, Always) -service.type: Type of service (NodePort, LoadBalancer) -persistence.enabled: Set to true to enable automatic provisioning of a persistent disk -persistence.storageClass: Sorage class for the persistent disk -persistence.accessMode: Access mode for the persistent disk -persistence.size: Size of the persistent disk in Gi or Mi -resources.requests.memory: Min amount of memory the pod requires -resources.requests.cpu: Min amount of cpu required by the pod -resources.limits.memory: Max amount of memory the pod requires -resources.limits.cpu: Max amount of cpu required by the pod - -# This is the location where kapacitor will look for an Influxdb -# instance to create a subscription on. -influxURL: An InfluxDB url with port. -``` +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. diff --git a/stable/kapacitor/values.yaml b/stable/kapacitor/values.yaml index 7eda55243b..39ff0c6cfe 100644 --- a/stable/kapacitor/values.yaml +++ b/stable/kapacitor/values.yaml @@ -10,7 +10,7 @@ image: ## ref: http://kubernetes.io/docs/user-guide/services/ ## service: - type: NodePort + type: ClusterIP ## Persist data to a persitent volume ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ From 7f331ef9e577a974fe4a242a26fb55f33b7d5938 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Thu, 15 Dec 2016 11:32:12 -0800 Subject: [PATCH 8/8] Require user to set .Values.influxURL --- stable/kapacitor/templates/NOTES.txt | 7 +++++++ stable/kapacitor/templates/deployment.yaml | 5 ++++- stable/kapacitor/values.yaml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/stable/kapacitor/templates/NOTES.txt b/stable/kapacitor/templates/NOTES.txt index dfc2e3d6a7..a6b85c135e 100644 --- a/stable/kapacitor/templates/NOTES.txt +++ b/stable/kapacitor/templates/NOTES.txt @@ -1,3 +1,5 @@ +{{- $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 @@ -19,4 +21,9 @@ To tail the logs for the Kapacitor pod run the following: 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/deployment.yaml b/stable/kapacitor/templates/deployment.yaml index 57ace19716..abffaaabe7 100644 --- a/stable/kapacitor/templates/deployment.yaml +++ b/stable/kapacitor/templates/deployment.yaml @@ -1,3 +1,5 @@ +{{- $bl := empty .Values.influxURL }} +{{- if not $bl }} apiVersion: extensions/v1beta1 kind: Deployment metadata: @@ -37,4 +39,5 @@ spec: claimName: {{ template "fullname" . }} {{ else }} emptyDir: {} - {{ end }} \ No newline at end of file + {{ end }} +{{- end }} \ No newline at end of file diff --git a/stable/kapacitor/values.yaml b/stable/kapacitor/values.yaml index 39ff0c6cfe..517ab92b15 100644 --- a/stable/kapacitor/values.yaml +++ b/stable/kapacitor/values.yaml @@ -35,4 +35,4 @@ resources: ## 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 +# influxURL: http://influxdb-influxdb.tick:8086