Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(influxdb): Use stable/influxdb chart #185

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,8 @@ spec:
name: influxdb-creds
key: password
{{- else }}
- name: "INFLUXDB_URLS"
value: http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT)
- 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
40 changes: 40 additions & 0 deletions charts/monitor/migrate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: batch/v1
kind: Job
metadata:
name: deis-monitor-migrate-data
annotations:
"helm.sh/hook": "pre-upgrade"
"helm.sh/hook-weight": "0"
spec:
template:
spec:
restartPolicy: Never
containers:
- name: deis-monitor-migrate-data
image: "lachlanevenson/k8s-kubectl"
command: ["/bin/sh", "-c"]
args: ["(if [ -d /var/lib/influxdb/data/_internal ]; then \
echo 'Nothing to migrate!'; \
else \
echo Creating directories; \
mkdir /var/lib/influxdb/data; \
(if [ -d /var/lib/influxdb/db/wal ]; then \
echo 'Moving data from /db/wal'; \
mv /var/lib/influxdb/db/wal /var/lib/influxdb; \
else \
echo 'Directory /var/lib/influxdb/db/wal does not exist!'; \
fi); \
(if [ -d /var/lib/influxdb/db/_internal ]; then \
echo 'Moving data from /db/*'; \
mv /var/lib/influxdb/db/* /var/lib/influxdb/data; \
else \
echo 'Directory /var/lib/influxdb/db does not exist!'; \
fi);
fi)"]
volumeMounts:
- name: data
mountPath: /var/lib/influxdb
volumes:
- name: data
persistentVolumeClaim:
claimName: deis-monitor-influxdb
10 changes: 10 additions & 0 deletions charts/monitor/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dependencies:
- condition: ""
enabled: false
import-values: null
name: influxdb
repository: http://127.0.0.1:8879
tags: null
version: 0.4.1
digest: sha256:b034be0df67d05c3f222f01f996fed5d2a70bbc4033500cb5dfd82b5b84651d2
generated: 2017-04-20T13:08:49.746407575-04:00
9 changes: 9 additions & 0 deletions charts/monitor/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# dependencies:
# - name: influxdb
# version: "0.4.0"
# repository: https://kubernetes-charts.storage.googleapis.com

dependencies:
- name: influxdb
version: "0.4.1"
repository: http://127.0.0.1:8879
36 changes: 36 additions & 0 deletions charts/monitor/templates/hook-delete-influxdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{- if eq .Values.global.influxdb_location "off-cluster" }}
apiVersion: batch/v1
kind: Job
metadata:
name: deis-monitor-delete-influxdb-deployment-{{ randAlphaNum 5 | lower }}
labels:
app: "deis-monitor-delete-influxdb-deployment"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "-10"
spec:
template:
metadata:
name: "{{.Release.Name}}"
labels:
app: "deis-monitor-delete-influxdb-deployment"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
spec:
restartPolicy: Never
containers:
- name: deis-monitor-delete-influxdb-deployment
image: "lachlanevenson/k8s-kubectl"
command: ["/bin/sh", "-c"]
args: ["(kubectl delete deploy {{.Release.Name}}-influxdb) \
|| \
true"]
- name: deis-monitor-delete-telegraf-pods
image: "lachlanevenson/k8s-kubectl"
command: ["/bin/sh", "-c"]
args: ["kubectl get pods | grep deis-monitor-telegraf | awk '{print $1}' | xargs kubectl delete pod \
|| \
true"]
{{- end }}
35 changes: 35 additions & 0 deletions charts/monitor/templates/hook-kill-pods.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{ $tillerVersion := semver .Capabilities.TillerVersion.SemVer }}
{{ $comparingVersion := semver "2.3.0" }}

{{- if gt ($tillerVersion | $comparingVersion.Compare) -1 }}
{{- if .Values.influxdb.persistence.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: deis-monitor-kill-pods-{{ randAlphaNum 5 | lower }}
labels:
app: "deis-monitor-kill-pods"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-weight": "-10"
spec:
template:
metadata:
name: "{{.Release.Name}}"
labels:
app: "deis-monitor-kill-pods"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
spec:
restartPolicy: Never
containers:
- name: deis-monitor-kill-pods
image: "lachlanevenson/k8s-kubectl"
command: ["/bin/sh", "-c"]
args: ["(kubectl delete daemonset deis-monitor-telegraf &&
kubectl delete deploy deis-monitor-influxdb &&
sleep 30) || true"]
{{- end }}
{{- end }}
57 changes: 57 additions & 0 deletions charts/monitor/templates/hook-migrate-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{ $tillerVersion := semver .Capabilities.TillerVersion.SemVer }}
{{ $comparingVersion := semver "2.3.0" }}

{{- if gt ($tillerVersion | $comparingVersion.Compare) -1 }}
{{- if .Values.influxdb.persistence.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: deis-monitor-migrate-data-{{ randAlphaNum 5 | lower }}
labels:
app: "deis-monitor-migrate-data"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-weight": "0"
spec:
template:
metadata:
name: "{{.Release.Name}}"
labels:
app: "deis-monitor-migrate-data"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
spec:
restartPolicy: Never
containers:
- name: deis-monitor-migrate-data
image: "lachlanevenson/k8s-kubectl"
command: ["/bin/sh", "-c"]
args: ["(if [ -d {{ .Values.influxdb.config.storage_directory }}/data/_internal ]; then \
echo 'Nothing to migrate!'; \
else \
echo Creating directories; \
mkdir {{ .Values.influxdb.config.storage_directory }}/data; \
(if [ -d {{ .Values.influxdb.config.storage_directory }}/db/wal ]; then \
echo 'Moving data from /db/wal'; \
mv {{ .Values.influxdb.config.storage_directory }}/db/wal {{ .Values.influxdb.config.storage_directory }}; \
else \
echo 'Directory {{ .Values.influxdb.config.storage_directory }}/db/wal does not exist!'; \
fi); \
(if [ -d {{ .Values.influxdb.config.storage_directory }}/db/_internal ]; then \
echo 'Moving data from /db/*'; \
mv {{ .Values.influxdb.config.storage_directory }}/db/* {{ .Values.influxdb.config.storage_directory }}/data; \
else \
echo 'Directory {{ .Values.influxdb.config.storage_directory }}/db does not exist!'; \
fi);
fi)"]
volumeMounts:
- name: data
mountPath: {{ .Values.influxdb.config.storage_directory }}
volumes:
- name: data
persistentVolumeClaim:
claimName: deis-monitor-influxdb
{{- end }}
{{- end }}
Loading