add service monitor to grafana

This commit is contained in:
Cyril Jouve
2019-01-08 19:48:24 +01:00
parent f7bb04a715
commit 3ec88e526b
3 changed files with 39 additions and 0 deletions

View File

@@ -15,7 +15,32 @@ local configMapList = k.core.v1.configMapList;
namespace: k.core.v1.namespace.new($._config.namespace), namespace: k.core.v1.namespace.new($._config.namespace),
}, },
grafana+:: { grafana+:: {
local serviceLabels = {
app: 'grafana',
},
dashboardDefinitions: configMapList.new(super.dashboardDefinitions), dashboardDefinitions: configMapList.new(super.dashboardDefinitions),
service+: {
labels+: serviceLabels,
},
serviceMonitor: {
apiVersion: 'monitoring.coreos.com/v1',
kind: 'ServiceMonitor',
metadata: {
name: 'grafana',
namespace: $._config.namespace,
},
spec: {
selector: {
matchLabels: serviceLabels,
},
endpoints: [
{
port: 'http',
interval: '15s',
},
],
},
},
}, },
} + { } + {
_config+:: { _config+:: {

View File

@@ -1,5 +1,7 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
labels:
app: grafana
metadata: metadata:
name: grafana name: grafana
namespace: monitoring namespace: monitoring

View File

@@ -0,0 +1,12 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: grafana
namespace: monitoring
spec:
endpoints:
- interval: 15s
port: http
selector:
matchLabels:
app: grafana