Skip to content

Commit c162e41

Browse files
authored
Add EKS provider for infra (#384)
This change adds EKS commands for the creation/deletion of clusters, nodegroups, and resources similar to the existing GKE commands in infra. The documentation for deploying prombench for EKS is also added. The changes in this commit are not sufficient for running funcbench on EKS. Signed-off-by: Drumil Patel <[email protected]>
1 parent fb17601 commit c162e41

File tree

14 files changed

+997
-27
lines changed

14 files changed

+997
-27
lines changed

funcbench/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ clean: resource_delete cluster_delete
1414
cluster_create:
1515
$(INFRA_CMD) $(PROVIDER) cluster create -a ${AUTH_FILE} \
1616
-v GKE_PROJECT_ID:${GKE_PROJECT_ID} -v ZONE:${ZONE} -v CLUSTER_NAME:funcbench-${PR_NUMBER} -v PR_NUMBER:${PR_NUMBER} \
17+
-v EKS_WORKER_ROLE_ARN:${EKS_WORKER_ROLE_ARN} -v EKS_CLUSTER_ROLE_ARN:${EKS_CLUSTER_ROLE_ARN} \
18+
-v EKS_SUBNET_IDS:${EKS_SUBNET_IDS} \
1719
-f manifests/cluster_$(PROVIDER).yaml
1820

1921
cluster_delete:
2022
$(INFRA_CMD) $(PROVIDER) cluster delete -a ${AUTH_FILE} \
2123
-v GKE_PROJECT_ID:${GKE_PROJECT_ID} -v ZONE:${ZONE} -v CLUSTER_NAME:funcbench-${PR_NUMBER} -v PR_NUMBER:${PR_NUMBER} \
24+
-v EKS_WORKER_ROLE_ARN:${EKS_WORKER_ROLE_ARN} -v EKS_CLUSTER_ROLE_ARN:${EKS_CLUSTER_ROLE_ARN} \
25+
-v EKS_SUBNET_IDS:${EKS_SUBNET_IDS} \
2226
-f manifests/cluster_$(PROVIDER).yaml
2327

2428
resource_apply:

funcbench/manifests/cluster_eks.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cluster:
2+
name: {{ .CLUSTER_NAME }}
3+
version: 1.16
4+
rolearn: {{ .ROLE_ARN }}
5+
resourcesvpcconfig:
6+
endpointpublicaccess: true
7+
subnetids:
8+
{{ range $subnetId := split .SUBNET_IDS .SEPARATOR }}
9+
- {{ $subnetId }}
10+
{{ end }}
11+
nodegroups:
12+
- nodegroupname: {{ .CLUSTER_NAME }}
13+
noderole: {{ .NODE_ROLE }}
14+
disksize: 100
15+
subnets:
16+
{{ range $subnetId := split .SUBNET_IDS .SEPARATOR }}
17+
- {{ $subnetId }}
18+
{{ end }}
19+
instancetypes:
20+
- r6g.xlarge
21+
scalingconfig:
22+
desiredsize: 1
23+
maxsize: 1
24+
minsize: 1
25+
labels:
26+
node-name: funcbench-{{ .PR_NUMBER }}

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.12
44

55
require (
66
cloud.google.com/go v0.56.0
7+
github.com/aws/aws-sdk-go v1.34.5
78
github.com/go-git/go-git-fixtures/v4 v4.0.1
89
github.com/go-git/go-git/v5 v5.1.0
910
github.com/google/go-github/v29 v29.0.3
@@ -24,5 +25,6 @@ require (
2425
k8s.io/apiextensions-apiserver v0.18.4
2526
k8s.io/apimachinery v0.18.4
2627
k8s.io/client-go v0.18.4
28+
sigs.k8s.io/aws-iam-authenticator v0.5.1
2729
sigs.k8s.io/kind v0.8.1
2830
)

go.sum

Lines changed: 54 additions & 0 deletions
Large diffs are not rendered by default.

infra/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,39 @@ Commands:
7979
kind resource delete -f manifestsFileOrFolder -v hashStable:COMMIT1 -v
8080
hashTesting:COMMIT2
8181
82+
eks info
83+
eks info -v hashStable:COMMIT1 -v hashTesting:COMMIT2
84+
85+
eks cluster create
86+
eks cluster create -a credentials -f FileOrFolder
87+
88+
eks cluster delete
89+
eks cluster delete -a credentials -f FileOrFolder
90+
91+
eks nodes create
92+
eks nodes create -a authFile -f FileOrFolder -v ZONE:eu-west-1 -v
93+
CLUSTER_NAME:test -v EKS_SUBNET_IDS: subnetId1,subnetId2,subnetId3
94+
95+
eks nodes delete
96+
eks nodes delete -a authFile -f FileOrFolder -v ZONE:eu-west-1 -v
97+
CLUSTER_NAME:test -v EKS_SUBNET_IDS: subnetId1,subnetId2,subnetId3
98+
99+
eks nodes check-running
100+
eks nodes check-running -a credentails -f FileOrFolder -v ZONE:eu-west-1 -v
101+
CLUSTER_NAME:test -v EKS_SUBNET_IDS: subnetId1,subnetId2,subnetId3
102+
103+
eks nodes check-deleted
104+
eks nodes check-deleted -a authFile -f FileOrFolder -v ZONE:eu-west-1 -v
105+
CLUSTER_NAME:test -v EKS_SUBNET_IDS: subnetId1,subnetId2,subnetId3
106+
107+
eks resource apply
108+
eks resource apply -a credentials -f manifestsFileOrFolder -v
109+
hashStable:COMMIT1 -v hashTesting:COMMIT2
110+
111+
eks resource delete
112+
eks resource delete -a credentials -f manifestsFileOrFolder -v
113+
hashStable:COMMIT1 -v hashTesting:COMMIT2
114+
82115
83116
```
84117

infra/infra.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121

2222
"github.com/pkg/errors"
2323
"github.com/prometheus/test-infra/pkg/provider"
24+
"github.com/prometheus/test-infra/pkg/provider/eks"
2425
"github.com/prometheus/test-infra/pkg/provider/gke"
2526
kind "github.com/prometheus/test-infra/pkg/provider/kind"
2627
"gopkg.in/alecthomas/kingpin.v2"
@@ -107,6 +108,50 @@ func main() {
107108
k8sKINDResource.Command("delete", "kind resource delete -f manifestsFileOrFolder -v hashStable:COMMIT1 -v hashTesting:COMMIT2").
108109
Action(k.ResourceDelete)
109110

111+
// EKS based commands
112+
e := eks.New(dr)
113+
k8sEKS := app.Command("eks", "Amazon Elastic Kubernetes Service - https://aws.amazon.com/eks").
114+
Action(e.SetupDeploymentResources)
115+
k8sEKS.Flag("auth", "filename which consist eks credentials.").
116+
PlaceHolder("credentials").
117+
Short('a').
118+
StringVar(&e.Auth)
119+
120+
k8sEKS.Command("info", "eks info -v hashStable:COMMIT1 -v hashTesting:COMMIT2").
121+
Action(e.GetDeploymentVars)
122+
123+
// EKS Cluster operations
124+
k8sEKSCluster := k8sEKS.Command("cluster", "manage EKS clusters").
125+
Action(e.NewEKSClient).
126+
Action(e.EKSDeploymentParse)
127+
k8sEKSCluster.Command("create", "eks cluster create -a credentials -f FileOrFolder").
128+
Action(e.ClusterCreate)
129+
k8sEKSCluster.Command("delete", "eks cluster delete -a credentials -f FileOrFolder").
130+
Action(e.ClusterDelete)
131+
132+
// Cluster node-pool operations
133+
k8sEKSNodeGroup := k8sEKS.Command("nodes", "manage EKS clusters nodegroups").
134+
Action(e.NewEKSClient).
135+
Action(e.EKSDeploymentParse)
136+
k8sEKSNodeGroup.Command("create", "eks nodes create -a authFile -f FileOrFolder -v ZONE:eu-west-1 -v CLUSTER_NAME:test -v EKS_SUBNET_IDS: subnetId1,subnetId2,subnetId3").
137+
Action(e.NodeGroupCreate)
138+
k8sEKSNodeGroup.Command("delete", "eks nodes delete -a authFile -f FileOrFolder -v ZONE:eu-west-1 -v CLUSTER_NAME:test -v EKS_SUBNET_IDS: subnetId1,subnetId2,subnetId3").
139+
Action(e.NodeGroupDelete)
140+
k8sEKSNodeGroup.Command("check-running", "eks nodes check-running -a credentails -f FileOrFolder -v ZONE:eu-west-1 -v CLUSTER_NAME:test -v EKS_SUBNET_IDS: subnetId1,subnetId2,subnetId3").
141+
Action(e.AllNodeGroupsRunning)
142+
k8sEKSNodeGroup.Command("check-deleted", "eks nodes check-deleted -a authFile -f FileOrFolder -v ZONE:eu-west-1 -v CLUSTER_NAME:test -v EKS_SUBNET_IDS: subnetId1,subnetId2,subnetId3").
143+
Action(e.AllNodeGroupsDeleted)
144+
145+
// K8s resource operations.
146+
k8sEKSResource := k8sEKS.Command("resource", `Apply and delete different k8s resources - deployments, services, config maps etc.Required variables -v ZONE:us-east-2 -v CLUSTER_NAME:test `).
147+
Action(e.NewEKSClient).
148+
Action(e.K8SDeploymentsParse).
149+
Action(e.NewK8sProvider)
150+
k8sEKSResource.Command("apply", "eks resource apply -a credentials -f manifestsFileOrFolder -v hashStable:COMMIT1 -v hashTesting:COMMIT2").
151+
Action(e.ResourceApply)
152+
k8sEKSResource.Command("delete", "eks resource delete -a credentials -f manifestsFileOrFolder -v hashStable:COMMIT1 -v hashTesting:COMMIT2").
153+
Action(e.ResourceDelete)
154+
110155
if _, err := app.Parse(os.Args[1:]); err != nil {
111156
fmt.Fprintln(os.Stderr, errors.Wrapf(err, "Error parsing commandline arguments"))
112157
app.Usage(os.Args[1:])

0 commit comments

Comments
 (0)