Allow time for network policy changes to take effect
Also change from waiting longer to polling until connections are established after restarting Weave Net.
This commit is contained in:
1 parent
95c020fbe0
commit
d45579bf82
1 file changed
+17
-2
@@ -54,7 +54,7 @@ sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
|
|||||||
-e "s%env:%$WEAVE_ENV_VARS%" \
|
-e "s%env:%$WEAVE_ENV_VARS%" \
|
||||||
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.9.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.9.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
||||||
|
|
||||||
sleep 5
|
sleep 2
|
||||||
|
|
||||||
check_connections() {
|
check_connections() {
|
||||||
run_on $HOST1 "curl -sS http://127.0.0.1:6784/status | grep \"$SUCCESS\""
|
run_on $HOST1 "curl -sS http://127.0.0.1:6784/status | grep \"$SUCCESS\""
|
||||||
@@ -247,6 +247,9 @@ spec:
|
|||||||
- namespaceSelector: {}
|
- namespaceSelector: {}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Allow some time for the policy change to take effect
|
||||||
|
sleep 2
|
||||||
|
|
||||||
# Should be able to access from the "deny" pod now
|
# Should be able to access from the "deny" pod now
|
||||||
assert_raises "$SSH $HOST1 $KUBECTL exec $denyPodName -- curl -s -S -f -m 2 http://$DOMAIN:8080/status >/dev/null"
|
assert_raises "$SSH $HOST1 $KUBECTL exec $denyPodName -- curl -s -S -f -m 2 http://$DOMAIN:8080/status >/dev/null"
|
||||||
|
|
||||||
@@ -270,6 +273,7 @@ spec:
|
|||||||
cidr: $HOST1EXPIP/32
|
cidr: $HOST1EXPIP/32
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Allow some time for the policy change to take effect
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
assert_raises "$SSH $HOST1 curl -s -S -f -m 2 http://$VIRTUAL_IP/status >/dev/null"
|
assert_raises "$SSH $HOST1 curl -s -S -f -m 2 http://$VIRTUAL_IP/status >/dev/null"
|
||||||
@@ -289,6 +293,9 @@ spec:
|
|||||||
- {}
|
- {}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Allow some time for the policy change to take effect
|
||||||
|
sleep 2
|
||||||
|
|
||||||
# Virtual IP and NodePort should now work
|
# Virtual IP and NodePort should now work
|
||||||
assert_raises "$SSH $HOST1 curl -s -S -f -m 2 http://$VIRTUAL_IP/status >/dev/null"
|
assert_raises "$SSH $HOST1 curl -s -S -f -m 2 http://$VIRTUAL_IP/status >/dev/null"
|
||||||
assert_raises "$SSH $HOST1 curl -s -S -f -m 2 http://$HOST2:31138/status >/dev/null"
|
assert_raises "$SSH $HOST1 curl -s -S -f -m 2 http://$HOST2:31138/status >/dev/null"
|
||||||
@@ -314,6 +321,9 @@ spec:
|
|||||||
- 8.8.8.4/32
|
- 8.8.8.4/32
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Allow some time for the policy change to take effect
|
||||||
|
sleep 2
|
||||||
|
|
||||||
assert_raises "! $SSH $HOST1 $KUBECTL exec $denyPodName -- curl -s -S -f -m 2 http://$DOMAIN:8080/status >/dev/null"
|
assert_raises "! $SSH $HOST1 $KUBECTL exec $denyPodName -- curl -s -S -f -m 2 http://$DOMAIN:8080/status >/dev/null"
|
||||||
assert_raises "! $SSH $HOST1 $KUBECTL exec $denyPodName -- dig @8.8.8.4 google.com >/dev/null"
|
assert_raises "! $SSH $HOST1 $KUBECTL exec $denyPodName -- dig @8.8.8.4 google.com >/dev/null"
|
||||||
assert_raises "$SSH $HOST1 $KUBECTL exec $denyPodName -- dig @8.8.8.8 google.com >/dev/null"
|
assert_raises "$SSH $HOST1 $KUBECTL exec $denyPodName -- dig @8.8.8.8 google.com >/dev/null"
|
||||||
@@ -346,6 +356,9 @@ spec:
|
|||||||
name: kube-system
|
name: kube-system
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Allow some time for the policy change to take effect
|
||||||
|
sleep 2
|
||||||
|
|
||||||
assert_raises "$SSH $HOST1 $KUBECTL exec $denyPodName -- curl -s -S -f -m 2 http://$DOMAIN:8080/status >/dev/null"
|
assert_raises "$SSH $HOST1 $KUBECTL exec $denyPodName -- curl -s -S -f -m 2 http://$DOMAIN:8080/status >/dev/null"
|
||||||
|
|
||||||
# Passing --no-masq-local and setting externalTrafficPolicy to Local must preserve
|
# Passing --no-masq-local and setting externalTrafficPolicy to Local must preserve
|
||||||
@@ -359,10 +372,12 @@ sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
|
|||||||
-e "s%env:%$WEAVE_ENV_VARS%" \
|
-e "s%env:%$WEAVE_ENV_VARS%" \
|
||||||
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.9.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.9.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
||||||
|
|
||||||
sleep 5
|
sleep 2
|
||||||
|
assert_raises 'wait_for_x check_connections "connections to establish"'
|
||||||
|
|
||||||
run_on $HOST1 "$KUBECTL patch svc netvirt -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'"
|
run_on $HOST1 "$KUBECTL patch svc netvirt -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'"
|
||||||
|
|
||||||
|
sleep 2
|
||||||
CLIENT_IP_NO_MASQ="$($SSH $HOST1 curl -sS http://$HOST2:31138/client_ip)"
|
CLIENT_IP_NO_MASQ="$($SSH $HOST1 curl -sS http://$HOST2:31138/client_ip)"
|
||||||
|
|
||||||
assert_raises "[ $CLIENT_IP_NO_MASQ != $CLIENT_IP_MASQ ]"
|
assert_raises "[ $CLIENT_IP_NO_MASQ != $CLIENT_IP_MASQ ]"
|
||||||
|
|||||||
Reference in new issue
Block a user