@@ -32,7 +32,9 @@ ROLE_NAME="aws-load-balancer-controller-$TEST_ID"
32
32
POLICY_NAME=" AWSLoadBalancerControllerIAMPolicy-$TEST_ID "
33
33
34
34
function cleanUp(){
35
- # IAM role and polcies are AWS Account specific, so need to clean them up if any from previous run
35
+ echo " delete serviceaccount"
36
+ kubectl delete serviceaccount aws-load-balancer-controller -n kube-system --timeout 60s || true
37
+
36
38
echo " detach IAM policy"
37
39
aws iam detach-role-policy --role-name $ROLE_NAME --policy-arn arn:${AWS_PARTITION} :iam::$ACCOUNT_ID :policy/$POLICY_NAME || true
38
40
@@ -42,9 +44,15 @@ function cleanUp(){
42
44
echo " delete $ROLE_NAME "
43
45
aws iam delete-role --role-name $ROLE_NAME || true
44
46
45
- # Need to do this as last step
46
47
echo " delete $POLICY_NAME "
47
48
aws iam delete-policy --policy-arn arn:${AWS_PARTITION} :iam::$ACCOUNT_ID :policy/$POLICY_NAME || true
49
+
50
+ echo " Delete CRDs if exists"
51
+ if [[ $ADC_REGIONS == * " $REGION " * ]]; then
52
+ kubectl delete -k " ../helm/aws-load-balancer-controller/crds" --timeout=30s || true
53
+ else
54
+ kubectl delete -k " github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master" --timeout=30s || true
55
+ fi
48
56
}
49
57
50
58
echo " cordon off windows nodes"
218
226
echo " clean up resources from current run"
219
227
cleanUp
220
228
221
- echo " Delete CRDs if exists"
222
- if [[ $ADC_REGIONS == * " $REGION " * ]]; then
223
- kubectl delete -k " ../helm/aws-load-balancer-controller/crds" --timeout=30s || true
224
- else
225
- kubectl delete -k " github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master" --timeout=30s || true
226
- fi
227
-
228
229
if [[ " $TEST_RESULT " == fail ]]; then
229
230
echo " e2e tests failed."
230
231
exit 1
0 commit comments