Reinstate cluster logging URLs to the end of kube-up.sh

Adds labels to the services, waits for them to be created (which
should be instant, but just in case), query the forwarding rules like
as we did before.

Fixes #3893
This commit is contained in:
Zach Loafman 2015-02-03 08:27:02 -08:00
parent 2ac6bbb7eb
commit ae27f29c56
3 changed files with 25 additions and 1 deletions

View File

@ -3,6 +3,8 @@ kind: Service
id: elasticsearch-logging
containerPort: es-port
port: 9200
labels:
name: elasticsearch-logging
selector:
name: elasticsearch-logging
createExternalLoadBalancer: true

View File

@ -3,7 +3,8 @@ kind: Service
id: kibana-logging
containerPort: kibana-port
port: 5601
labels:
name: kibana-logging
selector:
name: kibana-logging
createExternalLoadBalancer: true

View File

@ -792,6 +792,27 @@ function setup-logging-firewall {
detect-project
gcloud compute firewall-rules create "${INSTANCE_PREFIX}-fluentd-elasticsearch-logging" --project "${PROJECT}" \
--allow tcp:5601 tcp:9200 tcp:9300 --target-tags "${MINION_TAG}" --network="${NETWORK}"
# This should be nearly instant once kube-addons gets a chance to
# run, and we already know we can hit the apiserver, but it's still
# worth checking.
echo "waiting for logging services to be created by the master."
local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
for i in `seq 1 10`; do
if "${kubectl}" get services -l name=kibana-logging -o template -t {{range.items}}{{.id}}{{end}} | grep -q kibana-logging &&
"${kubectl}" get services -l name=elasticsearch-logging -o template -t {{range.items}}{{.id}}{{end}} | grep -q elasticsearch-logging; then
break
fi
sleep 10
done
local -r region="${ZONE::-2}"
local -r es_ip=$(gcloud compute forwarding-rules --project "${PROJECT}" describe --region "${region}" elasticsearch-logging | grep IPAddress | awk '{print $2}')
local -r kibana_ip=$(gcloud compute forwarding-rules --project "${PROJECT}" describe --region "${region}" kibana-logging | grep IPAddress | awk '{print $2}')
echo
echo -e "${color_green}Cluster logs are ingested into Elasticsearch running at ${color_yellow}http://${es_ip}:9200"
echo -e "${color_green}Kibana logging dashboard will be available at ${color_yellow}http://${kibana_ip}:5601${color_norm}"
echo
}
function teardown-logging-firewall {