From: bravof Date: Fri, 3 Jul 2020 14:01:42 +0000 (-0400) Subject: feat(prometheus): conditional copy of new configuration from configmap avoiding accid... X-Git-Tag: v8.0.0rc3~28 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fdevops.git;a=commitdiff_plain;h=11a6fedc8882a44b915d4648c38b24492fcde5cb feat(prometheus): conditional copy of new configuration from configmap avoiding accidental overwrite of previous config file Change-Id: I2074318c6e259c4210faaa2ad362114a6fada827 Signed-off-by: bravof (cherry picked from commit 9d2556f36dc275078425597b2ec64a4a5eea308d) --- diff --git a/installers/docker/osm_pods/prometheus.yaml b/installers/docker/osm_pods/prometheus.yaml index f7fd5698..93cd20ae 100644 --- a/installers/docker/osm_pods/prometheus.yaml +++ b/installers/docker/osm_pods/prometheus.yaml @@ -85,10 +85,12 @@ spec: - name: prometheus-init-config image: busybox command: ["/bin/sh", "-c"] - args: ["printf \"global:\\n scrape_interval: 15s\\n evaluation_interval: 15s\\nscrape_configs:\\n - job_name: 'prometheus'\\n static_configs:\\n - targets: ['mon:8000']\" > /etc/prometheus/prometheus.yml"] + args: ['if [ ! -f "/etc/prometheus/prometheus.yml" ]; then cp /etc/prometheus_init/prometheus.yml /etc/prometheus; fi'] volumeMounts: - name: prom-config mountPath: /etc/prometheus + - name: init-prom-config + mountPath: /etc/prometheus_init containers: - name: prometheus image: prom/prometheus:v2.4.3 @@ -109,3 +111,6 @@ spec: - name: prom-config hostPath: path: /var/lib/osm/prometheus + - name: init-prom-config + configMap: + name: prom