Skip to content

Commit

Permalink
fix adding missing pod
Browse files Browse the repository at this point in the history
  • Loading branch information
camilamacedo86 committed Jun 3, 2023
1 parent 145f143 commit 0406c63
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 4 deletions.
52 changes: 50 additions & 2 deletions addons/flannel/0.21.5/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ spec:
topologyKey: "kubernetes.io/hostname"
EOF
else
echo "Create pod to do the test without use podAntiAffinity because has only one node"
kubectl apply -f - <<EOF
echo "Create pod to do the test without use podAntiAffinity because has only one node"
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
Expand All @@ -392,6 +392,54 @@ spec:
EOF
fi

# Wait for udp-receiver to get Running
if ! spinner_until 120 $(kubectl get pod udp-receiver -o 'jsonpath={..status.phase}') != "Running" ]]; then
logWarn "Timeout waiting upd-receiver Pod to be Running"
fi

# Get the IP of udp-receiver
receiver_ip=$(kubectl get pod udp-receiver -o jsonpath="{.status.podIP}")

if [[ $num_nodes -gt 1 ]]; then
echo "Creating udp-sender with podAntiAffinity"
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: udp-sender
labels:
app: udp-sender
spec:
containers:
- name: udp-sender
image: busybox
command: ["sh", "-c", "echo 'Test message' | nc -u $receiver_ip 8472"]
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- udp-receiver
topologyKey: "kubernetes.io/hostname"
EOF
else
echo "Creating udp-sender without podAntiAffinity"
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: udp-sender
spec:
containers:
- name: udp-sender
image: busybox
command: ["sh", "-c", "echo 'Test message' | nc -u $receiver_ip 8472"]
EOF
fi

echo "Waiting up to 2 minutes to check pods created to perform the test are successfully running"
if ! spinner_until 120 udp_pods_are_running; then
logWarn "Pods to check UDP communication with Flannel did not become Ready within the expected time."
Expand Down
52 changes: 50 additions & 2 deletions addons/flannel/template/base/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ spec:
topologyKey: "kubernetes.io/hostname"
EOF
else
echo "Create pod to do the test without use podAntiAffinity because has only one node"
kubectl apply -f - <<EOF
echo "Create pod to do the test without use podAntiAffinity because has only one node"
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
Expand All @@ -392,6 +392,54 @@ spec:
EOF
fi

# Wait for udp-receiver to get Running
if ! spinner_until 120 $(kubectl get pod udp-receiver -o 'jsonpath={..status.phase}') != "Running" ]]; then
logWarn "Timeout waiting upd-receiver Pod to be Running"
fi

# Get the IP of udp-receiver
receiver_ip=$(kubectl get pod udp-receiver -o jsonpath="{.status.podIP}")

if [[ $num_nodes -gt 1 ]]; then
echo "Creating udp-sender with podAntiAffinity"
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: udp-sender
labels:
app: udp-sender
spec:
containers:
- name: udp-sender
image: busybox
command: ["sh", "-c", "echo 'Test message' | nc -u $receiver_ip 8472"]
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- udp-receiver
topologyKey: "kubernetes.io/hostname"
EOF
else
echo "Creating udp-sender without podAntiAffinity"
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: udp-sender
spec:
containers:
- name: udp-sender
image: busybox
command: ["sh", "-c", "echo 'Test message' | nc -u $receiver_ip 8472"]
EOF
fi

echo "Waiting up to 2 minutes to check pods created to perform the test are successfully running"
if ! spinner_until 120 udp_pods_are_running; then
logWarn "Pods to check UDP communication with Flannel did not become Ready within the expected time."
Expand Down

0 comments on commit 0406c63

Please sign in to comment.