From 134f7f2a9d960319475b6a242df37238c01943e3 Mon Sep 17 00:00:00 2001 From: Arnold Szederjesi Date: Tue, 28 Aug 2018 14:09:07 +0200 Subject: [PATCH] Add flag for disabling prometheus-to-sd only for daemon sets --- cluster/gce/gci/configure-helper.sh | 17 ++++++++++++++--- cluster/gce/util.sh | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index dc00dcafb6a..f926024c7b1 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -2193,6 +2193,17 @@ function update-prometheus-to-sd-parameters { fi } +# Updates parameters in yaml file for prometheus-to-sd configuration in daemon sets, or +# removes component if it is disabled. +function update-daemon-set-prometheus-to-sd-parameters { + if [[ "${DISABLE_PROMETHEUS_TO_SD_IN_DS:-}" == "true" ]]; then + # Removes all lines between two patterns (throws away prometheus-to-sd) + sed -i -e "/# BEGIN_PROMETHEUS_TO_SD/,/# END_PROMETHEUS_TO_SD/d" "$1" + else + update-prometheus-to-sd-parameters $1 + fi +} + # Updates parameters in yaml file for event-exporter configuration function update-event-exporter { local -r stackdriver_resource_model="${LOGGING_STACKDRIVER_RESOURCE_TYPES:-old}" @@ -2243,7 +2254,7 @@ function setup-fluentd { sed -i -e "s@{{ fluentd_gcp_yaml_version }}@${fluentd_gcp_yaml_version}@g" "${fluentd_gcp_scaler_yaml}" fluentd_gcp_version="${FLUENTD_GCP_VERSION:-0.3-1.5.34-1-k8s-1}" sed -i -e "s@{{ fluentd_gcp_version }}@${fluentd_gcp_version}@g" "${fluentd_gcp_yaml}" - update-prometheus-to-sd-parameters ${fluentd_gcp_yaml} + update-daemon-set-prometheus-to-sd-parameters ${fluentd_gcp_yaml} start-fluentd-resource-update ${fluentd_gcp_yaml} update-container-runtime ${fluentd_gcp_configmap_yaml} update-node-journal ${fluentd_gcp_configmap_yaml} @@ -2329,7 +2340,7 @@ function start-kube-addons { cat > "$src_dir/kube-proxy/kube-proxy-ds.yaml" <