Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci-operator: Fresh AWS shared subnets for us-east-2, etc. #6949

Merged

Commits on Jan 31, 2020

  1. ci-operator: Fresh AWS shared subnets for us-east-2, etc.

    ci-operator/templates/openshift/installer: Replacement shared subnets for new regions
    
    I'd created the previous subnets in
    7e38260 (ci-operator/templates/openshift/installer: Shared
    subnets for new regions, 2020-01-23, openshift#6845), but forgot to add
    them to the reaper whitelist [1].  So the reaper just removed my
    old subnets.  Recreating them here:
    
      $ export AWS_PROFILE=ci  # or whatever you call it locally
      $ git fetch origin
      $ date --iso=m --utc
      2020-01-30T17:09+0000
      $ git checkout origin/release-4.3
      $ git --no-pager log --oneline -1
      2055609f9 (HEAD, origin/release-4.3) Merge pull request openshift#2928 from ashcrow/4.3-signed-rhcos-bump
    
    Clear out the old stacks:
    
      for REGION in us-east-2 us-west-1 us-west-2
      do
        COUNT=3
        if test us-west-1 = "${REGION}"
        then
          COUNT=2
        fi
        for INDEX in 1 2 3 4
        do
          NAME="do-not-delete-shared-vpc-${INDEX}"
          aws --region "${REGION}" cloudformation delete-stack --stack-name "${NAME}"
          aws --region "${REGION}" cloudformation wait stack-delete-complete --stack-name "${NAME}"
        done
      done
    
    I had to lean in manually and delete some instances in us-west-2's
    do-not-delete-shared-vpc-4 to unstick it.  Then create the new
    subnets:
    
      for REGION in us-east-2 us-west-1 us-west-2
      do
        COUNT=3
        if test us-west-1 = "${REGION}"
        then
          COUNT=2
        fi
        for INDEX in 1 2 3 4
        do
          NAME="do-not-delete-shared-vpc-${INDEX}"
          aws --region "${REGION}" cloudformation create-stack --stack-name "${NAME}" --template-body "$(cat upi/aws/cloudformation/01_vpc.yaml)" --parameters "ParameterKey=AvailabilityZoneCount,ParameterValue=${COUNT}" >/dev/null
          aws --region "${REGION}" cloudformation wait stack-create-complete --stack-name "${NAME}"
          SUBNETS="$(aws --region "${REGION}" cloudformation describe-stacks --stack-name "${NAME}" | jq -c '[.Stacks[].Outputs[] | select(.OutputKey | endswith("SubnetIds")).OutputValue | split(",")[]]' | sed "s/\"/'/g")"
          echo "${REGION}_$((INDEX - 1))) subnets=\"${SUBNETS}\";;"
        done
      done
    
    7e38260 had a us-east-1 typo in the commit message, fixed
    here.  I actually used us-east-2 in that commit as well, and just
    fumbled the copy into the old commit message.  Creation spit out:
    
      us-east-2_0) subnets="['subnet-0a568760cd74bf1d7','subnet-0320ee5b3bb78863e','subnet-015658a21d26e55b7','subnet-0c3ce64c4066f37c7','subnet-0d57b6b056e1ee8f6','subnet-0b118b86d1517483a']";;
      ...
      us-west-2_3) subnets="['subnet-072d00dcf02ad90a6','subnet-0ad913e4bd6ff53fa','subnet-09f90e069238e4105','subnet-064ecb1b01098ff35','subnet-068d9cdd93c0c66e6','subnet-0b7d1a5a6ae1d9adf']";;
    
    To generate the reaper whitelist [1], I used:
    
      for REGION in us-east-1 us-east-2 us-west-1 us-west-2
      do
        for INDEX in 1 2 3 4
        do
          NAME="do-not-delete-shared-vpc-${INDEX}"
          aws --region "${REGION}" resourcegroupstaggingapi get-resources --tag-filters "Key=aws:cloudformation:stack-name,Values=${NAME}" --query 'ResourceTagMappingList[].ResourceARN' | jq -r ".[] | split(\":\")[-1] | \"                '\" + . + \"',  # CI exclusion per DPP-4108, ${REGION} ${NAME}\""
        done
      done | sort
    
    followed by some whitespace shuffling to get the comments aligned.
    
    [1]: openshift/li#3634
         Private repository, sorry external folks.
    wking committed Jan 31, 2020
    Configuration menu
    Copy the full SHA
    1b21187 View commit details
    Browse the repository at this point in the history