Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kube-prometheus
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
prometheus-operator
kube-prometheus
Commits
9cf2ce9f
Unverified
Commit
9cf2ce9f
authored
4 years ago
by
paulfantom
Browse files
Options
Downloads
Patches
Plain Diff
jsonnet: create function responsible for prometheus objects
Signed-off-by:
paulfantom
<
pawel@krupa.net.pl
>
parent
6b11d79c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jsonnet/kube-prometheus/kube-prometheus.libsonnet
+35
-24
35 additions, 24 deletions
jsonnet/kube-prometheus/kube-prometheus.libsonnet
jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
+404
-408
404 additions, 408 deletions
jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
with
439 additions
and
432 deletions
jsonnet/kube-prometheus/kube-prometheus.libsonnet
+
35
−
24
View file @
9cf2ce9f
...
@@ -5,16 +5,15 @@ local blackboxExporter = import './blackbox-exporter/blackbox-exporter.libsonnet
...
@@ -5,16 +5,15 @@ local blackboxExporter = import './blackbox-exporter/blackbox-exporter.libsonnet
local
kubeStateMetrics
=
import
'./kube-state-metrics/kube-state-metrics.libsonnet'
;
local
kubeStateMetrics
=
import
'./kube-state-metrics/kube-state-metrics.libsonnet'
;
local
nodeExporter
=
import
'./node-exporter/node-exporter.libsonnet'
;
local
nodeExporter
=
import
'./node-exporter/node-exporter.libsonnet'
;
local
prometheusAdapter
=
import
'./prometheus-adapter/prometheus-adapter.libsonnet'
;
local
prometheusAdapter
=
import
'./prometheus-adapter/prometheus-adapter.libsonnet'
;
local
prometheus
=
import
'./prometheus/prometheus.libsonnet'
;
local
monitoringMixins
=
import
'./mixins/monitoring-mixins.libsonnet'
;
local
monitoringMixins
=
import
'./mixins/monitoring-mixins.libsonnet'
;
(
import
'github.com/brancz/kubernetes-grafana/grafana/grafana.libsonnet'
)
+
(
import
'github.com/brancz/kubernetes-grafana/grafana/grafana.libsonnet'
)
+
(
import
'github.com/prometheus-operator/prometheus-operator/jsonnet/prometheus-operator/prometheus-operator.libsonnet'
)
+
(
import
'github.com/prometheus-operator/prometheus-operator/jsonnet/prometheus-operator/prometheus-operator.libsonnet'
)
+
(
import
'./prometheus/prometheus.libsonnet'
)
+
{
{
alertmanager
:
alertmanager
({
alertmanager
:
alertmanager
({
name
:
'main'
,
name
:
$
.
_config
.
alertmanagerName
,
namespace
:
$
.
_config
.
namespace
,
namespace
:
$
.
_config
.
namespace
,
version
:
'0.21.0'
,
version
:
'0.21.0'
,
image
:
'quay.io/prometheus/alertmanager:v0.21.0'
,
image
:
'quay.io/prometheus/alertmanager:v0.21.0'
,
...
@@ -34,6 +33,14 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
...
@@ -34,6 +33,14 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
version
:
'1.0.1'
,
version
:
'1.0.1'
,
image
:
'quay.io/prometheus/node-exporter:v1.0.1'
,
image
:
'quay.io/prometheus/node-exporter:v1.0.1'
,
}),
}),
prometheus
:
prometheus
({
namespace
:
$
.
_config
.
namespace
,
version
:
'2.24.0'
,
image
:
'quay.io/prometheus/prometheus:v2.24.0'
,
name
:
$
.
_config
.
prometheusName
,
alertmanagerName
:
$
.
_config
.
alertmanagerName
,
rules
:
$
.
allRules
,
}),
prometheusAdapter
:
prometheusAdapter
({
prometheusAdapter
:
prometheusAdapter
({
namespace
:
$
.
_config
.
namespace
,
namespace
:
$
.
_config
.
namespace
,
version
:
'0.8.2'
,
version
:
'0.8.2'
,
...
@@ -42,9 +49,24 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
...
@@ -42,9 +49,24 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
}),
}),
mixins
+::
monitoringMixins
({
mixins
+::
monitoringMixins
({
namespace
:
$
.
_config
.
namespace
,
namespace
:
$
.
_config
.
namespace
,
alertmanagerName
:
'main'
,
alertmanagerName
:
$
.
_config
.
alertmanagerName
,
prometheusName
:
'k8s'
,
prometheusName
:
$
.
_config
.
prometheusName
,
}),
}),
// FIXME(paulfantom) Remove this variable by moving each mixin to its own component
// Example: node_exporter mixin could be added in ./node-exporter/node-exporter.libsonnet
allRules
::
$
.
mixins
.
nodeExporter
.
prometheusRules
+
$
.
mixins
.
kubernetes
.
prometheusRules
+
$
.
mixins
.
base
.
prometheusRules
+
$
.
mixins
.
kubeStateMetrics
.
prometheusAlerts
+
$
.
mixins
.
nodeExporter
.
prometheusAlerts
+
$
.
mixins
.
alertmanager
.
prometheusAlerts
+
$
.
mixins
.
prometheusOperator
.
prometheusAlerts
+
$
.
mixins
.
kubernetes
.
prometheusAlerts
+
$
.
mixins
.
prometheus
.
prometheusAlerts
+
$
.
mixins
.
base
.
prometheusAlerts
,
kubePrometheus
+::
{
kubePrometheus
+::
{
namespace
:
{
namespace
:
{
apiVersion
:
'v1'
,
apiVersion
:
'v1'
,
...
@@ -143,6 +165,8 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
...
@@ -143,6 +165,8 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
}
+
{
}
+
{
_config
+::
{
_config
+::
{
namespace
:
'default'
,
namespace
:
'default'
,
prometheusName
:
'k8s'
,
alertmanagerName
:
'main'
,
versions
+::
{
grafana
:
'7.3.5'
,
kubeRbacProxy
:
'v0.8.0'
},
versions
+::
{
grafana
:
'7.3.5'
,
kubeRbacProxy
:
'v0.8.0'
},
imageRepos
+::
{
kubeRbacProxy
:
'quay.io/brancz/kube-rbac-proxy'
},
imageRepos
+::
{
kubeRbacProxy
:
'quay.io/brancz/kube-rbac-proxy'
},
...
@@ -187,24 +211,6 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
...
@@ -187,24 +211,6 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
},
},
},
},
local
allRules
=
$
.
mixins
.
nodeExporter
.
prometheusRules
+
$
.
mixins
.
kubernetes
.
prometheusRules
+
$
.
mixins
.
base
.
prometheusRules
+
$
.
mixins
.
kubeStateMetrics
.
prometheusAlerts
+
$
.
mixins
.
nodeExporter
.
prometheusAlerts
+
$
.
mixins
.
alertmanager
.
prometheusAlerts
+
$
.
mixins
.
prometheusOperator
.
prometheusAlerts
+
$
.
mixins
.
kubernetes
.
prometheusAlerts
+
$
.
mixins
.
prometheus
.
prometheusAlerts
+
$
.
mixins
.
base
.
prometheusAlerts
,
local
allDashboards
=
$
.
mixins
.
nodeExporter
.
grafanaDashboards
+
$
.
mixins
.
kubernetes
.
grafanaDashboards
+
$
.
mixins
.
prometheus
.
grafanaDashboards
,
prometheus
+::
{
rules
:
allRules
},
grafana
+::
{
grafana
+::
{
labels
:
{
labels
:
{
'app.kubernetes.io/name'
:
'grafana'
,
'app.kubernetes.io/name'
:
'grafana'
,
...
@@ -212,7 +218,12 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
...
@@ -212,7 +218,12 @@ local monitoringMixins = import './mixins/monitoring-mixins.libsonnet';
'app.kubernetes.io/component'
:
'grafana'
,
'app.kubernetes.io/component'
:
'grafana'
,
'app.kubernetes.io/part-of'
:
'kube-prometheus'
,
'app.kubernetes.io/part-of'
:
'kube-prometheus'
,
},
},
dashboards
:
allDashboards
,
// FIXME(paulfantom): Same as with rules and alerts.
// This should be gathering all dashboards from components without having to enumerate all dashboards.
dashboards
:
$
.
mixins
.
nodeExporter
.
grafanaDashboards
+
$
.
mixins
.
kubernetes
.
grafanaDashboards
+
$
.
mixins
.
prometheus
.
grafanaDashboards
,
},
},
},
},
}
}
This diff is collapsed.
Click to expand it.
jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
+
404
−
408
View file @
9cf2ce9f
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment