Skip to content

Commit adedd69

Browse files
committed
feat(monitor): Allow for off cluster influxdb
1 parent 5812cc3 commit adedd69

8 files changed

Lines changed: 90 additions & 2 deletions

File tree

charts/monitor/charts/grafana/templates/monitor-grafana-deployment.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if eq .Values.global.grafana_location "on-cluster" }}
12
apiVersion: extensions/v1beta1
23
kind: Deployment
34
metadata:
@@ -36,8 +37,31 @@ spec:
3637
{{- end}}
3738
{{- end}}
3839
env:
40+
{{- if eq .Values.global.influxdb_location "off-cluster" }}
41+
- name: "INFLUXDB_SERVICE_URL"
42+
valueFrom:
43+
secretKeyRef:
44+
name: influxdb-creds
45+
key: url
46+
- name: "INFLUXDB_DATABASE"
47+
valueFrom:
48+
secretKeyRef:
49+
name: influxdb-creds
50+
key: database
51+
- name: "INFLUXDB_USER"
52+
valueFrom:
53+
secretKeyRef:
54+
name: influxdb-creds
55+
key: user
56+
- name: "INFLUXDB_PASSWORD"
57+
valueFrom:
58+
secretKeyRef:
59+
name: influxdb-creds
60+
key: password
61+
{{- else }}
3962
- name: "INFLUXDB_URLS"
4063
value: http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT)
64+
{{- end }}
4165
- name: "BIND_PORT"
4266
value: "3500"
4367
- name: "DEFAULT_USER"
@@ -47,3 +71,4 @@ spec:
4771
ports:
4872
- containerPort: 3500
4973
name: ui
74+
{{- end }}

charts/monitor/charts/grafana/templates/monitor-grafana-svc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if eq .Values.global.grafana_location "on-cluster" }}
12
apiVersion: v1
23
kind: Service
34
metadata:
@@ -17,3 +18,4 @@ spec:
1718
targetPort: ui
1819
selector:
1920
app: deis-monitor-grafana
21+
{{- end }}

charts/monitor/charts/influxdb/templates/monitor-influxdb-api-svc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if eq .Values.global.influxdb_location "on-cluster" }}
12
apiVersion: v1
23
kind: Service
34
metadata:
@@ -17,3 +18,4 @@ spec:
1718
targetPort: transport
1819
selector:
1920
app: deis-monitor-influxdb
21+
{{- end }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if eq .Values.global.influxdb_location "off-cluster" }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: influxdb-creds
6+
labels:
7+
heritage: deis
8+
type: Opaque
9+
data:
10+
url: {{ .Values.url | b64enc }}
11+
database: {{ .Values.database | b64enc }}
12+
user: {{ .Values.user | b64enc }}
13+
password: {{ .Values.password | b64enc }}
14+
{{- end }}

charts/monitor/charts/influxdb/templates/monitor-influxdb-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if eq .Values.global.influxdb_location "on-cluster" }}
12
apiVersion: extensions/v1beta1
23
kind: Deployment
34
metadata:
@@ -53,3 +54,4 @@ spec:
5354
port: 8086
5455
initialDelaySeconds: 1
5556
timeoutSeconds: 1
57+
{{- end }}

charts/monitor/charts/influxdb/templates/monitor-influxdb-ui-svc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if eq .Values.global.influxdb_location "on-cluster" }}
12
apiVersion: v1
23
kind: Service
34
metadata:
@@ -17,3 +18,4 @@ spec:
1718
targetPort: admin
1819
selector:
1920
app: deis-monitor-influxdb
21+
{{- end }}

charts/monitor/charts/telegraf/templates/monitor-telegraf-daemon.yaml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,35 @@ spec:
3232
valueFrom:
3333
fieldRef:
3434
fieldPath: metadata.namespace
35+
{{- if eq .Values.global.influxdb_location "off-cluster" }}
36+
- name: "INFLUXDB_URLS"
37+
valueFrom:
38+
secretKeyRef:
39+
name: influxdb-creds
40+
key: url
41+
- name: "INFLUXDB_DATABASE"
42+
valueFrom:
43+
secretKeyRef:
44+
name: influxdb-creds
45+
key: database
46+
- name: "INFLUXDB_USERNAME"
47+
valueFrom:
48+
secretKeyRef:
49+
name: influxdb-creds
50+
key: user
51+
- name: "INFLUXDB_PASSWORD"
52+
valueFrom:
53+
secretKeyRef:
54+
name: influxdb-creds
55+
key: password
56+
{{- else }}
3557
- name: "INFLUXDB_URLS"
3658
value: "\"http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT)\""
3759
- name: "INFLUXDB_INPUT_URLS"
3860
value: "\"http://$(DEIS_MONITOR_INFLUXAPI_SERVICE_HOST):$(DEIS_MONITOR_INFLUXAPI_SERVICE_PORT_TRANSPORT)/debug/vars\""
61+
- name: "ENABLE_INFLUXDB_INPUT"
62+
value: "true"
63+
{{- end }}
3964
- name: "HOST_PROC"
4065
value: "/rootfs/proc"
4166
- name: "HOST_SYS"
@@ -44,8 +69,6 @@ spec:
4469
value: "true"
4570
- name: "AGENT_BUFFER_LIMIT"
4671
value: "100000"
47-
- name: "ENABLE_INFLUXDB_INPUT"
48-
value: "true"
4972
- name: "ENABLE_KUBERNETES"
5073
value: "true"
5174
- name: "NSQ_CONSUMER_SERVER"

charts/monitor/values.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,27 @@ influxdb:
1010
docker_tag: canary
1111
# limits_cpu: "100m"
1212
# limits_memory: "50Mi"
13+
url: "my.influx.url"
14+
database: "kubernetes"
15+
user: "user"
16+
password: "password"
1317
telegraf:
1418
org: "deisci"
1519
pull_policy: "Always"
1620
docker_tag: canary
1721
# limits_cpu: "100m"
1822
# limits_memory: "50Mi"
23+
24+
global:
25+
# Set the location of Workflow's influxdb cluster
26+
#
27+
# Valid values are:
28+
# - on-cluster: Run Influxdb within the Kubernetes cluster
29+
# - off-cluster: Influxdb is running outside of the cluster and credentials and connection information will be provided.
30+
influxdb_location: "on-cluster"
31+
# Set the location of Workflow's grafana instance
32+
#
33+
# Valid values are:
34+
# - on-cluster: Run Grafana within the Kubernetes cluster
35+
# - off-cluster: Grafana is running outside of the cluster
36+
grafana_location: "on-cluster"

0 commit comments

Comments
 (0)