Skip to content

Commit

Permalink
feat(influxdb): Use stable/influxdb chart
Browse files Browse the repository at this point in the history
closes #180
* This moves to using the influxdb chart in the stable repository
* Sets the version to 0.4.0
* Adds two pre-upgrade hooks to the base monitor chart. These hooks
allow the chart to migrate data from the old volume mount location to
the new one provided by the influxdb chart.
  • Loading branch information
Jonathan Chauncey committed Mar 24, 2017
1 parent 6327552 commit a5099a3
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 168 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ influxdb/manifests/*.tmp.yaml
chronograf/manifests/*.tmp.yaml
grafana/manifests/*.tmp.yaml
rootfs/usr/bin/telegraf
charts/monitor/charts/*.tgz
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ spec:
name: influxdb-creds
key: password
{{- else }}
- name: "INFLUXDB_URLS"
value: http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT)
# - name: "INFLUXDB_URLS"
# value: http://{{.Release.Name}}.influxdb.{{.Release.Namespace}}.svc.cluster.local:8086
- name: DEIS_MONITOR_INFLUXAPI_SERVICE_HOST
value: {{.Release.Name}}-influxdb.{{.Release.Namespace}}.svc.cluster.local
{{- end }}
- name: "BIND_PORT"
value: "3500"
Expand Down
7 changes: 0 additions & 7 deletions charts/monitor/charts/influxdb/Chart.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions charts/monitor/charts/influxdb/templates/monitor-influxdb-pvc.yaml

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ spec:
key: password
{{- else }}
- name: "INFLUXDB_URLS"
value: "\"http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT)\""
value: "\"http://{{.Release.Name}}-influxdb.{{.Release.Namespace}}.svc.cluster.local:8086\""
- name: "INFLUXDB_INPUT_URLS"
value: "\"http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT)/debug/vars\""
value: "\"http://{{.Release.Name}}-influxdb.{{.Release.Namespace}}.svc.cluster.local:8086/debug/vars\""
- name: "ENABLE_INFLUXDB_INPUT"
value: "true"
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if eq .Values.global.influxdb_location "off-cluster" }}
apiVersion: v1
kind: Secret
metadata:
name: influxdb-creds
labels:
heritage: deis
type: Opaque
data:
url: {{ .Values.influxdb.url | b64enc }}
database: {{ .Values.influxdb.database | b64enc }}
user: {{ .Values.influxdb.user | b64enc }}
password: {{ .Values.influxdb.password | b64enc }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/monitor/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- condition: ""
enabled: false
name: influxdb
repository: https://kubernetes-charts.storage.googleapis.com
tags: null
version: 0.4.0
digest: sha256:d5acf72f0451f16fd80eebf9f7434f4a331d4a3e6cf3306e251ae604a7cd2797
generated: 2017-03-23T14:34:11.693195309-04:00
4 changes: 4 additions & 0 deletions charts/monitor/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
- name: influxdb
version: "0.4.0"
repository: https://kubernetes-charts.storage.googleapis.com
30 changes: 30 additions & 0 deletions charts/monitor/templates/kill-pods.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if .Values.influxdb.persistence.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: kill-pods-{{ randAlphaNum 5 | lower }}
labels:
heritage: {{.Release.Service | quote }}
release: {{.Release.Name | quote }}
chart: {{.Chart.Name}}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hookWeight": "-10"
spec:
template:
metadata:
name: "{{.Release.Name}}"
labels:
heritage: {{.Release.Service | quote }}
release: {{.Release.Name | quote }}
chart: "{{.Chart.Name}}"
spec:
restartPolicy: Never
containers:
- name: kill-pods
image: "lachlanevenson/k8s-kubectl"
command: ["/bin/sh", "-c"]
args: ["(kubectl delete daemonset deis-monitor-telegraf || true) && \
(kubectl delete deploy deis-monitor-influxdb || true) && \
sleep 10"]
{{- end }}
41 changes: 41 additions & 0 deletions charts/monitor/templates/migrate-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.influxdb.persistence.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: migrate-data-{{ randAlphaNum 5 | lower }}
labels:
heritage: {{.Release.Service | quote }}
release: {{.Release.Name | quote }}
chart: {{.Chart.Name}}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hookWeight": "10"
spec:
template:
metadata:
name: "{{.Release.Name}}"
labels:
heritage: {{.Release.Service | quote }}
release: {{.Release.Name | quote }}
chart: "{{.Chart.Name}}"
spec:
restartPolicy: Never
containers:
- name: migrate-data
image: "lachlanevenson/k8s-kubectl"
command: ["/bin/sh", "-c"]
args: ["(echo Creating directories; \
mkdir {{ .Values.influxdb.config.storage_directory }}/data || true) && \
(echo Moving data from /db/wal; \
mv {{ .Values.influxdb.config.storage_directory }}/db/wal {{ .Values.influxdb.config.storage_directory }} || true) && \
(echo Moving data from /db/*; \
mv {{ .Values.influxdb.config.storage_directory }}/db/* {{ .Values.influxdb.config.storage_directory }}/data;
rm -rf {{ .Values.influxdb.config.storage_directory }}/db || true)"]
volumeMounts:
- name: data
mountPath: {{ .Values.influxdb.config.storage_directory }}
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ .Values.influxdb.persistence.name }}
{{- end }}
23 changes: 11 additions & 12 deletions charts/monitor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,26 @@ grafana:
enabled: false
accessMode: ReadWriteOnce
size: 5Gi
influxdb:
telegraf:
org: "deisci"
pull_policy: "Always"
docker_tag: canary
# limits_cpu: "100m"
# limits_memory: "50Mi"

influxdb:
# Configure the following ONLY if using an off-cluster Influx database
url: "my.influx.url"
database: "kubernetes"
user: "user"
password: "password"
# Configure the following ONLY if you want persistence for on-cluster influxdb
# GCP PDs and EBS volumes are supported only
persistence:
enabled: false
accessMode: ReadWriteOnce
size: 20Gi
telegraf:
org: "deisci"
pull_policy: "Always"
docker_tag: canary
# limits_cpu: "100m"
# limits_memory: "50Mi"

enabled: true # Set to true to enable persistence
name: deis-monitor-influxdb
size: 20Gi # PVC size

global:
# Set the location of Workflow's influxdb cluster
#
Expand All @@ -41,4 +40,4 @@ global:
# Valid values are:
# - on-cluster: Run Grafana within the Kubernetes cluster
# - off-cluster: Grafana is running outside of the cluster
grafana_location: "on-cluster"
grafana_location: "on-cluster"

0 comments on commit a5099a3

Please sign in to comment.