|
| 1 | +--- |
| 2 | +name: Cluster Upgrade tests - workflow |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + eksupgrade_version: |
| 8 | + type: string |
| 9 | + default: 'latest' |
| 10 | + trigger_tests: |
| 11 | + type: string |
| 12 | + default: 'true' |
| 13 | + trigger_destroy: |
| 14 | + type: string |
| 15 | + default: 'true' |
| 16 | + current_version: |
| 17 | + type: string |
| 18 | + required: true |
| 19 | + cluster_suffix: |
| 20 | + type: string |
| 21 | + required: true |
| 22 | + target_version: |
| 23 | + type: string |
| 24 | + required: true |
| 25 | + secrets: |
| 26 | + git_role: |
| 27 | + required: true |
| 28 | + |
| 29 | +jobs: |
| 30 | + create-cluster: |
| 31 | + name: Cluster creation |
| 32 | + timeout-minutes: 120 |
| 33 | + runs-on: ubuntu-latest |
| 34 | + permissions: |
| 35 | + id-token: write |
| 36 | + contents: read |
| 37 | + steps: |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v3 |
| 40 | + - name: Configure AWS Credentials |
| 41 | + uses: aws-actions/configure-aws-credentials@v2 |
| 42 | + with: |
| 43 | + role-to-assume: ${{ secrets.git_role }} |
| 44 | + aws-region: us-east-1 |
| 45 | + role-duration-seconds: 3600 |
| 46 | + role-session-name: GithubActions-Session |
| 47 | + - name: setup eksctl |
| 48 | + run: | |
| 49 | + curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp |
| 50 | + sudo mv /tmp/eksctl /usr/local/bin |
| 51 | + eksctl version |
| 52 | + - name: create eks cluster |
| 53 | + id: create_cluster |
| 54 | + run: | |
| 55 | + echo "Creating the cluster eksup-cluster-'${{inputs.cluster_suffix}}'" |
| 56 | + eksctl create cluster -f .github/scripts/cluster_creation_${{inputs.current_version}}.yaml |
| 57 | +
|
| 58 | +
|
| 59 | + cluster-upgrade-check: |
| 60 | + name: Cluster Upgrade check |
| 61 | + timeout-minutes: 120 |
| 62 | + runs-on: ubuntu-latest |
| 63 | + needs: create-cluster |
| 64 | + permissions: |
| 65 | + id-token: write |
| 66 | + contents: read |
| 67 | + steps: |
| 68 | + - name: Checkout |
| 69 | + uses: actions/checkout@v3 |
| 70 | + - uses: actions/setup-python@v4 |
| 71 | + with: |
| 72 | + python-version: '3.10' |
| 73 | + - name: install latest utility version |
| 74 | + id: install_deps_latest |
| 75 | + if: ${{inputs.eksupgrade_version == 'latest' }} |
| 76 | + run: | |
| 77 | + python3 -m pip install eksupgrade |
| 78 | + - name: install utility version from a ref |
| 79 | + id: install_deps_from_ref |
| 80 | + if: ${{inputs.eksupgrade_version == 'main' }} |
| 81 | + run: | |
| 82 | + python3 -m pip install git+https://github.com/aws-samples/eks-cluster-upgrade.git@main |
| 83 | + - name: Configure AWS Credentials |
| 84 | + uses: aws-actions/configure-aws-credentials@v2 |
| 85 | + with: |
| 86 | + role-to-assume: ${{ secrets.git_role }} |
| 87 | + aws-region: us-east-1 |
| 88 | + role-duration-seconds: 3600 |
| 89 | + role-session-name: GithubActions-Session |
| 90 | + - name: Test no upgrade |
| 91 | + id: no_upgrade |
| 92 | + run: | |
| 93 | + echo "Test the cluster eksup-cluster-${{inputs.cluster_suffix}} with upgrade set to current version" |
| 94 | + eksupgrade eksup-cluster-${{inputs.cluster_suffix}} ${{inputs.current_version}} us-east-1 |
| 95 | + - name: Test pre-flight checks |
| 96 | + id: preflight_checks |
| 97 | + run: | |
| 98 | + echo "Running pre-flight checks on the cluster eksup-cluster-${{inputs.cluster_suffix}} against version ${{inputs.target_version}} " |
| 99 | + eksupgrade eksup-cluster-${{inputs.cluster_suffix}} ${{inputs.target_version}} us-east-1 --preflight |
| 100 | + - name: Test standalone addon upgrade |
| 101 | + id: addon_upgrade |
| 102 | + run: | |
| 103 | + echo "Running upgrade addon checks on the cluster eksup-cluster-${{inputs.cluster_suffix}} with same control plane version " |
| 104 | + eksupgrade eksup-cluster-${{inputs.cluster_suffix}} ${{inputs.current_version}} us-east-1 --latest-addons |
| 105 | + - name: Test cluster upgrade |
| 106 | + id: cluster_upgrade |
| 107 | + run: | |
| 108 | + echo "Upgrading the cluster eksup-cluster-${{inputs.cluster_suffix}} to version ${{inputs.target_version}} " |
| 109 | + eksupgrade eksup-cluster-${{inputs.cluster_suffix}} ${{inputs.target_version}} us-east-1 |
| 110 | + - name: Destroy the cluster |
| 111 | + if: ${{inputs.trigger_destroy == 'true'}} |
| 112 | + uses: './.github/actions/delete-cluster' |
| 113 | + with: |
| 114 | + eks_version: ${{inputs.current_version}} |
| 115 | + iam_role: ${{ secrets.git_role }} |
| 116 | + region: 'us-east-1' |
0 commit comments