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
0e7dc97b
Unverified
Commit
0e7dc97b
authored
3 years ago
by
Maxime Brunet
Browse files
Options
Downloads
Patches
Plain Diff
Create Thanos Sidecar rules separately from Prometheus ones
parent
a330e863
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jsonnet/kube-prometheus/components/prometheus.libsonnet
+31
-14
31 additions, 14 deletions
jsonnet/kube-prometheus/components/prometheus.libsonnet
with
31 additions
and
14 deletions
jsonnet/kube-prometheus/components/prometheus.libsonnet
+
31
−
14
View file @
0e7dc97b
...
@@ -50,20 +50,21 @@ function(params) {
...
@@ -50,20 +50,21 @@ function(params) {
assert
std
.
isObject
(
p
.
_config
.
resources
),
assert
std
.
isObject
(
p
.
_config
.
resources
),
assert
std
.
isObject
(
p
.
_config
.
mixin
.
_config
),
assert
std
.
isObject
(
p
.
_config
.
mixin
.
_config
),
mixin
::
(
import
'github.com/prometheus/prometheus/documentation/prometheus-mixin/mixin.libsonnet'
)
+
mixin
::
(
import
'github.com/kubernetes-monitoring/kubernetes-mixin/lib/add-runbook-links.libsonnet'
)
+
(
(
import
'github.com/prometheus/prometheus/documentation/prometheus-mixin/mixin.libsonnet'
)
+
if
p
.
_config
.
thanos
!
=
{}
then
(
import
'github.com/kubernetes-monitoring/kubernetes-mixin/lib/add-runbook-links.libsonnet'
)
+
{
(
import
'github.com/thanos-io/thanos/mixin/alerts/sidecar.libsonnet'
)
+
{
_config
+::
p
.
_config
.
mixin
.
_config
,
targetGroups
:
{},
},
sidecar
:
{
selector
:
p
.
_config
.
mixin
.
_config
.
thanosSelector
,
mixinThanos
::
dimensions
:
std
.
join
(
', '
,
[
'job'
,
'instance'
]),
(
import
'github.com/thanos-io/thanos/mixin/alerts/sidecar.libsonnet'
)
+
},
(
import
'github.com/kubernetes-monitoring/kubernetes-mixin/lib/add-runbook-links.libsonnet'
)
+
{
}
targetGroups
:
{},
else
{}
sidecar
:
{
)
{
selector
:
p
.
_config
.
mixin
.
_config
.
thanosSelector
,
_config
+::
p
.
_config
.
mixin
.
_config
,
dimensions
:
std
.
join
(
', '
,
[
'job'
,
'instance'
]),
},
},
},
prometheusRule
:
{
prometheusRule
:
{
apiVersion
:
'monitoring.coreos.com/v1'
,
apiVersion
:
'monitoring.coreos.com/v1'
,
...
@@ -327,6 +328,22 @@ function(params) {
...
@@ -327,6 +328,22 @@ function(params) {
},
},
},
},
// Include thanos sidecar PrometheusRule only if thanos config was passed by user
[
if
std
.
objectHas
(
params
,
'thanos'
)
&&
std
.
length
(
params
.
thanos
)
>
0
then
'prometheusRuleThanosSidecar'
]:
{
apiVersion
:
'monitoring.coreos.com/v1'
,
kind
:
'PrometheusRule'
,
metadata
:
{
labels
:
p
.
_config
.
commonLabels
+
p
.
_config
.
mixin
.
ruleLabels
,
name
:
'prometheus-'
+
p
.
_config
.
name
+
'-thanos-sidecar-rules'
,
namespace
:
p
.
_config
.
namespace
,
},
spec
:
{
local
r
=
if
std
.
objectHasAll
(
p
.
mixinThanos
,
'prometheusRules'
)
then
p
.
mixinThanos
.
prometheusRules
.
groups
else
[],
local
a
=
if
std
.
objectHasAll
(
p
.
mixinThanos
,
'prometheusAlerts'
)
then
p
.
mixinThanos
.
prometheusAlerts
.
groups
else
[],
groups
:
a
+
r
,
},
},
// Include thanos sidecar Service only if thanos config was passed by user
// Include thanos sidecar Service only if thanos config was passed by user
[
if
std
.
objectHas
(
params
,
'thanos'
)
&&
std
.
length
(
params
.
thanos
)
>
0
then
'serviceThanosSidecar'
]:
{
[
if
std
.
objectHas
(
params
,
'thanos'
)
&&
std
.
length
(
params
.
thanos
)
>
0
then
'serviceThanosSidecar'
]:
{
apiVersion
:
'v1'
,
apiVersion
:
'v1'
,
...
...
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