-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vitaliy Guschin <[email protected]>
- Loading branch information
Vitaliy Guschin
committed
May 23, 2024
1 parent
84206c4
commit 3272f17
Showing
163 changed files
with
26,502 additions
and
124 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0
cluster-setup/aws-delete-1.sh → cluster-setup/aws/aws-delete-1.sh
100644 → 100755
File renamed without changes.
0
cluster-setup/aws-delete-2.sh → cluster-setup/aws/aws-delete-2.sh
100644 → 100755
File renamed without changes.
File renamed without changes.
File renamed without changes.
0
cluster-setup/aws-list.sh → cluster-setup/aws/aws-list.sh
100644 → 100755
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0
cluster-setup/env-restore.sh → cluster-setup/aws/env-restore.sh
100644 → 100755
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
# AWS cluster setup | ||
|
||
This folder contains scripts to set up AWS clusters for testing. | ||
|
||
# Authentication | ||
|
||
Create file `cluster-setup/aws/private/aws-login.sh` with the following content: | ||
|
||
```bash | ||
#!/usr/bin/env false | ||
|
||
export AWS_ACCESS_KEY_ID= | ||
export AWS_SECRET_ACCESS_KEY= | ||
``` | ||
|
||
Put your values into variables. | ||
|
||
No additional actions are needed. | ||
|
||
# Install CLI | ||
|
||
Run `aws-install-` script to install CLI | ||
|
||
# Prepare clusters | ||
|
||
After you set up required authentication you can just use `aws-create` scripts: | ||
|
||
```bash | ||
./cluster-setup/aws/aws-create-1.sh | ||
./cluster-setup/aws/aws-create-2.sh | ||
``` | ||
|
||
List clusters: | ||
|
||
```bash | ||
./cluster-setup/aws/aws-list.sh | ||
``` | ||
|
||
Setup test environment | ||
|
||
Run `env-aws-aws.sh` for initial setup, to create kubeconfig files. | ||
|
||
Taint nodes: | ||
|
||
```bash | ||
k1 taint node -l node-role.kubernetes.io/control-plane node-role.kubernetes.io/master:NoSchedule | ||
k2 taint node -l node-role.kubernetes.io/control-plane node-role.kubernetes.io/master:NoSchedule | ||
``` | ||
|
||
Metallb setup: | ||
|
||
```bash | ||
k1 create ns metallb-system | ||
k1 apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/metallb.yaml | ||
k1 -n metallb-system create cm config | ||
k2 create ns metallb-system | ||
k2 apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/metallb.yaml | ||
k2 -n metallb-system create cm config | ||
``` | ||
|
||
# Execute tests | ||
|
||
```bash | ||
./scripts/test_suite.sh | ||
``` | ||
|
||
# Cleanup | ||
|
||
```bash | ||
./cluster-setup/aws/aws-delete-1.sh | ||
./cluster-setup/aws/aws-delete-2.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
# ===== get script folder ===== | ||
shellname=$(ps -cp "$$" -o command="") | ||
if [ "$shellname" = "bash" ]; then | ||
script_path="${BASH_SOURCE[0]}" | ||
elif [ "$shellname" = "zsh" ]; then | ||
script_path="${(%):-%x}" | ||
else | ||
echo "unsupported shell $shellname" | ||
return 1 || exit 1 | ||
fi | ||
parent_path=$( cd "$(dirname "$script_path")" && pwd -P ) || return || exit | ||
# ===== ===== ===== | ||
|
||
kind get kubeconfig --name kind-1 > "$parent_path"/kubeconfig/config1 | ||
kind get kubeconfig --name kind-2 > "$parent_path"/kubeconfig/config2 | ||
export KUBECONFIG1="$parent_path"/kubeconfig/config1 | ||
export KUBECONFIG2="$parent_path"/kubeconfig/config2 | ||
export CLUSTER1_CIDR=172.21.0.0/24 | ||
export CLUSTER2_CIDR=172.21.1.0/24 | ||
export K8S_ENV_NAME=kind_kind | ||
export USE_KIND_NODE=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo " | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
- role: worker" | kind create cluster --config - --name kind-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo " | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
- role: worker" | kind create cluster --config - --name kind-2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
# Kind cluster setup for local testing | ||
|
||
Create clusters: | ||
|
||
```bash | ||
./cluster-setup/kind-local/kind-create-1.sh | ||
./cluster-setup/kind-local/kind-create-2.sh | ||
``` | ||
|
||
Setup test environment: | ||
|
||
```bash | ||
source ./cluster-setup/kind-local/env-kind-kind.sh | ||
``` | ||
|
||
Taint nodes: | ||
|
||
```bash | ||
k1 taint node -l node-role.kubernetes.io/control-plane node-role.kubernetes.io/master:NoSchedule | ||
k2 taint node -l node-role.kubernetes.io/control-plane node-role.kubernetes.io/master:NoSchedule | ||
``` | ||
|
||
# Execute tests | ||
|
||
```bash | ||
./scripts/test_suite.sh | ||
``` | ||
|
||
# Cleanup | ||
|
||
```bash | ||
kind delete cluster --name kind-1 | ||
kind delete cluster --name kind-2 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env false "This script should be sourced in a shell, not executed directly" | ||
|
||
# ===== get script folder ===== | ||
shellname=$(ps -cp "$$" -o command="") | ||
if [ "$shellname" = "bash" ]; then | ||
script_path="${BASH_SOURCE[0]}" | ||
elif [ "$shellname" = "zsh" ]; then | ||
script_path="${(%):-%x}" | ||
else | ||
echo "unsupported shell $shellname" | ||
return 1 || exit 1 | ||
fi | ||
parent_path=$( cd "$(dirname "$script_path")" && pwd -P ) || return || exit | ||
# ===== ===== ===== | ||
|
||
split_configs=${1:-} | ||
|
||
[ "$split_configs" = 'split' ] || source "$parent_path"/private/current-env.sh "$parent_path"/private | ||
[ ! "$split_configs" = 'split' ] || source "$parent_path"/private/current-env-1.sh "$parent_path"/private | ||
[ ! "$split_configs" = 'split' ] || source "$parent_path"/private/current-env-2.sh "$parent_path"/private | ||
source "$parent_path"/env--autocomplete.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo " | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
- role: worker" | kind create cluster --config - --name kind-management |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0
cluster-setup/packet-lb-1.sh → cluster-setup/packet/packet-lb-1.sh
100644 → 100755
File renamed without changes.
0
cluster-setup/packet-lb-2.sh → cluster-setup/packet/packet-lb-2.sh
100644 → 100755
File renamed without changes.
0
cluster-setup/packet-list.sh → cluster-setup/packet/packet-list.sh
100644 → 100755
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
|
||
# Equinix Metal cluster setup | ||
|
||
This folder contains scripts to set up Equinix metal clusters for testing. | ||
|
||
# Authentication | ||
|
||
Create file `./cluster-setup/packet/private/packet-login.sh` with the following content: | ||
|
||
```bash | ||
#!/usr/bin/env false | ||
|
||
export PROJECT_ID= | ||
# METAL_AUTH_TOKEN and PACKET_API_KEY should have the same value | ||
# METAL_AUTH_TOKEN is for metal cli | ||
# PACKET_API_KEY is for clusterctl | ||
export METAL_AUTH_TOKEN= | ||
export PACKET_API_KEY= | ||
# usually METRO=da | ||
export METRO= | ||
# your public key (get it using 'cat ~/.ssh/id_rsa.pub' or generate another one), like SSH_KEY="ssh-rsa AAAAC3NzaC1lZDI1NTE5AAAAIjAqaYj9nmCkgr4PdK username@computer" | ||
export SSH_KEY= | ||
``` | ||
|
||
# Install CLI | ||
|
||
Run `clusterctl-install-` script to install CLI | ||
|
||
# Prepare clusters | ||
|
||
Initialize a Kind cluster for management | ||
|
||
```bash | ||
./cluster-setup/packet/kind-create.sh | ||
kind get kubeconfig --name kind-management > /tmp/kubeconfigs/config-management | ||
source ./cluster-setup/packet/packet-init-env.sh /tmp/kubeconfigs/config-management | ||
``` | ||
|
||
Generate workload clusters | ||
|
||
```bash | ||
source ./cluster-setup/packet/packet-create-1.sh | ||
source ./cluster-setup/packet/packet-create-2.sh | ||
``` | ||
|
||
List clusters | ||
|
||
```bash | ||
./cluster-setup/packet/packet-list.sh | ||
clusterctl describe --show-conditions all cluster msm-perf-test-1 | ||
clusterctl describe --show-conditions all cluster msm-perf-test-2 | ||
``` | ||
|
||
Setup test environment | ||
|
||
```bash | ||
source ./cluster-setup/packet/env-packet.sh 1 1 | ||
source ./cluster-setup/packet/env-packet.sh 2 2 | ||
``` | ||
|
||
When using a pre-configured packet cluster, place kubeconfig files here: | ||
|
||
- `./cluster-setup/packet/private/kubeconfig/packet_1.yaml` | ||
- `./cluster-setup/packet/private/kubeconfig/packet_2.yaml` | ||
|
||
Taint nodes: | ||
|
||
```bash | ||
k1 taint node -l node-role.kubernetes.io/control-plane node-role.kubernetes.io/master:NoSchedule | ||
k2 taint node -l node-role.kubernetes.io/control-plane node-role.kubernetes.io/master:NoSchedule | ||
``` | ||
|
||
Install CNI | ||
|
||
```bash | ||
k1 apply -k https://github.com/networkservicemesh/integration-k8s-packet/scripts/defaultCNI | ||
k2 apply -k https://github.com/networkservicemesh/integration-k8s-packet/scripts/defaultCNI | ||
``` | ||
|
||
SPIRE server requires StorageClass | ||
```bash | ||
k1 apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.24/deploy/local-path-storage.yaml | ||
k1 patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' | ||
|
||
k2 apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.24/deploy/local-path-storage.yaml | ||
k2 patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' | ||
``` | ||
|
||
Metallb setup: | ||
|
||
```bash | ||
./cluster-setup/packet/packet-lb-1.sh | ||
./cluster-setup/packet/packet-lb-2.sh | ||
``` | ||
|
||
# Execute tests | ||
|
||
```bash | ||
./scripts/test_suite.sh | ||
``` | ||
|
||
# Cleanup | ||
|
||
```bash | ||
./cluster-setup/packet/packet-delete-1.sh | ||
./cluster-setup/packet/packet-delete-2.sh | ||
kind delete cluster --name kind-management | ||
``` |
Oops, something went wrong.