From dc77f255de2b594d03b1b37a4ae8f3c2f08825e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= <benoit.knecht@fsfe.org>
Date: Thu, 24 Oct 2019 09:39:04 +0200
Subject: [PATCH] prometheus: Let name and replicas be set in _config

Before #260, the Prometheus name and number of replicas could be
configured in `_config.prometheus.name` and
`_config.prometheus.replicas` respectively.

It isn't the case anymore, which means that configurations that did set
a custom name for Prometheus will get a second Prometheus instance
called `k8s` when they upgrade kube-prometheus.

This commit adds back the ability to configure both of these parameters
in `_config`.
---
 jsonnet/kube-prometheus/prometheus/prometheus.libsonnet | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet b/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
index 42baf52a..5e817a11 100644
--- a/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
+++ b/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
@@ -18,6 +18,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
     },
 
     prometheus+:: {
+      name: 'k8s',
+      replicas: 2,
       rules: {},
       namespaces: ['default', 'kube-system', $._config.namespace],
     },
@@ -26,10 +28,10 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
   prometheus+:: {
     local p = self,
 
-    name:: 'k8s',
+    name:: $._config.prometheus.name,
     namespace:: $._config.namespace,
     roleBindingNamespaces:: $._config.prometheus.namespaces,
-    replicas:: 2,
+    replicas:: $._config.prometheus.replicas,
     prometheusRules:: $._config.prometheus.rules,
     alertmanagerName:: $.alertmanager.service.metadata.name,
 
-- 
GitLab