mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #80635 from mborsz/patch-9
Retry metadata requests in get-credentials and valid-storage-scope
This commit is contained in:
commit
e298fc723f
@ -126,12 +126,12 @@ function validate-hash {
|
|||||||
# Get default service account credentials of the VM.
|
# Get default service account credentials of the VM.
|
||||||
GCE_METADATA_INTERNAL="http://metadata.google.internal/computeMetadata/v1/instance"
|
GCE_METADATA_INTERNAL="http://metadata.google.internal/computeMetadata/v1/instance"
|
||||||
function get-credentials {
|
function get-credentials {
|
||||||
curl "${GCE_METADATA_INTERNAL}/service-accounts/default/token" -H "Metadata-Flavor: Google" -s | python -c \
|
curl --fail --retry 5 --retry-delay 3 ${CURL_RETRY_CONNREFUSED} --silent --show-error "${GCE_METADATA_INTERNAL}/service-accounts/default/token" -H "Metadata-Flavor: Google" -s | python -c \
|
||||||
'import sys; import json; print(json.loads(sys.stdin.read())["access_token"])'
|
'import sys; import json; print(json.loads(sys.stdin.read())["access_token"])'
|
||||||
}
|
}
|
||||||
|
|
||||||
function valid-storage-scope {
|
function valid-storage-scope {
|
||||||
curl "${GCE_METADATA_INTERNAL}/service-accounts/default/scopes" -H "Metadata-Flavor: Google" -s | grep -q "auth/devstorage"
|
curl --fail --retry 5 --retry-delay 3 ${CURL_RETRY_CONNREFUSED} --silent --show-error "${GCE_METADATA_INTERNAL}/service-accounts/default/scopes" -H "Metadata-Flavor: Google" -s | grep -q "auth/devstorage"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Retry a download until we get it. Takes a hash and a set of URLs.
|
# Retry a download until we get it. Takes a hash and a set of URLs.
|
||||||
|
Loading…
Reference in New Issue
Block a user