From 838d5802716302cca1f02495e127b02be6b3c719 Mon Sep 17 00:00:00 2001 From: vishal Date: Tue, 24 Dec 2019 18:27:09 -0500 Subject: [PATCH 1/3] Update install.sh to block up on a cluster that has already been spun up --- manager/install.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manager/install.sh b/manager/install.sh index fb958ffc17..ac4ea9b3ec 100755 --- a/manager/install.sh +++ b/manager/install.sh @@ -73,6 +73,11 @@ function ensure_eks() { cluster_status=$(echo "$cluster_info" | jq -r 'first | .Status') set -e + if [[ "$cluster_status" == "ACTIVE" ]] && [[ "$arg1" != "--update" ]]; then + echo "error: there is already cluster named \"$CORTEX_CLUSTER_NAME\" in $CORTEX_REGION" + exit 1 + fi + if [ "$cluster_status" == "DELETING" ]; then echo "error: your cortex cluster named \"$CORTEX_CLUSTER_NAME\" in $CORTEX_REGION is currently spinning down; please try again once it is completely deleted (may take a few minutes)" exit 1 From f2a7b1c3a8eca21823f3cce78cf55a7a74505566 Mon Sep 17 00:00:00 2001 From: vishal Date: Tue, 24 Dec 2019 18:30:04 -0500 Subject: [PATCH 2/3] Use buckets from another region --- pkg/lib/aws/aws.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/lib/aws/aws.go b/pkg/lib/aws/aws.go index a689a5f14d..5c1f2d14a2 100644 --- a/pkg/lib/aws/aws.go +++ b/pkg/lib/aws/aws.go @@ -65,10 +65,20 @@ func New(region string, bucket string, withAccountID bool) (*Client, error) { DisableSSL: aws.Bool(false), })) + bucketLocation, err := GetBucketRegion(bucket) + if err != nil { + return nil, err + } + + bucketSess := session.Must(session.NewSession(&aws.Config{ + Region: aws.String(bucketLocation), + DisableSSL: aws.Bool(false), + })) + awsClient := &Client{ Bucket: bucket, Region: region, - S3: s3.New(sess), + S3: s3.New(bucketSess), stsClient: sts.New(sess), autoscaling: autoscaling.New(sess), CloudWatchMetrics: cloudwatch.New(sess), From 05468cbaf33119f52dedd03989837229a454404b Mon Sep 17 00:00:00 2001 From: vishal Date: Tue, 24 Dec 2019 19:14:18 -0500 Subject: [PATCH 3/3] Undo install.sh --- manager/install.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/manager/install.sh b/manager/install.sh index ac4ea9b3ec..fb958ffc17 100755 --- a/manager/install.sh +++ b/manager/install.sh @@ -73,11 +73,6 @@ function ensure_eks() { cluster_status=$(echo "$cluster_info" | jq -r 'first | .Status') set -e - if [[ "$cluster_status" == "ACTIVE" ]] && [[ "$arg1" != "--update" ]]; then - echo "error: there is already cluster named \"$CORTEX_CLUSTER_NAME\" in $CORTEX_REGION" - exit 1 - fi - if [ "$cluster_status" == "DELETING" ]; then echo "error: your cortex cluster named \"$CORTEX_CLUSTER_NAME\" in $CORTEX_REGION is currently spinning down; please try again once it is completely deleted (may take a few minutes)" exit 1