rpi.carlosedp.cluster-monit.../modules/nginx.jsonnet

45 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2020-08-16 05:45:18 +02:00
local utils = import '../utils.libsonnet';
local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
{
_config+:: {
namespace: 'monitoring',
grafanaDashboards+:: {
'nginx-dashboard.json': (import '../grafana-dashboards/nginx-dashboard.json'),
},
},
nginxExporter+:: {
serviceMonitor:
utils.newServiceMonitor('nginx', $._config.namespace, { 'app.kubernetes.io/name': 'ingress-nginx' }, 'ingress-nginx', 'prometheus', 'http'),
service:
local service = k.core.v1.service;
local servicePort = k.core.v1.service.mixin.spec.portsType;
local nginxPort = servicePort.newNamed('prometheus', 10254, 10254);
2020-08-16 06:14:16 +02:00
service.new('ingress-nginx-metrics', {'app.kubernetes.io/name': 'ingress-nginx'}, nginxPort) +
2020-08-16 05:47:13 +02:00
service.mixin.metadata.withNamespace('ingress-nginx') +
2020-08-16 05:45:18 +02:00
service.mixin.metadata.withLabels({'app.kubernetes.io/name': 'ingress-nginx'}) +
service.mixin.spec.withClusterIp('None'),
clusterRole:
utils.newClusterRole('nginx-exporter', [
{
apis: [''],
res: ['services', 'endpoints', 'pods'],
verbs: ['get', 'list', 'watch'],
},
], null),
serviceAccount:
utils.newServiceAccount('nginx-exporter', $._config.namespace, null),
2020-08-16 05:45:18 +02:00
clusterRoleBinding:
utils.newClusterRoleBinding('nginx-exporter', 'nginx-exporter', $._config.namespace, 'nginx-exporter', null),
},
}