Unverified Commit 00f4dd85 authored by Oleksii Kliukin's avatar Oleksii Kliukin Committed by GitHub
Browse files

Use an IP address for Google instance metadata (#521)

* Use an IP address for Google instance metadata

Makes Spilo start even if external DNS queries from
within the container are not working.

Do not continue with the startup when /etc/service is missing.

Per https://github.com/zalando/spilo/issues/511



* Follow Python guidelines on on-line comments
Co-authored-by: default avatarAlexander Kukushkin <cyberdemn@gmail.com>

* Extra space to the shell comment for readability
Co-authored-by: default avatarAlexander Kukushkin <cyberdemn@gmail.com>
parent bb6ab228
Showing with 3 additions and 1 deletion
+3 -1
......@@ -53,6 +53,8 @@ sv_stop() {
sv -w 86400 stop /etc/service/*
}
[ ! -d /etc/service ] && exit 1 # /etc/service has not been created due to an error, the container is no-op
trap sv_stop TERM QUIT INT
/usr/bin/runsvdir -P /etc/service &
......
......@@ -376,7 +376,7 @@ def get_instance_metadata(provider):
headers = {}
if provider == PROVIDER_GOOGLE:
headers['Metadata-Flavor'] = 'Google'
url = 'http://metadata.google.internal/computeMetadata/v1/instance'
url = 'http://169.254.169.254/computeMetadata/v1/instance' # metadata.google.internal
mapping = {'zone': 'zone'}
if not USE_KUBERNETES:
mapping.update({'id': 'id'})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment