Skip to content

Commit

Permalink
update test server and test results (#2421)
Browse files Browse the repository at this point in the history
* ci: add workflow for building test image

* update test server and test results

* bump versions
  • Loading branch information
zhangzujian committed Mar 3, 2023
1 parent 9805070 commit 541b641
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 29 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build-kube-ovn-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build Test
on: workflow_dispatch

jobs:
build:
name: Build Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
check-latest: true

- name: Build
run: make image-test

- name: Push
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
COMMIT: ${{ github.sha }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push kubeovn/test:$(cat VERSION)
2 changes: 1 addition & 1 deletion pkg/controller/service_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (c *Controller) genLbSvcDeployment(svc *corev1.Service) (dp *v1.Deployment)
"service": svc.Name,
}

image := "kubeovn/vpc-nat-gateway:v1.11.0"
image := "kubeovn/vpc-nat-gateway:v1.12.0"
if svc.Annotations[util.LbSvcPodImg] != "" {
image = svc.Annotations[util.LbSvcPodImg]
}
Expand Down
41 changes: 20 additions & 21 deletions test/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ make kind-init kind-install

# Build and deploy test-server
make image-test
kind load docker-image --name kube-ovn kubeovn/test:v1.11.0
kind load docker-image --name kube-ovn kubeovn/test:v1.12.0
kubectl apply -f test/server/test-server.yaml
docker run -d --net=kind kubeovn/test:v1.11.0
docker run --name kube-ovn-test -d --net=kind kubeovn/test:v1.12.0
docker inspect kube-ovn-test -f '{{.NetworkSettings.Networks.kind.IPAddress}}'

# Run test-server analysis tool in one terminal and reload kube-ovn in another terminal
# terminal 1
kubectl exec -it test-client -- ./test-server --remote-address=172.18.0.5 --output=json --duration-seconds=60
# terminal 1 (replace 172.18.0.5/80 with the address/port you want to test)
kubectl exec -it test-client -- ./test-server --remote-address=172.18.0.5 --remote-port=80 --output=json --duration-seconds=60

# terminal 2
kubectl ko reload
Expand All @@ -32,27 +33,25 @@ kubectl ko reload
ICMP test result:

| Scenario | Lost |
|-----------------------------------|------|
| --------------------------------- | ---- |
| Pod address within same node | 0 |
| ovn0 address with in same node | 13 |
| Node address the Pod runs on | 15 |
| Pod address in another node | 4 |
| ovn0 address with in another node | 21 |
| Node address of anther node | 16 |
| Address outside the cluster | 32 |
| ovn0 address with in same node | 0 |
| Node address the Pod runs on | 1 |
| Pod address in another node | 0 |
| ovn0 address with in another node | 0 |
| Node address of another node | 0 |
| Address outside the cluster | 0 |

TCP test result:

| Scenario | Retransmit | Connection Failure | Note |
|---------------------------------|------------|--------------------|------------------|
| Pod address in another node | 38 | 1 | |
| Service address | 86 | 0 | |
| Address outside the cluster | 4 | 1 | |
| External visit NodePort address | | | Connection Reset |
| Scenario | Retransmit | Connection Failure | Note |
| ------------------------------- | ---------- | ------------------ | ---- |
| Pod address in another node | 8 | 0 | |
| Service address | 16 | 0 | |
| Address outside the cluster | 5 | 0 | |
| External visit NodePort address | 0 | 0 | |

## TODO

1. NodePort long connection will be reset which need further investigation.
2. Traffic that go through ovn0 suffers higher lost, and it may be related to internal type port.
3. Replace curl with ab to test high connection concurrency.
4. Need to be tested in large scale cluster where kube-ovn reload might take much longer time.
1. Replace curl with ab to test high connection concurrency.
2. Need to be tested in large scale cluster where kube-ovn reload might take much longer time.
15 changes: 11 additions & 4 deletions test/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@ package main
import (
"encoding/json"
"fmt"
"github.com/spf13/pflag"
"k8s.io/klog/v2"
"os"
"os/exec"
"strconv"
"strings"
"time"

"github.com/spf13/pflag"
"k8s.io/klog/v2"
)

type Configuration struct {
DurationSeconds int64
RemoteAddress string
RemotePort uint32
Output string
}

type Result struct {
DurationSeconds int64
RemoteAddress string
RemotePort uint32
TotalIcmpEcho int
IcmpLost int
TotalTcpOutSegments int
Expand All @@ -33,6 +36,7 @@ func parseFlag() *Configuration {
var (
argDurationSeconds = pflag.Int64("duration-seconds", 60, "The duration to run network break detection.")
argRemoteAddress = pflag.String("remote-address", "100.64.0.1", "The remote address to connect.")
argRemotePort = pflag.Uint32("remote-port", 80, "The remote port to connect.")
argOutput = pflag.String("output", "text", "text or json.")
)

Expand All @@ -41,6 +45,7 @@ func parseFlag() *Configuration {
config := &Configuration{
DurationSeconds: *argDurationSeconds,
RemoteAddress: *argRemoteAddress,
RemotePort: *argRemotePort,
Output: *argOutput,
}
return config
Expand Down Expand Up @@ -108,7 +113,7 @@ func main() {
}
time.Sleep(100 * time.Millisecond)
totalConnection += 1
_, err := exec.Command("curl", "-m", "1", fmt.Sprintf("%s:80", config.RemoteAddress)).CombinedOutput()
_, err := exec.Command("curl", "-m", "1", fmt.Sprintf("%s:%d", config.RemoteAddress, config.RemotePort)).CombinedOutput()
if err != nil {
failedConnection += 1
}
Expand Down Expand Up @@ -143,6 +148,7 @@ func main() {
result := Result{
DurationSeconds: config.DurationSeconds,
RemoteAddress: config.RemoteAddress,
RemotePort: config.RemotePort,
TotalIcmpEcho: curIcmpEcho - preIcmpEcho,
IcmpLost: curDiff - preDiff,
TotalTcpOutSegments: curOutSegs - preOutSegs,
Expand All @@ -152,11 +158,12 @@ func main() {
}

if config.Output == "text" {
klog.Infof("remote address = %s, remote port = %d", result.RemoteAddress, result.RemotePort)
klog.Infof("total icmp echo %d, lost %d icmp response", result.TotalIcmpEcho, result.IcmpLost)
klog.Infof("total out %d tcp segments, retrans %d tcp segments", result.TotalTcpOutSegments, result.TcpRetransSegment)
klog.Infof("%d failed connection, %d total connection", result.TotalTcpConnection, result.FailedTcpConnection)
} else {
output, _ := json.Marshal(result)
output, _ := json.MarshalIndent(result, "", " ")
fmt.Println(string(output))
}
}
4 changes: 2 additions & 2 deletions test/server/test-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
containers:
- name: test-server
image: kubeovn/test:v1.11.0
image: kubeovn/test:v1.12.0
imagePullPolicy: IfNotPresent
nodeSelector:
kubernetes.io/hostname: kube-ovn-control-plane
Expand All @@ -23,7 +23,7 @@ metadata:
spec:
containers:
- name: test-client
image: kubeovn/test:v1.11.0
image: kubeovn/test:v1.12.0
imagePullPolicy: IfNotPresent
nodeSelector:
kubernetes.io/hostname: kube-ovn-worker
Expand Down
2 changes: 1 addition & 1 deletion yamls/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
hostNetwork: true
containers:
- name: kube-ovn-webhook
image: "kubeovn/kube-ovn:v1.11.0"
image: "kubeovn/kube-ovn:v1.12.0"
imagePullPolicy: IfNotPresent
command:
- /kube-ovn/kube-ovn-webhook
Expand Down

0 comments on commit 541b641

Please sign in to comment.