1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 19:49:46 +00:00

chore: update the Thanos Ruler example

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2024-11-18 13:46:57 +01:00
parent 35790cdbee
commit 37d466a531
No known key found for this signature in database
GPG key ID: 0190A66C0A10FC4F
6 changed files with 52 additions and 7 deletions

View file

@ -15,4 +15,4 @@ spec:
matchLabels:
app.kubernetes.io/name: prometheus
thanos:
version: v0.25.1
version: v0.36.1

View file

@ -23,7 +23,7 @@ spec:
- --query.replica-label=thanos_ruler_replica
- --store=dnssrv+_grpc._tcp.thanos-sidecar.default.svc.cluster.local
- --store=dnssrv+_grpc._tcp.thanos-ruler.default.svc.cluster.local
image: quay.io/thanos/thanos:v0.25.1
image: quay.io/thanos/thanos:v0.36.1
name: thanos-query
ports:
- containerPort: 10902

View file

@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
labels:
app.kubernetes.io/name: thanos-ruler
name: thanos-ruler
namespace: default
stringData:
query.yaml: '[{"static_configs": ["thanos-query.default.svc.cluster.local"]}]'
type: Opaque

View file

@ -6,9 +6,11 @@ metadata:
name: thanos-ruler
namespace: default
spec:
image: quay.io/thanos/thanos:v0.25.1
queryEndpoints:
- dnssrv+_http._tcp.thanos-query.default.svc.cluster.local
image: quay.io/thanos/thanos:v0.36.1
queryConfig:
key: query.yaml
name: thanos-ruler
ruleSelector:
matchLabels:
role: thanos-example
version: v0.36.1

View file

@ -20,7 +20,7 @@ local service(name, namespace, labels, selector, ports) = {
thanosRulerName: 'thanos-ruler',
thanosSidecarName: 'thanos-sidecar',
versions+:: {
thanos: 'v0.25.1',
thanos: 'v0.36.1',
},
imageRepos+:: {
@ -40,8 +40,10 @@ local service(name, namespace, labels, selector, ports) = {
},
},
thanos+:: {
local po = self,
namespace:: $._config.namespace,
image:: $._config.imageRepos.thanos,
version:: $._config.versions.thanos,
@ -54,6 +56,7 @@ local service(name, namespace, labels, selector, ports) = {
thanosQueryName:: $._config.thanosQueryName,
thanosRulerName:: $._config.thanosRulerName,
thanosSidecarName:: $._config.thanosSidecarName,
prometheus+:: {
apiVersion: 'monitoring.coreos.com/v1',
kind: 'Prometheus',
@ -80,6 +83,7 @@ local service(name, namespace, labels, selector, ports) = {
},
},
},
clusterRole: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRole',
@ -103,6 +107,7 @@ local service(name, namespace, labels, selector, ports) = {
},
],
},
clusterRoleBinding: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRoleBinding',
@ -120,6 +125,7 @@ local service(name, namespace, labels, selector, ports) = {
namespace: po.namespace,
}],
},
service: service(
po.prometheusName,
po.namespace,
@ -127,6 +133,7 @@ local service(name, namespace, labels, selector, ports) = {
po.prometheusLabels,
[{ name: 'web', port: 9090, targetPort: 'web' }]
),
serviceMonitor:
{
apiVersion: 'monitoring.coreos.com/v1',
@ -150,6 +157,7 @@ local service(name, namespace, labels, selector, ports) = {
},
},
},
queryDeployment: {
apiVersion: 'apps/v1',
kind: 'Deployment',
@ -192,6 +200,7 @@ local service(name, namespace, labels, selector, ports) = {
},
},
},
queryService: service(
po.thanosQueryName,
po.namespace,
@ -199,6 +208,7 @@ local service(name, namespace, labels, selector, ports) = {
po.queryLabels,
[{ name: 'http', port: 10902, targetPort: 'http' }]
),
sidecarService: {
apiVersion: 'v1',
kind: 'Service',
@ -217,6 +227,7 @@ local service(name, namespace, labels, selector, ports) = {
clusterIP: 'None',
},
},
thanosRuler:
{
apiVersion: 'monitoring.coreos.com/v1',
@ -233,9 +244,29 @@ local service(name, namespace, labels, selector, ports) = {
role: 'thanos-example',
},
},
queryEndpoints: ['dnssrv+_http._tcp.thanos-query.default.svc.cluster.local'],
queryConfig: {
name: po.thanosRulerSecret.metadata.name,
key: 'query.yaml',
},
version: po.version,
},
},
thanosRulerSecret:
{
apiVersion: 'v1',
kind: 'Secret',
metadata: {
labels: po.rulerLabels,
name: po.thanosRulerName,
namespace: po.namespace,
},
type: 'Opaque',
stringData: {
'query.yaml': '[{"static_configs": ["%s.%s.svc.cluster.local"]}]' % [po.thanosQueryName, po.namespace],
},
},
prometheusRule:
{
apiVersion: 'monitoring.coreos.com/v1',
@ -260,6 +291,7 @@ local service(name, namespace, labels, selector, ports) = {
}],
},
},
thanosRulerService: service(
po.thanosRulerName,
po.namespace,

View file

@ -12,4 +12,5 @@ local po = (import 'thanos/config.libsonnet').thanos;
'thanos-ruler.yaml': po.thanosRuler,
'prometheus-rule.yaml': po.prometheusRule,
'thanos-ruler-service.yaml': po.thanosRulerService,
'thanos-ruler-secret.yaml': po.thanosRulerSecret,
}