Skip to content

Commit

Permalink
test: add cl2 config to deploy kapinger
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Castilio dos Santos <[email protected]>
  • Loading branch information
alexcastilio committed Dec 18, 2024
1 parent 298a7d6 commit 3e1a126
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 4 deletions.
35 changes: 35 additions & 0 deletions .github/actions/cl2/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: test
namespace:
number: 1
prefix: traffic
tuningSets:
- name: Uniform1qps
qpsLoad:
qps: 1
- name: Uniform500qps
qpsLoad:
qps: 500
steps:
- name: Start measurements
measurements:
- Identifier: WaitForControlledPodsRunning
Method: WaitForControlledPodsRunning
Params:
action: start
apiVersion: apps/v1
kind: Deployment
labelSelector: is-real = true
operationTimeout: 120s
- module:
path: /traffic/kapinger.yaml
params:
namespace: traffic-1
tuningSet: Uniform500qps
deployments: 10
podReplicas: 5
- name: Wait for pods to be running
measurements:
- Identifier: WaitForControlledPodsRunning
Method: WaitForControlledPodsRunning
Params:
action: gather
19 changes: 19 additions & 0 deletions .github/actions/cl2/network-policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{.Name}}
labels:
app: kapinger
spec:
policyTypes:
- Ingress
- Egress
podSelector:
matchLabels:
shared-N: N
unique-dep-label: "{{.Index}}"
ingress:
- from:
- podSelector:
matchLabels:
app: shared-{{???}}
61 changes: 61 additions & 0 deletions .github/actions/cl2/traffic/kapinger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## Kapinger module creates kapinger components

# Namespaces where kapinger will be deployed to
{{$namespace := DefaultParam .namespace "traffic-1"}}
# Tuning set
{{$tuningSet := DefaultParam .tuningSet "Uniform500qps"}}
# Number of deployments
{{$deployments := DefaultParam .deployments 1000}}
# Number of pods per deploymen
{{$podReplicas := DefaultParam .podReplicas 20}}

steps:
- name: Create service accounts
phases:
- namespaceList:
- {{$namespace}}
replicasPerNamespace: 1
tuningSet: {{$tuningSet}}
objectBundle:
- basename: kapinger-sa
objectTemplatePath: "traffic/kapinger/sa.yaml"
- name: Create cluster role
phases:
- namespaceList:
- ""
replicasPerNamespace: 1
tuningSet: {{$tuningSet}}
objectBundle:
- basename: kapinger-role
objectTemplatePath: "traffic/kapinger/role.yaml"
- name: Create cluster role binding
phases:
- namespaceList:
- ""
replicasPerNamespace: 1
tuningSet: {{$tuningSet}}
objectBundle:
- basename: kapinger-rolebinding
objectTemplatePath: "traffic/kapinger/rolebinding.yaml"
templateFillMap:
subjectNamespace: {{$namespace}}
- name: Create deployments
phases:
- namespaceList:
- {{$namespace}}
replicasPerNamespace: {{$deployments}}
tuningSet: {{$tuningSet}}
objectBundle:
- basename: kapinger
objectTemplatePath: "traffic/kapinger/deployment.yaml"
templateFillMap:
Replicas: {{$podReplicas}}
- name: Create services
phases:
- namespaceList:
- {{$namespace}}
replicasPerNamespace: {{$deployments}}
tuningSet: {{$tuningSet}}
objectBundle:
- basename: kapinger
objectTemplatePath: "traffic/kapinger/svc.yaml"
54 changes: 54 additions & 0 deletions .github/actions/cl2/traffic/kapinger/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{.Name}}
labels:
is-real: "true"
spec:
replicas: {{.Replicas}}
selector:
matchLabels:
app: kapinger
template:
metadata:
labels:
app: kapinger
is-real: "true"
unique-dep-label: "{{.Index}}"
spec:
nodeSelector:
kubernetes.io/os: linux
scale-test: "true"
kubernetes.io/arch: amd64
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: kapinger
serviceAccountName: kapinger-sa-0
containers:
- image: acnpublic.azurecr.io/kapinger:20241014.7
name: kapinger
resources:
limits:
memory: 80Mi
requests:
memory: 20Mi
ports:
- containerPort: 8080
env:
- name: GODEBUG
value: "netdns=go"
- name: TARGET_TYPE
value: "service"
- name: HTTP_PORT
value: "8080"
- name: TCP_PORT
value: "8085"
- name: UDP_PORT
value: "8086"

13 changes: 13 additions & 0 deletions .github/actions/cl2/traffic/kapinger/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kapinger-role
rules:
- apiGroups:
- ""
resources:
- services
- pods
verbs:
- get
- list
12 changes: 12 additions & 0 deletions .github/actions/cl2/traffic/kapinger/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kapinger-rolebinding
subjects:
- kind: ServiceAccount
name: kapinger-sa-0
namespace: {{.subjectNamespace}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kapinger-role-0
4 changes: 4 additions & 0 deletions .github/actions/cl2/traffic/kapinger/sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: kapinger-sa
14 changes: 14 additions & 0 deletions .github/actions/cl2/traffic/kapinger/svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{.Name}}
labels:
app: kapinger
spec:
selector:
app: kapinger
unique-dep-label: "{{.Index}}"
ports:
- port: 8080
protocol: TCP
targetPort: 8080
16 changes: 12 additions & 4 deletions .github/workflows/scale-test-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ jobs:
shell: bash
run: |
set -euo pipefail
echo "Run Scale Test"
kubectl get ns
# Placeholder for test
sleep 300 &
echo "TEST_PID=$!" >> $GITHUB_ENV
- name: Clone ClusterLoader2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -159,14 +160,21 @@ jobs:
- name: Setup CL2
run: |
cd perf-tests/clusterloader2
mkdir test
cp ../../.github/actions/cl2/* ./test -r
go build ./cmd/clusterloader.go
ls -l
- name: Run CL2
shell: bash
run: |
set -euo pipefail
echo "Run CL2"
# ./clusterloader --kubeconfig $KUBECONFIG --num-deployments $NUM_DEPLOYMENTS --num-replicas $NUM_REPLICAS --num-netpol $NUM_NETPOL
cd perf-tests/clusterloader2
./clusterloader --testconfig=./test/config.yaml --provider=aks --kubeconfig=$HOME/.kube/config --v=2 --report-dir=./report
- name: Stop test
shell: bash
run: kill $TEST_PID

cleanup:
name: Cleanup
Expand Down

0 comments on commit 3e1a126

Please sign in to comment.