summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-10-23 20:37:31 +0000
committerGerrit Code Review <review@openstack.org>2018-10-23 20:37:31 +0000
commit62a143c1c18be3d86d4b70275780f3a8c0971841 (patch)
treef3783ebc8fcf113ffa0c1085e407a39061d5dd85
parent1abf21da0575bb9783c45cddb723b25b2a093915 (diff)
parentbc36ef8fb6604f0285cc922d20430ed13c7bc332 (diff)
Merge "Add prometheus-monitoring namespace"
-rw-r--r--magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh b/magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh
index 3eb770e..5fdc915 100644
--- a/magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh
+++ b/magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh
@@ -280,6 +280,19 @@ EOF
280) 280)
281writeFile $prometheusService_file "$prometheusService_content" 281writeFile $prometheusService_file "$prometheusService_content"
282 282
283# Write the file for prometheus-monitoring namespace
284prometheusNamespace_file=/srv/magnum/kubernetes/monitoring/prometheusNamespace.yaml
285prometheusNamespace_content=$(cat <<EOF
286apiVersion: v1
287kind: Namespace
288metadata:
289 labels:
290 name: prometheus-monitoring
291 name: prometheus-monitoring
292EOF
293)
294writeFile $prometheusNamespace_file "$prometheusNamespace_content"
295
283grafanaService_file=/srv/magnum/kubernetes/monitoring/grafanaService.yaml 296grafanaService_file=/srv/magnum/kubernetes/monitoring/grafanaService.yaml
284grafanaService_content=$(cat <<EOF 297grafanaService_content=$(cat <<EOF
285apiVersion: v1 298apiVersion: v1
@@ -375,6 +388,13 @@ do
375 sleep 5 388 sleep 5
376done 389done
377 390
391# Check if prometheus-monitoring namespace exist already before creating the namespace
392kubectl get namespace prometheus-monitoring
393if [ "$?" != "0" ] && \
394 [ -f "'''${PROMETHEUS_MON_BASE_DIR}'''/prometheusNamespace.yaml" ]; then
395 kubectl create -f '''${PROMETHEUS_MON_BASE_DIR}'''/prometheusNamespace.yaml
396fi
397
378# Check if all resources exist already before creating them 398# Check if all resources exist already before creating them
379# Check if configmap Prometheus exists 399# Check if configmap Prometheus exists
380kubectl get configmap prometheus -n prometheus-monitoring 400kubectl get configmap prometheus -n prometheus-monitoring