-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for multi-cluster testing via KinD (#1392)
Signed-off-by: Nathan Klick <[email protected]>
- Loading branch information
1 parent
22ed9ae
commit ec7eca1
Showing
16 changed files
with
352 additions
and
23 deletions.
There are no files selected for viewing
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
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,27 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
SCRIPT_PATH=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
readonly SCRIPT_PATH | ||
|
||
readonly DIAG_SCRIPT_PATH="${HOME}/diagnostics.sh" | ||
|
||
cat <<EOF >"${DIAG_SCRIPT_PATH}" | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
export PATH="${PATH}" | ||
export KUBECONFIG="${KUBECONFIG}" | ||
export GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" | ||
export JAVA_HOME="${JAVA_HOME}" | ||
cd "${HOME}" | ||
# Install the necessary tools | ||
wget https://github.com/derailed/k9s/releases/download/v0.32.7/k9s_linux_amd64.deb | ||
apt update | ||
apt install -y ./k9s_linux_amd64.deb | ||
rm -f ./k9s_linux_amd64.deb | ||
EOF | ||
|
||
sudo chmod +x "${DIAG_SCRIPT_PATH}" | ||
echo "Wrote diagnostics script: ${DIAG_SCRIPT_PATH}" |
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,7 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
SCRIPT_PATH=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
readonly SCRIPT_PATH | ||
|
||
kubectl apply -f "${SCRIPT_PATH}/manifest.yaml" |
101 changes: 101 additions & 0 deletions
101
test/e2e/dual-cluster/diagnostics/cluster/manifest.yaml
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,101 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: cluster-diagnostics | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: cluster-diagnostics-cm | ||
namespace: cluster-diagnostics | ||
data: | ||
entrypoint.sh: | | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
uid="$(id -u)" | ||
SUDO="" | ||
if [[ "${uid}" -ne 0 ]]; then | ||
if ! command -v sudo >/dev/null 2>&1; then | ||
echo "FATAL: sudo is required to run this script as a non-root user" | ||
exit 1 | ||
fi | ||
SUDO="$(command -v sudo)" | ||
fi | ||
export DEBIAN_FRONTEND=noninteractive | ||
${SUDO} apt update | ||
${SUDO} apt upgrade -y | ||
${SUDO} apt install -y curl ca-certificates jq netcat-traditional \ | ||
dnsutils iperf3 iputils-ping iproute2 tcpdump iputils-tracepath socat | ||
[[ -d /app ]] || ${SUDO} mkdir -p /app | ||
${SUDO} iperf3 -p 8081 -s --timestamps & | ||
${SUDO} socat -lh -lu -v TCP4-LISTEN:8080,fork EXEC:cat & | ||
exec sleep infinity | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: cluster-diagnostics-svc | ||
namespace: cluster-diagnostics | ||
annotations: | ||
service.beta.kubernetes.io/aws-load-balancer-internal: "true" | ||
service.beta.kubernetes.io/aws-load-balancer-type: "nlb" | ||
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "ip" | ||
networking.gke.io/load-balancer-type: "Internal" | ||
spec: | ||
selector: | ||
app: cluster-diagnostics | ||
type: LoadBalancer | ||
externalTrafficPolicy: Cluster | ||
internalTrafficPolicy: Cluster | ||
ports: | ||
- name: socat | ||
port: 8080 | ||
targetPort: 8080 | ||
protocol: TCP | ||
- name: iperf3 | ||
port: 8081 | ||
targetPort: 8081 | ||
protocol: TCP | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: cluster-diagnostics | ||
namespace: cluster-diagnostics | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: cluster-diagnostics | ||
template: | ||
metadata: | ||
labels: | ||
app: cluster-diagnostics | ||
spec: | ||
containers: | ||
- name: cluster-diagnostics | ||
image: ubuntu:noble | ||
command: ["/bin/bash", "/app/entrypoint.sh"] | ||
volumeMounts: | ||
- name: entrypoint | ||
mountPath: /app/entrypoint.sh | ||
subPath: entrypoint.sh | ||
ports: | ||
- containerPort: 8080 | ||
name: socat | ||
protocol: TCP | ||
- containerPort: 8081 | ||
name: iperf3 | ||
protocol: TCP | ||
volumes: | ||
- name: entrypoint | ||
configMap: | ||
name: cluster-diagnostics-cm |
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 @@ | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
kubeadmConfigPatches: | ||
- | | ||
kind: ClusterConfiguration | ||
networking: | ||
dnsDomain: "cluster.local" | ||
networking: | ||
# apiServerAddress: "172.19.0.2" | ||
# apiServerPort: 6443 | ||
podSubnet: "10.10.0.0/16" | ||
serviceSubnet: "10.20.0.0/16" | ||
containerdConfigPatches: | ||
- |- | ||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"] | ||
endpoint = ["https://hub.mirror.docker.lat.ope.eng.hashgraph.io"] |
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 @@ | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
kubeadmConfigPatches: | ||
- | | ||
kind: ClusterConfiguration | ||
networking: | ||
dnsDomain: "cluster.local" | ||
networking: | ||
# apiServerAddress: "172.19.0.3" | ||
# apiServerPort: 6443 | ||
podSubnet: "10.30.0.0/16" | ||
serviceSubnet: "10.40.0.0/16" | ||
containerdConfigPatches: | ||
- |- | ||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"] | ||
endpoint = ["https://hub.mirror.docker.lat.ope.eng.hashgraph.io"] |
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,22 @@ | ||
--- | ||
apiVersion: metallb.io/v1beta1 | ||
kind: IPAddressPool | ||
metadata: | ||
name: local | ||
namespace: metallb-system | ||
spec: | ||
addresses: | ||
- 172.19.1.0/24 | ||
--- | ||
apiVersion: metallb.io/v1beta1 | ||
kind: L2Advertisement | ||
metadata: | ||
name: local | ||
namespace: metallb-system | ||
spec: | ||
ipAddressPools: | ||
- local | ||
nodeSelectors: | ||
- matchLabels: | ||
kubernetes.io/os: linux | ||
|
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,22 @@ | ||
--- | ||
apiVersion: metallb.io/v1beta1 | ||
kind: IPAddressPool | ||
metadata: | ||
name: local | ||
namespace: metallb-system | ||
spec: | ||
addresses: | ||
- 172.19.2.0/24 | ||
--- | ||
apiVersion: metallb.io/v1beta1 | ||
kind: L2Advertisement | ||
metadata: | ||
name: local | ||
namespace: metallb-system | ||
spec: | ||
ipAddressPools: | ||
- local | ||
nodeSelectors: | ||
- matchLabels: | ||
kubernetes.io/os: linux | ||
|
Oops, something went wrong.