Skip to content

Commit

Permalink
[fix] ci: Update expected cilium connectivity test namespace (#2926)
Browse files Browse the repository at this point in the history
* fix: Update expected cilium connectivity test namespace

* ci: leverage --force-deploy to delete old cilium-test resources
  • Loading branch information
jpayne3506 authored Aug 16, 2024
1 parent 742ca41 commit b48007e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ steps:
- script: |
echo "Run Cilium Connectivity Tests"
cilium status
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption,!no-unexpected-packet-drops'
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption,!no-unexpected-packet-drops' --force-deploy
ns=`kubectl get ns | grep cilium-test | awk '{print $1}'`
echo "##vso[task.setvariable variable=ciliumNamespace]$ns"
retryCountOnTaskFailure: 3
name: "ciliumConnectivityTests"
displayName: "Run Cilium Connectivity Tests"
Expand All @@ -130,11 +132,11 @@ steps:
kubectl get pod -owide -A
# Deleting echo-external-node deployment until cilium version matches TODO. https://github.com/cilium/cilium-cli/issues/67 is addressing the change.
# Saves 17 minutes
kubectl delete deploy -n cilium-test echo-external-node
kubectl delete deploy -n $(ciliumNamespace) echo-external-node
cd test/integration/load
CNI_TYPE=cilium_dualstack go test -timeout 30m -tags load -run ^TestValidateState$
echo "delete cilium connectivity test resources and re-validate state"
kubectl delete ns cilium-test
kubectl delete ns $(ciliumNamespace)
kubectl get pod -owide -A
CNI_TYPE=cilium_dualstack go test -timeout 30m -tags load -run ^TestValidateState$
name: "validatePods"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ steps:
- script: |
echo "Run Cilium Connectivity Tests"
cilium status
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption'
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption' --force-deploy
ns=`kubectl get ns | grep cilium-test | awk '{print $1}'`
echo "##vso[task.setvariable variable=ciliumNamespace]$ns"
retryCountOnTaskFailure: 3
name: "ciliumConnectivityTests"
displayName: "Run Cilium Connectivity Tests"
Expand All @@ -137,27 +139,27 @@ steps:
kubectl get pod -owide -A
# Deleting echo-external-node deployment until cilium version matches TODO. https://github.com/cilium/cilium-cli/issues/67 is addressing the change.
# Saves 17 minutes
kubectl delete deploy -n cilium-test echo-external-node
kubectl delete deploy -n $(ciliumNamespace) echo-external-node
if [ "$CILIUM_VERSION_TAG" = "cilium-nightly-pipeline" ]; then
echo "Check cilium identities in cilium-test namepsace during nightly run"
echo "Check cilium identities in $(ciliumNamespace) namepsace during nightly run"
echo "expect the identities to be deleted when the namespace is deleted"
kubectl get ciliumidentity | grep cilium-test
fi
make test-validate-state
echo "delete cilium connectivity test resources and re-validate state"
kubectl delete ns cilium-test
kubectl delete ns $(ciliumNamespace)
kubectl get pod -owide -A
make test-validate-state
name: "validatePods"
displayName: "Validate Pods"
- script: |
if [ "$CILIUM_VERSION_TAG" = "cilium-nightly-pipeline" ]; then
kubectl get pod -owide -n cilium-test
kubectl get pod -owide -n $(ciliumNamespace)
echo "wait for pod and cilium identity deletion in cilium-test namespace"
ns="cilium-test"
while true; do
pods=$(kubectl get pods -n $ns --no-headers=true 2>/dev/null)
pods=$(kubectl get pods -n $(ciliumNamespace) --no-headers=true 2>/dev/null)
if [[ -z "$pods" ]]; then
echo "No pods found"
break
Expand All @@ -168,9 +170,10 @@ steps:
echo "Verify cilium identities are deleted from cilium-test"
checkIdentity="$(kubectl get ciliumidentity -o json | grep cilium-test | jq -e 'length == 0')"
if [[ -n $checkIdentity ]]; then
echo "##[error]Cilium Identities still present in cilium-test namespace"
echo "##[error]Cilium Identities still present in $(ciliumNamespace) namespace"
exit 1
else
printf -- "Identities deleted from cilium-test namespace\n"
printf -- "Identities deleted from $(ciliumNamespace) namespace\n"
fi
else
echo "skip cilium identities check for PR pipeline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@ steps:
cilium status
if [ "$CILIUM_VERSION_TAG" = "cilium-nightly-pipeline" ]
then
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption,!check-log-errors'
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption,!check-log-errors' --force-deploy
else
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption'
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption' --force-deploy
fi
ns=`kubectl get ns | grep cilium-test | awk '{print $1}'`
echo "##vso[task.setvariable variable=ciliumNamespace]$ns"
retryCountOnTaskFailure: 3
name: "ciliumConnectivityTests"
displayName: "Run Cilium Connectivity Tests"
Expand All @@ -164,40 +166,40 @@ steps:
kubectl get pod -owide -A
# Deleting echo-external-node deployment until cilium version matches TODO. https://github.com/cilium/cilium-cli/issues/67 is addressing the change.
# Saves 17 minutes
kubectl delete deploy -n cilium-test echo-external-node
kubectl delete deploy -n $(ciliumNamespace) echo-external-node
if [ "$CILIUM_VERSION_TAG" = "cilium-nightly-pipeline" ]; then
echo "Check cilium identities in cilium-test namepsace during nightly run"
echo "Check cilium identities in $(ciliumNamespace) namepsace during nightly run"
echo "expect the identities to be deleted when the namespace is deleted"
kubectl get ciliumidentity | grep cilium-test
fi
make test-validate-state
echo "delete cilium connectivity test resources and re-validate state"
kubectl delete ns cilium-test
kubectl delete ns $(ciliumNamespace)
kubectl get pod -owide -A
make test-validate-state
name: "validatePods"
displayName: "Validate Pods"
- script: |
if [ "$CILIUM_VERSION_TAG" = "cilium-nightly-pipeline" ]; then
kubectl get pod -owide -n cilium-test
echo "wait for pod and cilium identity deletion in cilium-test namespace"
ns="cilium-test"
kubectl get pod -owide -n $(ciliumNamespace)
echo "wait for pod and cilium identity deletion in $(ciliumNamespace) namespace"
while true; do
pods=$(kubectl get pods -n $ns --no-headers=true 2>/dev/null)
pods=$(kubectl get pods -n $(ciliumNamespace) --no-headers=true 2>/dev/null)
if [[ -z "$pods" ]]; then
echo "No pods found"
break
fi
sleep 2s
done
sleep 20s
echo "Verify cilium identities are deleted from cilium-test"
echo "Verify cilium identities are deleted from $(ciliumNamespace)"
checkIdentity="$(kubectl get ciliumidentity -o json | grep cilium-test | jq -e 'length == 0')"
if [[ -n $checkIdentity ]]; then
echo "##[error]Cilium Identities still present in cilium-test namespace"
echo "##[error]Cilium Identities still present in $(ciliumNamespace) namespace"
exit 1
else
printf -- "Identities deleted from cilium-test namespace\n"
printf -- "Identities deleted from $(ciliumNamespace) namespace\n"
fi
else
echo "skip cilium identities check for PR pipeline"
Expand Down
8 changes: 5 additions & 3 deletions .pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ steps:
- script: |
echo "Run Cilium Connectivity Tests"
cilium status
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption'
cilium connectivity test --connect-timeout 4s --request-timeout 30s --test '!pod-to-pod-encryption,!node-to-node-encryption' --force-deploy
ns=`kubectl get ns | grep cilium-test | awk '{print $1}'`
echo "##vso[task.setvariable variable=ciliumNamespace]$ns"
retryCountOnTaskFailure: 3
name: "ciliumConnectivityTests"
displayName: "Run Cilium Connectivity Tests"
Expand All @@ -122,10 +124,10 @@ steps:
kubectl get pod -owide -A
# Deleting echo-external-node deployment until cilium version matches TODO. https://github.com/cilium/cilium-cli/issues/67 is addressing the change.
# Saves 17 minutes
kubectl delete deploy -n cilium-test echo-external-node
kubectl delete deploy -n $(ciliumNamespace) echo-external-node
make test-validate-state
echo "delete cilium connectivity test resources and re-validate state"
kubectl delete ns cilium-test
kubectl delete ns $(ciliumNamespace)
kubectl get pod -owide -A
make test-validate-state
name: "validatePods"
Expand Down

0 comments on commit b48007e

Please sign in to comment.