mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Allow the S3 bucket name to be specified via AWS_S3_BUCKET
This commit is contained in:
parent
27c77567d9
commit
e3e6c8377f
@ -20,6 +20,10 @@ MASTER_SIZE=${MASTER_SIZE:-t2.micro}
|
|||||||
MINION_SIZE=${MINION_SIZE:-t2.micro}
|
MINION_SIZE=${MINION_SIZE:-t2.micro}
|
||||||
NUM_MINIONS=${NUM_MINIONS:-4}
|
NUM_MINIONS=${NUM_MINIONS:-4}
|
||||||
|
|
||||||
|
# Optional: Set AWS_S3_BUCKET to the name of an S3 bucket to use for uploading binaries
|
||||||
|
# (otherwise a unique bucket name will be generated for you)
|
||||||
|
# AWS_S3_BUCKET=kubernetes-artifacts
|
||||||
|
|
||||||
INSTANCE_PREFIX="${KUBE_AWS_INSTANCE_PREFIX:-kubernetes}"
|
INSTANCE_PREFIX="${KUBE_AWS_INSTANCE_PREFIX:-kubernetes}"
|
||||||
AWS_SSH_KEY=${AWS_SSH_KEY:-$HOME/.ssh/kube_aws_rsa}
|
AWS_SSH_KEY=${AWS_SSH_KEY:-$HOME/.ssh/kube_aws_rsa}
|
||||||
IAM_PROFILE="kubernetes"
|
IAM_PROFILE="kubernetes"
|
||||||
|
@ -212,30 +212,32 @@ function upload-server-tars() {
|
|||||||
SERVER_BINARY_TAR_URL=
|
SERVER_BINARY_TAR_URL=
|
||||||
SALT_TAR_URL=
|
SALT_TAR_URL=
|
||||||
|
|
||||||
local project_hash=
|
if [[ -z ${AWS_S3_BUCKET-} ]]; then
|
||||||
local key=$(aws configure get aws_access_key_id)
|
local project_hash=
|
||||||
if which md5 > /dev/null 2>&1; then
|
local key=$(aws configure get aws_access_key_id)
|
||||||
project_hash=$(md5 -q -s "${USER} ${key}")
|
if which md5 > /dev/null 2>&1; then
|
||||||
else
|
project_hash=$(md5 -q -s "${USER} ${key}")
|
||||||
project_hash=$(echo -n "${USER} ${key}" | md5sum | awk '{ print $1 }')
|
else
|
||||||
|
project_hash=$(echo -n "${USER} ${key}" | md5sum | awk '{ print $1 }')
|
||||||
|
fi
|
||||||
|
AWS_S3_BUCKET="kubernetes-staging-${project_hash}"
|
||||||
fi
|
fi
|
||||||
local -r staging_bucket="kubernetes-staging-${project_hash}"
|
|
||||||
|
|
||||||
echo "Uploading to Amazon S3"
|
echo "Uploading to Amazon S3"
|
||||||
if ! aws s3 ls "s3://${staging_bucket}" > /dev/null 2>&1 ; then
|
if ! aws s3 ls "s3://${AWS_S3_BUCKET}" > /dev/null 2>&1 ; then
|
||||||
echo "Creating ${staging_bucket}"
|
echo "Creating ${AWS_S3_BUCKET}"
|
||||||
aws s3 mb "s3://${staging_bucket}"
|
aws s3 mb "s3://${AWS_S3_BUCKET}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local -r staging_path="${staging_bucket}/devel"
|
local -r staging_path="${AWS_S3_BUCKET}/devel"
|
||||||
|
|
||||||
echo "+++ Staging server tars to S3 Storage: ${staging_path}"
|
echo "+++ Staging server tars to S3 Storage: ${staging_path}"
|
||||||
SERVER_BINARY_TAR_URL="${staging_path}/${SERVER_BINARY_TAR##*/}"
|
SERVER_BINARY_TAR_URL="${staging_path}/${SERVER_BINARY_TAR##*/}"
|
||||||
aws s3 cp "${SERVER_BINARY_TAR}" "s3://${SERVER_BINARY_TAR_URL}"
|
aws s3 cp "${SERVER_BINARY_TAR}" "s3://${SERVER_BINARY_TAR_URL}"
|
||||||
aws s3api put-object-acl --bucket ${staging_bucket} --key "devel/${SERVER_BINARY_TAR##*/}" --grant-read 'uri="http://acs.amazonaws.com/groups/global/AllUsers"'
|
aws s3api put-object-acl --bucket ${AWS_S3_BUCKET} --key "devel/${SERVER_BINARY_TAR##*/}" --grant-read 'uri="http://acs.amazonaws.com/groups/global/AllUsers"'
|
||||||
SALT_TAR_URL="${staging_path}/${SALT_TAR##*/}"
|
SALT_TAR_URL="${staging_path}/${SALT_TAR##*/}"
|
||||||
aws s3 cp "${SALT_TAR}" "s3://${SALT_TAR_URL}"
|
aws s3 cp "${SALT_TAR}" "s3://${SALT_TAR_URL}"
|
||||||
aws s3api put-object-acl --bucket ${staging_bucket} --key "devel/${SALT_TAR##*/}" --grant-read 'uri="http://acs.amazonaws.com/groups/global/AllUsers"'
|
aws s3api put-object-acl --bucket ${AWS_S3_BUCKET} --key "devel/${SALT_TAR##*/}" --grant-read 'uri="http://acs.amazonaws.com/groups/global/AllUsers"'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user