From 8313e5d9bfa69e81e2393ce3e854ef51be5402f0 Mon Sep 17 00:00:00 2001 From: deads2k Date: Mon, 15 Dec 2014 14:58:28 -0500 Subject: [PATCH] make e2e/monitor.sh work outside gce --- hack/e2e-suite/monitoring.sh | 41 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/hack/e2e-suite/monitoring.sh b/hack/e2e-suite/monitoring.sh index 12b91d760a1..244615ca3a0 100755 --- a/hack/e2e-suite/monitoring.sh +++ b/hack/e2e-suite/monitoring.sh @@ -26,25 +26,22 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. source "${KUBE_ROOT}/cluster/kube-env.sh" source "${KUBE_ROOT}/cluster/$KUBERNETES_PROVIDER/util.sh" -if [[ "${KUBERNETES_PROVIDER}" != "gce" ]] && [[ "${KUBERNETES_PROVIDER}" != "gke" ]]; then - echo "WARNING: Skipping monitoring.sh for cloud provider: ${KUBERNETES_PROVIDER}." - exit 0 -fi - MONITORING="${KUBE_ROOT}/examples/monitoring" KUBECTL="${KUBE_ROOT}/cluster/kubectl.sh" MONITORING_FIREWALL_RULE="monitoring-test" function setup { - detect-project - - if ! "${GCLOUD}" compute firewall-rules describe $MONITORING_FIREWALL_RULE &> /dev/null; then - if ! "${GCLOUD}" compute firewall-rules create $MONITORING_FIREWALL_RULE \ - --project "${PROJECT}" \ - --network "${NETWORK}" \ - --quiet \ - --allow tcp:80 tcp:8083 tcp:8086 tcp:9200; then - echo "Failed to set up firewall for monitoring" && false + # This only has work to do on gce and gke + if [[ "${KUBERNETES_PROVIDER}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then + detect-project + if ! "${GCLOUD}" compute firewall-rules describe $MONITORING_FIREWALL_RULE &> /dev/null; then + if ! "${GCLOUD}" compute firewall-rules create $MONITORING_FIREWALL_RULE \ + --project "${PROJECT}" \ + --network "${NETWORK}" \ + --quiet \ + --allow tcp:80 tcp:8083 tcp:8086 tcp:9200; then + echo "Failed to set up firewall for monitoring" && false + fi fi fi @@ -54,15 +51,19 @@ function setup { } function cleanup { - detect-project "${KUBECTL}" delete -f "${MONITORING}/influx-grafana-pod.json" || true "${KUBECTL}" delete -f "${MONITORING}/influx-grafana-service.json" || true "${KUBECTL}" delete -f "${MONITORING}/heapster-pod.json" || true - if "${GCLOUD}" compute firewall-rules describe $MONITORING_FIREWALL_RULE &> /dev/null; then - "${GCLOUD}" compute firewall-rules delete \ - --project "${PROJECT}" \ - --quiet \ - $MONITORING_FIREWALL_RULE || true + + # This only has work to do on gce and gke + if [[ "${KUBERNETES_PROVIDER}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then + detect-project + if "${GCLOUD}" compute firewall-rules describe $MONITORING_FIREWALL_RULE &> /dev/null; then + "${GCLOUD}" compute firewall-rules delete \ + --project "${PROJECT}" \ + --quiet \ + $MONITORING_FIREWALL_RULE || true + fi fi }