forked from aws/karpenter-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (184 loc) · 7.15 KB
/
e2e.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: E2E
on:
workflow_dispatch:
inputs:
git_ref:
type: string
region:
type: choice
options:
- "us-east-1"
- "us-east-2"
- "us-west-2"
- "eu-west-1"
default: "us-east-2"
suite:
type: choice
required: true
options:
- Integration
- NodeClaim
- Consolidation
- Interruption
- Drift
- Expiration
- Chaos
- IPv6
- Scale
- PrivateCluster
k8s_version:
type: choice
options:
- "1.23"
- "1.24"
- "1.25"
- "1.26"
- "1.27"
- "1.28"
default: "1.28"
cluster_name:
type: string
cleanup:
type: boolean
required: true
default: true
enable_metrics:
type: boolean
default: false
workflow_call:
inputs:
git_ref:
type: string
region:
type: string
default: "us-east-2"
suite:
type: string
required: true
k8s_version:
type: string
default: "1.28"
enable_metrics:
type: boolean
default: false
cleanup:
type: boolean
required: true
workflow_trigger:
type: string
cluster_name:
type: string
description: If cluster_name is empty, a new cluster will be created. Otherwise, tests will run on an existing cluster
secrets:
SLACK_WEBHOOK_URL:
required: false
SLACK_WEBHOOK_SOAK_URL:
required: false
jobs:
run-suite:
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
name: suite-${{ inputs.suite }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ inputs.git_ref }}
- if: always() && github.event_name == 'workflow_run'
uses: ./.github/actions/commit-status/start
with:
name: ${{ github.workflow }} (${{ inputs.k8s_version }}) / e2e (${{ inputs.suite }})
git_ref: ${{ inputs.git_ref }}
- uses: ./.github/actions/install-deps
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: arn:aws:iam::${{ vars.CI_ACCOUNT_ID }}:role/${{ vars.CI_ROLE_NAME }}
aws-region: ${{ inputs.region }}
role-duration-seconds: 21600
# - name: add jitter on cluster setup
# run: |
# # Creating jitter so that we can stagger cluster creation to avoid throttling
# sleep $(( RANDOM % 300 + 1 ))
- id: generate-cluster-name
name: generate cluster name
env:
SUITE: ${{ inputs.suite }}
CLUSTER_NAME: ${{ inputs.cluster_name }}
WORKFLOW_TRIGGER: ${{ inputs.workflow_trigger }}
run: |
if [[ "$CLUSTER_NAME" == '' ]]; then
if [[ "$WORKFLOW_TRIGGER" == 'soak' ]]; then
CLUSTER_NAME=$(echo "soak-periodic-$RANDOM$RANDOM" | awk '{print tolower($0)}' | tr / -)
else
CLUSTER_NAME=$(echo "$SUITE-$RANDOM$RANDOM" | awk '{print tolower($0)}' | tr / -)
fi
fi
echo "Using cluster name \"$CLUSTER_NAME\""
echo CLUSTER_NAME="$CLUSTER_NAME" >> "$GITHUB_OUTPUT"
- name: setup eks cluster '${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}'
if: inputs.cluster_name == ''
uses: ./.github/actions/e2e/setup-cluster
with:
account_id: ${{ vars.CI_ACCOUNT_ID }}
role: ${{ vars.CI_ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
k8s_version: ${{ inputs.k8s_version }}
eksctl_version: v0.165.0
ip_family: ${{ contains(inputs.suite, 'IPv6') && 'IPv6' || 'IPv4' }} # Set the value to IPv6 if IPv6 suite, else IPv4
private_cluster: ${{ inputs.suite == 'PrivateCluster' }}
git_ref: ${{ inputs.git_ref }}
ecr_account_id: ${{ vars.SNAPSHOT_ACCOUNT_ID }}
ecr_region: ${{ vars.SNAPSHOT_REGION }}
prometheus_workspace_id: ${{ vars.WORKSPACE_ID }}
prometheus_region: ${{ vars.PROMETHEUS_REGION }}
- name: run the ${{ inputs.suite }} test suite
env:
SUITE: ${{ inputs.suite }}
ENABLE_METRICS: ${{ inputs.enable_metrics }}
run: |
# If we are performing the PrivateCluster test suite, then we should just run the 'Integration' test suite
if [[ $SUITE == 'PrivateCluster' ]]; then
SUITE="Integration"
fi
aws eks update-kubeconfig --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
# Clean up the cluster before running all tests
kubectl delete nodepool --all
kubectl delete ec2nodeclass --all
kubectl delete deployment --all
TEST_SUITE="$SUITE" ENABLE_METRICS=$ENABLE_METRICS METRICS_REGION=${{ vars.TIMESTREAM_REGION }} GIT_REF="$(git rev-parse HEAD)" \
CLUSTER_NAME="${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}" CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }} --query "cluster.endpoint" --output text)" \
INTERRUPTION_QUEUE="${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}" make e2etests
- name: notify slack of success or failure
uses: ./.github/actions/e2e/slack/notify
if: (success() || failure()) && github.event_name != 'workflow_run' && inputs.workflow_trigger != 'versionCompatibility'
with:
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
url: ${{ inputs.workflow_trigger == 'soak' && secrets.SLACK_WEBHOOK_SOAK_URL || secrets.SLACK_WEBHOOK_URL }}
suite: ${{ inputs.workflow_trigger == 'soak' && 'soak' || inputs.suite }}
git_ref: ${{ inputs.git_ref }}
- name: dump logs on failure
uses: ./.github/actions/e2e/dump-logs
if: failure() || cancelled()
with:
account_id: ${{ vars.CI_ACCOUNT_ID }}
role: ${{ vars.CI_ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
- name: cleanup karpenter and cluster '${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}' resources
uses: ./.github/actions/e2e/cleanup
if: always() && inputs.cleanup
with:
account_id: ${{ vars.CI_ACCOUNT_ID }}
role: ${{ vars.CI_ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
git_ref: ${{ inputs.git_ref }}
eksctl_version: v0.165.0
- if: always() && github.event_name == 'workflow_run'
uses: ./.github/actions/commit-status/end
with:
name: ${{ github.workflow }} (${{ inputs.k8s_version }}) / e2e (${{ inputs.suite }})
git_ref: ${{ inputs.git_ref }}