1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-15 16:56:24 +00:00

kube-prometheus: Adjust to new Prometheus rule file CRD

89fc4e3069 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 254edd18d5
commit 62baa3f73c
No known key found for this signature in database
GPG key ID: 5403C5464810BC26
7 changed files with 835 additions and 391 deletions

View file

@ -60,7 +60,7 @@ spec:
- args:
- --kubelet-service=kube-system/kubelet
- --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1
- --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.0.4
- --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.19.0
image: quay.io/coreos/prometheus-operator:v0.19.0
name: prometheus-operator
ports:

View file

@ -7,7 +7,6 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
versions+:: {
prometheusOperator: 'v0.19.0',
configmapReloader: 'v0.0.1',
prometheusConfigReloader: 'v0.0.4',
},
imageRepos+:: {
@ -52,6 +51,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
'prometheuses/finalizers',
'alertmanagers/finalizers',
'servicemonitors',
'rulefiles',
]) +
policyRule.withVerbs(['*']);
@ -119,7 +119,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
container.withArgs([
'--kubelet-service=kube-system/kubelet',
'--config-reloader-image=' + $._config.imageRepos.configmapReloader + ':' + $._config.versions.configmapReloader,
'--prometheus-config-reloader=' + $._config.imageRepos.prometheusConfigReloader + ':' + $._config.versions.prometheusConfigReloader,
'--prometheus-config-reloader=' + $._config.imageRepos.prometheusConfigReloader + ':' + $._config.versions.prometheusOperator,
]) +
container.mixin.resources.withRequests({ cpu: '100m', memory: '50Mi' }) +
container.mixin.resources.withLimits({ cpu: '200m', memory: '100Mi' });

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;

View file

@ -17,6 +17,7 @@ rules:
- prometheuses/finalizers
- alertmanagers/finalizers
- servicemonitors
- rulefiles
verbs:
- '*'
- apiGroups:

View file

@ -19,7 +19,7 @@ spec:
- args:
- --kubelet-service=kube-system/kubelet
- --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1
- --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.0.4
- --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.19.0
image: quay.io/coreos/prometheus-operator:v0.19.0
name: prometheus-operator
ports:

File diff suppressed because it is too large Load diff

View file

@ -15,13 +15,37 @@ if [[ "${TRAVIS_PULL_REQUEST}" != "false" ]]; then
exit 0
fi
# Builds both prometheus-operator and prometheus-config-reloader
make crossbuild
#
# prometheus-operator
#
export REPO=quay.io/coreos/prometheus-operator
# Push to Quay '-dev' repo if not a git tag or master branch build
if [[ "${TRAVIS_TAG}" == "" ]] && [[ "${TRAVIS_BRANCH}" != master ]]; then
export REPO="${REPO}-dev"
fi
make crossbuild
# For both git tags and git branches 'TRAVIS_BRANCH' contains the name.
export TAG="${TRAVIS_BRANCH}"
make container
echo "${QUAY_PASSWORD}" | docker login -u "${QUAY_USERNAME}" --password-stdin quay.io
docker push "${REPO}:${TRAVIS_BRANCH}"
#
# prometheus-config-reloader
#
cd contrib/prometheus-config-reloader
export REPO=quay.io/coreos/prometheus-config-reloader
# Push to Quay '-dev' repo if not a git tag or master branch build
if [[ "${TRAVIS_TAG}" == "" ]] && [[ "${TRAVIS_BRANCH}" != master ]]; then
export REPO="${REPO}-dev"
fi
# For both git tags and git branches 'TRAVIS_BRANCH' contains the name.
export TAG="${TRAVIS_BRANCH}"