-
Notifications
You must be signed in to change notification settings - Fork 248
ci: mtu check for cilium e2e #3624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a8880d5
init commit: create script for mtu check
camrynl 5e157ad
ci: cilium e2e run mtu check
camrynl bb037a7
ci: scale pod deployment in release tests
camrynl 70959a2
ci: rollout status
camrynl 82f6e03
test: template call
camrynl d25b1c6
addressing comments, fix script scale deployment
camrynl 9312604
address nits, test maxSkew, add exit on errors
camrynl 225d09a
adding missing template calls
camrynl 64fce27
fix cilium-overlay e2e
camrynl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
steps: | ||
- script: | | ||
cd hack/scripts | ||
chmod +x cilium-mtu-validation.sh | ||
./cilium-mtu-validation.sh | ||
name: "CiliumMTUValidation" | ||
displayName: "Run Cilium MTU Validation" |
This file contains hidden or 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 hidden or 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,29 @@ | ||
apiVersion: apps/v1 | ||
jpayne3506 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
kind: Deployment | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
namespace: kube-system | ||
spec: | ||
replicas: 4 | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: mcr.microsoft.com/azurelinux/base/nginx:1 | ||
ports: | ||
- containerPort: 80 | ||
topologySpreadConstraints: | ||
- maxSkew: 1 | ||
topologyKey: kubernetes.io/hostname # KV: Key is hostname, value is each unique nodename | ||
whenUnsatisfiable: ScheduleAnyway | ||
labelSelector: | ||
matchLabels: | ||
app: nginx |
This file contains hidden or 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,103 @@ | ||
#!/bin/bash | ||
NAMESPACE="kube-system" | ||
|
||
echo "Deploy nginx pods for MTU testing" | ||
kubectl apply -f ../manifests/nginx.yaml | ||
kubectl wait --for=condition=available --timeout=60s -n $NAMESPACE deployment/nginx | ||
|
||
# Check node count | ||
node_count=$(kubectl get nodes --no-headers | wc -l) | ||
|
||
# in CNI release test scenario scale deployments to 3 * node count to get replicas on each node | ||
if [ "$node_count" -gt 1 ]; then | ||
echo "Scaling nginx deployment to $((3 * node_count)) replicas" | ||
kubectl scale deployment nginx --replicas=$((3 * node_count)) -n $NAMESPACE | ||
fi | ||
# Wait for nginx pods to be ready | ||
kubectl wait --for=condition=available --timeout=60s -n $NAMESPACE deployment/nginx | ||
|
||
|
||
|
||
echo "Checking MTU for pods in namespace: $NAMESPACE using Cilium agent and nginx MTU" | ||
|
||
# Get all nodes | ||
nodes=$(kubectl get nodes -o jsonpath='{.items[*].metadata.name}') | ||
|
||
for node in $nodes; do | ||
echo "Checking node: $node" | ||
|
||
# Get the Cilium agent pod running on this node | ||
cilium_pod=$(kubectl get pods -n $NAMESPACE -o wide --field-selector spec.nodeName=$node -l k8s-app=cilium -o jsonpath='{.items[0].metadata.name}') | ||
|
||
if [ -z "$cilium_pod" ]; then | ||
echo "Failed to find Cilium agent pod on node $node" | ||
echo "##[error]Failed to find Cilium agent pod on node $node" | ||
exit 1 | ||
fi | ||
|
||
# Get the MTU of eth0 in the Cilium agent pod | ||
cilium_mtu=$(kubectl exec -n $NAMESPACE $cilium_pod -- cat /sys/class/net/eth0/mtu 2>/dev/null) | ||
|
||
if [ -z "$cilium_mtu" ]; then | ||
echo "Failed to get MTU from Cilium agent pod on node $node" | ||
echo "##[error]Failed to get MTU from Cilium agent pod on node $node" | ||
exit 1 | ||
fi | ||
|
||
echo "Cilium agent eth0 MTU: $cilium_mtu" | ||
|
||
# Get an nginx pod running on this node | ||
nginx_pod=$(kubectl get pods -n $NAMESPACE -o wide --field-selector spec.nodeName=$node -l app=nginx -o jsonpath='{.items[0].metadata.name}') | ||
if [ -z "$nginx_pod" ]; then | ||
echo "Failed to find nginx pod on node $node" | ||
echo "##[error]Failed to find nginx pod on node $node" | ||
exit 1 | ||
fi | ||
# Get the MTU of eth0 in the nginx pod | ||
nginx_mtu=$(kubectl exec -n $NAMESPACE $nginx_pod -- cat /sys/class/net/eth0/mtu 2>/dev/null) | ||
if [ -z "$nginx_mtu" ]; then | ||
echo "Failed to get MTU from nginx pod on node $node" | ||
echo "##[error]Failed to get MTU from nginx pod on node $node" | ||
exit 1 | ||
fi | ||
echo "Nginx pod eth0 MTU: $nginx_mtu" | ||
|
||
# Get the node's eth0 MTU | ||
node_mtu=$(kubectl debug node/$node -it --image=busybox -- sh -c "cat /sys/class/net/eth0/mtu" 2>/dev/null | tail -n 1) | ||
vipul-21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if [ -z "$node_mtu" ]; then | ||
echo "Failed to get MTU from node $node" | ||
echo "##[error]Failed to get MTU from node $node" | ||
exit 1 | ||
fi | ||
echo "Node eth0 MTU: $node_mtu" | ||
|
||
# Check if the MTUs match | ||
if [ "$cilium_mtu" -eq "$nginx_mtu" ] && [ "$nginx_mtu" -eq "$node_mtu" ]; then | ||
echo "MTU validation passed for node $node" | ||
else | ||
echo "MTU validation failed for node $node" | ||
echo "Cilium agent MTU: $cilium_mtu, Nginx pod MTU: $nginx_mtu, Node MTU: $node_mtu" | ||
echo "##[error]MTU validation failed. MTUs do not match." | ||
exit 1 | ||
fi | ||
|
||
echo "----------------------------------------" | ||
|
||
done | ||
|
||
# Clean up | ||
kubectl delete deployment nginx -n $NAMESPACE | ||
echo "Cleaned up nginx deployment" | ||
|
||
# Clean up the debug pod | ||
debug_pod=$(kubectl get pods -o name | grep "node-debugger") | ||
vipul-21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if [ -n "$debug_pod" ]; then | ||
kubectl delete $debug_pod | ||
kubectl wait --for=delete $debug_pod --timeout=60s | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to clean up debug pod $debug_pod" | ||
fi | ||
else | ||
echo "No debug pod found" | ||
fi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.