mirror of https://github.com/kubernetes/kops.git
Merge pull request #9568 from johngmyers/private-upload
Add support for uploading to private buckets
This commit is contained in:
commit
6d9cfac933
2
Makefile
2
Makefile
|
|
@ -48,7 +48,7 @@ GCFLAGS?=
|
|||
# This can be removed when we upgrade to go 1.14
|
||||
export GOFLAGS=-mod=vendor
|
||||
|
||||
UPLOAD_CMD=$(KOPS_ROOT)/hack/upload
|
||||
UPLOAD_CMD=$(KOPS_ROOT)/hack/upload ${UPLOAD_ARGS}
|
||||
|
||||
# Unexport environment variables that can affect tests and are not used in builds
|
||||
unexport AWS_ACCESS_KEY_ID AWS_REGION AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN CNI_VERSION_URL DNS_IGNORE_NS_CHECK DNSCONTROLLER_IMAGE DO_ACCESS_TOKEN GOOGLE_APPLICATION_CREDENTIALS
|
||||
|
|
|
|||
17
hack/upload
17
hack/upload
|
|
@ -1,30 +1,37 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
PUBLIC=1
|
||||
|
||||
if [[ "$1" == "--private" ]]; then
|
||||
PUBLIC=
|
||||
shift
|
||||
fi
|
||||
|
||||
SRC=$1
|
||||
DEST=$2
|
||||
|
||||
if [[ -z "${SRC}" ]]; then
|
||||
echo "syntax: $0 <src> <dest>"
|
||||
echo "syntax: $0 [--private] <src> <dest>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${DEST}" ]]; then
|
||||
echo "syntax: $0 <src> <dest>"
|
||||
echo "syntax: $0 [--private] <src> <dest>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${DEST:0:5}" == "s3://" ]]; then
|
||||
aws s3 sync --acl public-read ${SRC} ${DEST}
|
||||
aws s3 sync ${PUBLIC:+--acl public-read} ${SRC} ${DEST}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "${DEST:0:5}" == "gs://" ]]; then
|
||||
gsutil -h "Cache-Control:private,max-age=0" rsync -r -a public-read ${SRC} ${DEST}
|
||||
gsutil -h "Cache-Control:private,max-age=0" rsync -r ${PUBLIC:+-a public-read} ${SRC} ${DEST}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "${DEST:0:6}" == "oss://" ]]; then
|
||||
aliyun oss cp --acl public-read -r -f --include "*" ${SRC}/ ${DEST}
|
||||
aliyun oss cp ${PUBLIC:+--acl public-read} -r -f --include "*" ${SRC}/ ${DEST}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue