kube-prometheus: Adjust to new Prometheus rule file CRD

89fc4e306972604eba2dcb961a6d29cc27a668ad introduced the new Prometheus
rule file custom resource definition. This patch adjusts the
kube-prometheus project to use the new custom resource definition.
This commit is contained in:
Max Leonard Inden
2018-06-04 17:13:23 +02:00
parent a47d97859a
commit 8f3b505049
5 changed files with 809 additions and 389 deletions

View File

@@ -40,11 +40,21 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
service.mixin.metadata.withNamespace($._config.namespace) +
service.mixin.metadata.withLabels({ prometheus: $._config.prometheus.name }),
rules:
local configMap = k.core.v1.configMap;
configMap.new('prometheus-' + $._config.prometheus.name + '-rules', ({ 'all.rules.yaml': std.manifestYamlDoc($._config.prometheus.rules) } + $._config.prometheus.renderedRules)) +
configMap.mixin.metadata.withLabels({ role: 'alert-rules', prometheus: $._config.prometheus.name }) +
configMap.mixin.metadata.withNamespace($._config.namespace),
{
apiVersion: 'monitoring.coreos.com/v1',
kind: 'RuleFile',
metadata: {
labels: {
prometheus: $._config.prometheus.name,
role: 'alert-rules',
},
name: 'prometheus-' + $._config.prometheus.name + '-rules',
namespace: $._config.namespace,
},
spec: {
groups: $._config.prometheus.rules.groups,
},
},
roleBindingDefault:
local roleBinding = k.rbac.v1.roleBinding;