Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
054a6761
Unverified
Commit
054a6761
authored
Feb 20, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74142 from javier-b-perez/master
GCE config.sh script should use headers for curl GCS apis
parents
50328e0b
708d7df5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
configure.sh
cluster/gce/gci/configure.sh
+12
-1
No files found.
cluster/gce/gci/configure.sh
View file @
054a6761
...
...
@@ -123,6 +123,12 @@ function validate-hash {
fi
}
# Get default service account credentials of the VM.
function
get-credentials
{
curl
"http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"
-H
"Metadata-Flavor: Google"
-s
| python
-c
\
'import sys; import json; print(json.loads(sys.stdin.read())["access_token"])'
}
# Retry a download until we get it. Takes a hash and a set of URLs.
#
# $1 is the sha1 of the URL. Can be "" if the sha1 is unknown.
...
...
@@ -136,7 +142,12 @@ function download-or-bust {
for
url
in
"
${
urls
[@]
}
"
;
do
local
file
=
"
${
url
##*/
}
"
rm
-f
"
${
file
}
"
if
!
curl
-f
--ipv4
-Lo
"
${
file
}
"
--connect-timeout
20
--max-time
300
--retry
6
--retry-delay
10
${
CURL_RETRY_CONNREFUSED
}
"
${
url
}
"
;
then
# if the url belongs to GCS API we should use oauth2_token in the headers
local
curl_headers
=
""
if
[[
"
$url
"
=
~ ^https://storage.googleapis.com.
*
]]
;
then
curl_headers
=
"Authorization: Bearer
$(
get-credentials
)
"
fi
if
!
curl
${
curl_headers
:+-H
"
${
curl_headers
}
"
}
-f
--ipv4
-Lo
"
${
file
}
"
--connect-timeout
20
--max-time
300
--retry
6
--retry-delay
10
${
CURL_RETRY_CONNREFUSED
}
"
${
url
}
"
;
then
echo
"== Failed to download
${
url
}
. Retrying. =="
elif
[[
-n
"
${
hash
}
"
]]
&&
!
validate-hash
"
${
file
}
"
"
${
hash
}
"
;
then
echo
"== Hash validation of
${
url
}
failed. Retrying. =="
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment