Skip to content

Commit 9241313

Browse files
authored
Add Initial Support For EKS Fargate Testing In Terraform (#425)
1 parent 4393637 commit 9241313

File tree

20 files changed

+781
-48
lines changed

20 files changed

+781
-48
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ override.tf.json
5858
terraform.rc
5959

6060
!gradle/wrapper/gradle-wrapper.jar
61+
62+
**/.DS_Store

docs/run-testing-framework.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,52 @@ cd terraform/eks && terraform init && terraform apply \
8686
-var="testcase=../testcases/{{your test case folder name}}" \
8787
-var-file="../testcases/{{your test case folder name}}/parameters.tfvars"
8888
````
89-
89+
9090
Don't forget to clean up your resources:
9191
````
9292
terraform destroy -var="eks_cluster_name={the eks cluster name in your account}"
9393
````
94+
95+
### 2.3.1 Run in EKS Fargate
96+
#### Set Up
97+
* Install kubectl and eksctl
98+
* https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html
99+
* https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html
100+
* Create eks fargate cluster
101+
```
102+
eksctl create cluster --name <cluster_name> --region <region> --fargate
103+
```
104+
* Create a oicd
105+
```
106+
eksctl utils associate-iam-oidc-provider --cluster <cluster_name> --approve
107+
```
108+
* Create web identity role (ServiceAccount-eks-test-aoc-role)
109+
* Identity provider is the openId connect on your eks cluster
110+
* Add required permissions for the collector for your test
111+
* Create Ingress controller fargate
112+
* https://aws.amazon.com/premiumsupport/knowledge-center/eks-alb-ingress-controller-fargate/
113+
* To test that ingress set up
114+
* Download config https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/docs/examples/2048/2048_full.yaml and replace all instances of namespace game-2048 with default.
115+
* Check for external url after a couple of minutes
116+
* ````kubectl get ingress````
117+
#### How to run fargate tests
118+
Add -var="deployment_type=fargate" to the eks creation statement
119+
Supported tests
120+
* otlp_mock
121+
122+
Not supported tests
123+
* otlp_trace
124+
* This is because no sts role given to the sample app.
125+
126+
Test
127+
```
128+
cd terraform/eks && terraform apply -auto-approve -var-file="../testcases/<your_testcase>/parameters.tfvars" -var="aoc_image_repo=<your_image_repo>" -var="testcase=../testcases/<your_testcase>" -var="eks_cluster_name=<your_cluster>" -var="deployment_type=fargate"
129+
```
130+
131+
Don't forget to clean up your resources:
132+
````
133+
terraform destroy -var="cluster_name=<you_cluster_name>" -var="deployment_type=fargate"
134+
````
94135

95136
#### 2.4 Run in EC2
96137
````
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: adot-collector-service
5+
namespace: default
6+
labels:
7+
app: aws-adot
8+
component: adot-collector
9+
spec:
10+
ports:
11+
- name: metrics # default endpoint for querying metrics.
12+
port: 8888
13+
selector:
14+
component: adot-collector
15+
type: ClusterIP
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: ClusterRoleBinding
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
metadata:
4+
name: adotcol-admin-role-binding
5+
subjects:
6+
- kind: ServiceAccount
7+
name: adot-collector-service-account
8+
namespace: default
9+
roleRef:
10+
kind: ClusterRole
11+
name: adotcol-admin-role
12+
apiGroup: rbac.authorization.k8s.io
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kind: ClusterRole
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
metadata:
4+
name: adotcol-admin-role
5+
rules:
6+
- apiGroups: [""]
7+
resources:
8+
- nodes
9+
- nodes/proxy
10+
- nodes/metrics
11+
- services
12+
- endpoints
13+
- pods
14+
- pods/proxy
15+
verbs: ["get", "list", "watch"]
16+
- nonResourceURLs: [ "/metrics/cadvisor"]
17+
verbs: ["get", "list", "watch"]

0 commit comments

Comments
 (0)