2020-05-26 01:23:56 +02:00
|
|
|
local utils = import '../utils.libsonnet';
|
2019-08-08 22:09:53 +02:00
|
|
|
local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
|
2019-02-04 21:01:11 +01:00
|
|
|
|
2019-02-27 13:28:00 +01:00
|
|
|
{
|
2019-02-04 21:01:11 +01:00
|
|
|
_config+:: {
|
|
|
|
namespace: 'monitoring',
|
2019-03-25 22:01:00 +01:00
|
|
|
|
|
|
|
prometheus+:: {
|
|
|
|
namespaces+:: ['metallb-system'],
|
|
|
|
},
|
|
|
|
|
2019-02-04 21:01:11 +01:00
|
|
|
},
|
|
|
|
|
2019-05-07 17:16:16 +02:00
|
|
|
metallbExporter+:: {
|
2019-02-04 21:01:11 +01:00
|
|
|
serviceMonitor:
|
2020-03-18 22:01:01 +01:00
|
|
|
utils.newServiceMonitor('metallb', $._config.namespace, { 'k8s-app': 'metallb-controller' }, 'metallb-system', 'http', 'http'),
|
2019-02-04 21:01:11 +01:00
|
|
|
|
|
|
|
service:
|
|
|
|
local service = k.core.v1.service;
|
|
|
|
local servicePort = k.core.v1.service.mixin.spec.portsType;
|
|
|
|
local metallbPort = servicePort.newNamed('http', 7472, 7472);
|
|
|
|
|
2019-03-13 22:44:01 +01:00
|
|
|
service.new('metallb-controller', { app: 'metallb', component: 'controller' }, metallbPort) +
|
2019-02-04 21:01:11 +01:00
|
|
|
service.mixin.metadata.withNamespace('metallb-system') +
|
|
|
|
service.mixin.metadata.withLabels({ 'k8s-app': 'metallb-controller' }) +
|
|
|
|
service.mixin.spec.withClusterIp('None'),
|
2020-08-16 06:46:50 +02:00
|
|
|
|
|
|
|
clusterRole:
|
|
|
|
utils.newClusterRole('metallb-exporter', [
|
|
|
|
{
|
|
|
|
apis: [''],
|
|
|
|
res: ['services', 'endpoints', 'pods'],
|
|
|
|
verbs: ['get', 'list', 'watch'],
|
|
|
|
},
|
|
|
|
], null),
|
|
|
|
|
|
|
|
|
|
|
|
clusterRoleBinding:
|
2020-10-13 18:15:52 +02:00
|
|
|
utils.newClusterRoleBinding('metallb-exporter', 'prometheus-k8s', $._config.namespace, 'metallb-exporter', null),
|
2020-08-16 06:46:50 +02:00
|
|
|
|
|
|
|
|
2019-02-04 21:01:11 +01:00
|
|
|
},
|
2019-03-13 22:44:01 +01:00
|
|
|
}
|