@@ -35,7 +35,7 @@ SUBNET_CIDR_RES_ID="${SUBNET_CIDR_RES_ID:-}"
35
35
_usage=" Usage: $0 [--aws-access-key <AccessKey>] [--aws-secret-key <SecretKey>] \
36
36
[--aws-security-group-id <SecurityGroupID>] [--aws-subnet-id <SubnetID>] \
37
37
[--aws-ec2-ssh-key-name <SSHKeyName>]
38
- [--aws-service-user-role-arn <ServiceUserRoleARN>] [--aws-service-user <ServiceUserName>] \
38
+ [--aws-service-user-role-arn <ServiceUserRoleARN>] \
39
39
[--aws-region <Region>] [--k8s-version <ClusterVersion>]
40
40
41
41
Setup a Kubernetes cluster and test SR-IOV secondary network in AWS.
@@ -46,7 +46,6 @@ Setup a Kubernetes cluster and test SR-IOV secondary network in AWS.
46
46
--aws-subnet-id The subnet in which the ec2 instance network interface is located.
47
47
--aws-ec2-ssh-key-name The key name to be used for ssh access to ec2 instances.
48
48
--aws-service-user-role-arn AWS Service User Role ARN for logging in to awscli.
49
- --aws-service-user AWS Service User Name for logging in to awscli.
50
49
--aws-region The AWS region where the cluster will be initiated. Defaults to $REGION .
51
50
--setup-only Only perform setting up the cluster and run test.
52
51
--cleanup-only Only perform cleaning up the cluster.
@@ -89,10 +88,6 @@ case $key in
89
88
AWS_SERVICE_USER_ROLE_ARN=" $2 "
90
89
shift 2
91
90
;;
92
- --aws-service-user)
93
- AWS_SERVICE_USER_NAME=" $2 "
94
- shift 2
95
- ;;
96
91
--aws-region)
97
92
REGION=" $2 "
98
93
shift 2
@@ -122,19 +117,19 @@ case $key in
122
117
esac
123
118
done
124
119
125
- mkdir -p ~ /.aws
126
- cat > ~ /.aws/config << EOF
127
- [default]
128
- region = $REGION
129
- role_arn = $AWS_SERVICE_USER_ROLE_ARN
130
- source_profile = $AWS_SERVICE_USER_NAME
131
- output = json
132
- EOF
133
- cat > ~ /.aws/credentials << EOF
134
- [ $AWS_SERVICE_USER_NAME ]
135
- aws_access_key_id = $AWS_ACCESS_KEY
136
- aws_secret_access_key = $AWS_SECRET_KEY
137
- EOF
120
+ export AWS_ACCESS_KEY_ID= $AWS_ACCESS_KEY
121
+ export AWS_SECRET_ACCESS_KEY= $AWS_SECRET_KEY
122
+ export AWS_DEFAULT_REGION= $REGION
123
+
124
+ TEMP_CRED= $( aws sts assume-role \
125
+ --role-arn " $AWS_SERVICE_USER_ROLE_ARN " \
126
+ --role-session-name " cli-session " \
127
+ --query " Credentials " \
128
+ --output json )
129
+
130
+ export AWS_ACCESS_KEY_ID= $( echo " $TEMP_CRED " | jq -r .AccessKeyId )
131
+ export AWS_SECRET_ACCESS_KEY= $( echo " $TEMP_CRED " | jq -r .SecretAccessKey )
132
+ export AWS_SESSION_TOKEN= $( echo " $TEMP_CRED " | jq -r .SessionToken )
138
133
139
134
THIS_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd) "
140
135
ANTREA_CHART=" $THIS_DIR /../build/charts/antrea"
0 commit comments