Skip to content
Snippets Groups Projects
Commit 874be477 authored by Simon Pasquier's avatar Simon Pasquier
Browse files

Thanos sidecar: use fields from the prometheus object


Instead of name and namespace fields coming from the global config.

Signed-off-by: default avatarSimon Pasquier <spasquie@redhat.com>
parent 409add16
Branches
Tags
No related merge requests found
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
}, },
}, },
prometheus+:: { prometheus+:: {
local p = self,
// Add the grpc port to the Prometheus service to be able to query it with the Thanos Querier // Add the grpc port to the Prometheus service to be able to query it with the Thanos Querier
service+: { service+: {
spec+: { spec+: {
...@@ -23,16 +25,16 @@ ...@@ -23,16 +25,16 @@
apiVersion: 'v1', apiVersion: 'v1',
kind: 'Service', kind: 'Service',
metadata: { metadata: {
name: 'prometheus-' + $._config.prometheus.name + '-thanos-sidecar', name: 'prometheus-' + p.name + '-thanos-sidecar',
namespace: $._config.namespace, namespace: p.namespace,
labels: { prometheus: $._config.prometheus.name, app: 'thanos-sidecar' }, labels: { prometheus: p.name, app: 'thanos-sidecar' },
}, },
spec: { spec: {
ports: [ ports: [
{ name: 'grpc', port: 10901, targetPort: 10901 }, { name: 'grpc', port: 10901, targetPort: 10901 },
{ name: 'http', port: 10902, targetPort: 10902 }, { name: 'http', port: 10902, targetPort: 10902 },
], ],
selector: { app: 'prometheus', prometheus: $._config.prometheus.name }, selector: { app: 'prometheus', prometheus: p.name },
clusterIP: 'None', clusterIP: 'None',
}, },
}, },
...@@ -51,7 +53,7 @@ ...@@ -51,7 +53,7 @@
kind: 'ServiceMonitor', kind: 'ServiceMonitor',
metadata: { metadata: {
name: 'thanos-sidecar', name: 'thanos-sidecar',
namespace: $._config.namespace, namespace: p.namespace,
labels: { labels: {
'k8s-app': 'prometheus', 'k8s-app': 'prometheus',
}, },
...@@ -61,7 +63,7 @@ ...@@ -61,7 +63,7 @@
jobLabel: 'app', jobLabel: 'app',
selector: { selector: {
matchLabels: { matchLabels: {
prometheus: $._config.prometheus.name, prometheus: p.name,
app: 'thanos-sidecar', app: 'thanos-sidecar',
}, },
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment