Skip to content

Commit

Permalink
Merge pull request #1 from pragmagic/first-iteration
Browse files Browse the repository at this point in the history
Add test scripts for results for Istio, Kuma, NSM
  • Loading branch information
denis-tingaikin authored Jan 10, 2024
2 parents 9ebc57c + bbbaa5b commit f15f783
Show file tree
Hide file tree
Showing 170 changed files with 16,678 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
/tmp/
/private/

# files created by metallb setup
/metallb-config.yaml
/configmap.yaml
/custom-configmap.yaml

# other files, should be moved to /private

/deployments-k8s
/.vscode
/gotestmd

/dump*
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,25 @@
This repo contains test scripts used to setup
various service meshes in multi-cluster scenarios
and run performance tests.

# Prerequisites

You need to have 2 clusters with working LoadBalancer.
Each node must be reachable by other nodes by node IP.

If you don't have clusters yet, you can use scripts in `cluster-setup` folder as examples.

You need to have 2 kubeconfig files, place them
in `KUBECONFIG1` and `KUBECONFIG2` environment variables.

# Run tests

```bash
./scripts/test_suite.sh
```

# Generating result table from raw JSON files

```bash
./scripts/extract_statistics.sh ./scripts/results/suites/2023-11-14-T17-12-aws_aws/ ./test-out
```
2 changes: 2 additions & 0 deletions cluster-setup/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

/private
44 changes: 44 additions & 0 deletions cluster-setup/aws--setup-security-1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash

parent_path=$( cd "$(dirname "$0")" ; pwd -P ) || exit

source "$parent_path"/private/aws-login.sh || exit

AWS_CLUSTER_NAME=aws-msm-perf-test-1

sg=$(aws ec2 describe-security-groups --filter Name=tag:aws:eks:cluster-name,Values="${AWS_CLUSTER_NAME}" --region="us-east-1" --query 'SecurityGroups[0].GroupId' --output text)

echo "security group is $sg"

## Setup security group rules
for i in {1..25}
do
if [[ -n $sg ]]; then
break
fi
sleep 30
echo attempt "$i" has failed
sg=$(aws ec2 describe-security-groups --filter Name=tag:aws:eks:cluster-name,Values="${AWS_CLUSTER_NAME}" --region="us-east-1" --query 'SecurityGroups[0].GroupId' --output text)
done

if [[ -z $sg ]]; then
echo "Security group is not found"
exit 1
fi

### authorize wireguard
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 51820 --cidr 0.0.0.0/0 | cat
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol udp --port 51820 --cidr 0.0.0.0/0 | cat
### authorize ipsec
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol udp --port 4500 --cidr 0.0.0.0/0 | cat
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol udp --port 500 --cidr 0.0.0.0/0 | cat
### authorize vxlan
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 4789 --cidr 0.0.0.0/0 | cat
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol udp --port 4789 --cidr 0.0.0.0/0 | cat
### authorize nsmgr-proxy
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 5004 --cidr 0.0.0.0/0 | cat
### authorize registry
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 5002 --cidr 0.0.0.0/0 | cat
### authorize vl3-ipam
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 5006 --cidr 0.0.0.0/0 | cat

41 changes: 41 additions & 0 deletions cluster-setup/aws--setup-security-2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

parent_path=$( cd "$(dirname "$0")" ; pwd -P ) || exit

source "$parent_path"/private/aws-login.sh || exit

AWS_CLUSTER_NAME=aws-msm-perf-test-2

sg=$(aws ec2 describe-security-groups --filter Name=tag:aws:eks:cluster-name,Values="${AWS_CLUSTER_NAME}" --region="us-east-1" --query 'SecurityGroups[0].GroupId' --output text)

echo "security group is $sg"

## Setup security group rules
for i in {1..25}
do
if [[ -n $sg ]]; then
break
fi
sleep 30
echo attempt "$i" has failed
sg=$(aws ec2 describe-security-groups --filter Name=tag:aws:eks:cluster-name,Values="${AWS_CLUSTER_NAME}" --region="us-east-1" --query 'SecurityGroups[0].GroupId' --output text)
done

if [[ -z $sg ]]; then
echo "Security group is not found"
exit 1
fi

### authorize wireguard
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 51820 --cidr 0.0.0.0/0 | cat
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol udp --port 51820 --cidr 0.0.0.0/0 | cat
### authorize vxlan
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 4789 --cidr 0.0.0.0/0 | cat
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol udp --port 4789 --cidr 0.0.0.0/0 | cat
### authorize nsmgr-proxy
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 5004 --cidr 0.0.0.0/0 | cat
### authorize registry
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 5002 --cidr 0.0.0.0/0 | cat
### authorize vl3-ipam
aws ec2 authorize-security-group-ingress --region="us-east-1" --group-id "$sg" --protocol tcp --port 5006 --cidr 0.0.0.0/0 | cat

24 changes: 24 additions & 0 deletions cluster-setup/aws-1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
name: aws-msm-perf-test-1
region: us-east-1
version: '1.27'

kubernetesNetworkConfig:
ipFamily: IPv4

addons:
- name: vpc-cni
- name: coredns
- name: kube-proxy

iam:
withOIDC: true

managedNodeGroups:
- name: aws-msm-perf-test-1
instanceType: m5.2xlarge
desiredCapacity: 1
24 changes: 24 additions & 0 deletions cluster-setup/aws-2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
name: aws-msm-perf-test-2
region: us-east-1
version: '1.27'

kubernetesNetworkConfig:
ipFamily: IPv4

addons:
- name: vpc-cni
- name: coredns
- name: kube-proxy

iam:
withOIDC: true

managedNodeGroups:
- name: aws-msm-perf-test-2
instanceType: m5.2xlarge
desiredCapacity: 1
13 changes: 13 additions & 0 deletions cluster-setup/aws-create-1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

parent_path=$( cd "$(dirname "$0")" ; pwd -P ) || exit

source "$parent_path"/private/aws-login.sh || exit

kube_config_dir=/tmp/kind-configs
mkdir -p "$kube_config_dir" || exit

aws_kubeconfig="$kube_config_dir"/kubeconfig-aws-1
KUBECONFIG="$aws_kubeconfig" eksctl create cluster -f "$parent_path"/aws-1.yaml || exit

"$parent_path"/aws--setup-security-1.sh || exit
13 changes: 13 additions & 0 deletions cluster-setup/aws-create-2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

parent_path=$( cd "$(dirname "$0")" ; pwd -P ) || exit

source "$parent_path"/private/aws-login.sh || exit

kube_config_dir=/tmp/kind-configs
mkdir -p "$kube_config_dir" || exit

aws_kubeconfig="$kube_config_dir"/kubeconfig-aws-2
KUBECONFIG="$aws_kubeconfig" eksctl create cluster -f "$parent_path"/aws-2.yaml || exit

"$parent_path"/aws--setup-security-2.sh || exit
7 changes: 7 additions & 0 deletions cluster-setup/aws-delete-1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

parent_path=$( cd "$(dirname "$0")" ; pwd -P ) || exit

source "$parent_path"/private/aws-login.sh || exit

eksctl delete cluster -f "$parent_path"/aws-1.yaml
7 changes: 7 additions & 0 deletions cluster-setup/aws-delete-2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

parent_path=$( cd "$(dirname "$0")" ; pwd -P ) || exit

source "$parent_path"/private/aws-login.sh || exit

eksctl delete cluster -f "$parent_path"/aws-2.yaml
41 changes: 41 additions & 0 deletions cluster-setup/aws-install-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

function install_aws() {
# check if aws is already installed
aws --version && return

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" || exit
unzip awscliv2.zip || exit
sudo ./aws/install || exit
rm -rf ./aws || exit
rm -f awscliv2.zip || exit

# verify aws works
aws --version || exit
}

function install_eksctl() {
# check if eksctl is already installed
eksctl version && return

ARCH=amd64
PLATFORM=$(uname -s)_$ARCH

curl -sLO "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz" || exit

# (Optional) Verify checksum
curl -sL "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_checksums.txt" \
| grep $PLATFORM \
| sha256sum --check \
|| exit

tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp || exit
rm eksctl_$PLATFORM.tar.gz || exit

sudo mv /tmp/eksctl /usr/local/bin || exit

# verify eksctl works
eksctl version || exit
}

(install_aws && install_eksctl)
33 changes: 33 additions & 0 deletions cluster-setup/aws-install-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

function install_aws() {
# check if aws is already installed
aws --version && return

curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" || exit
sudo installer -pkg AWSCLIV2.pkg -target / || exit
rm -f AWSCLIV2.pkg || exit

# verify aws works
aws --version || exit
}

function install_eksctl() {
# check if eksctl is already installed
eksctl version && return

ARCH=amd64
PLATFORM=$(uname -s)_$ARCH

curl -sLO "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz" || exit

tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp || exit
rm eksctl_$PLATFORM.tar.gz || exit

sudo mv /tmp/eksctl /usr/local/bin || exit

# verify eksctl works
eksctl version || exit
}

(install_aws && install_eksctl)
7 changes: 7 additions & 0 deletions cluster-setup/aws-list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

parent_path=$( cd "$(dirname "$0")" ; pwd -P ) || exit

source "$parent_path"/private/aws-login.sh || exit

aws eks list-clusters --region us-east-1
18 changes: 18 additions & 0 deletions cluster-setup/clusterctl-install-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

function install_clusterctl() {
clusterctl version && return

curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.5.2/clusterctl-linux-amd64 -o clusterctl || exit
sudo install -o root -g root -m 0755 clusterctl /usr/local/bin/clusterctl
clusterctl version || exit
}

function install_metal() {
metal --version && return

go install github.com/equinix/metal-cli/cmd/metal@latest
metal --version || exit
}

(install_clusterctl && install_metal)
19 changes: 19 additions & 0 deletions cluster-setup/clusterctl-install-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

function install_clusterctl() {
clusterctl version && return

curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.5.2/clusterctl-darwin-amd64 -o clusterctl || exit
chmod +x ./clusterctl || exit
sudo mv ./clusterctl /usr/local/bin/clusterctl || exit
clusterctl version || exit
}

function install_metal() {
metal --version && return

go install github.com/equinix/metal-cli/cmd/metal@latest
metal --version || exit
}

(install_clusterctl && install_metal)
18 changes: 18 additions & 0 deletions cluster-setup/env--autocomplete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env false "This script should be sourced in a shell, not executed directly"

alias "k1=kubectl --kubeconfig=$KUBECONFIG1"
alias "k2=kubectl --kubeconfig=$KUBECONFIG2"

shellname=$(ps -cp "$$" -o command="")
if [ "$shellname" = "bash" ]; then
echo "set autocompletion for bash"
source <(kubectl completion bash) || return || exit
complete -o default -F __start_kubectl k1 || return || exit
complete -o default -F __start_kubectl k2 || return || exit
elif [ "$shellname" = "zsh" ]; then
echo "set autocompletion for zsh"
source <(kubectl completion zsh) || return || exit
else
echo "unsupported shell $shellname"
return 1
fi
20 changes: 20 additions & 0 deletions cluster-setup/env--kubeconfig-aws.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

# ===== get script folder =====
shellname=$(ps -cp "$$" -o command="")
if [ "$shellname" = "bash" ]; then
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P ) || return
elif [ "$shellname" = "zsh" ]; then
parent_path=$( cd "$(dirname "${(%):-%x}")" && pwd -P ) || return
else
echo "unsupported shell $shellname"
return 1
fi
# ===== ===== =====

kubeconfig="$1"
cluster_name="$2"
echo "place $cluster_name config into $kubeconfig"

rm -f "$kubeconfig" &&
KUBECONFIG="$kubeconfig" aws eks update-kubeconfig --region us-east-1 --name "$cluster_name"
Loading

0 comments on commit f15f783

Please sign in to comment.