Skip to content
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

ci: fix cilium validate state check for PRs #1962

Merged
merged 4 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,6 @@ steps:
pathtoPublish: "$(Build.ArtifactStagingDirectory)/test-output"
condition: always()

- script: |
echo "validate pod IP assignment and check systemd-networkd restart"
kubectl apply -f hack/manifests/hostprocess.yaml
kubectl get pod -owide -A
bash hack/scripts/validate_state.sh
name: "validatePods"
displayName: "Validate Pods"

- script: |
echo "Run Service Conformance E2E"
export PATH=${PATH}:/usr/local/bin/gsutil
Expand All @@ -131,6 +123,18 @@ steps:
retryCountOnTaskFailure: 3
name: "ciliumConnectivityTests"
displayName: "Run Cilium Connectivity Tests"

- script: |
echo "validate pod IP assignment and check systemd-networkd restart"
kubectl apply -f hack/manifests/hostprocess.yaml
kubectl get pod -owide -A
bash hack/scripts/validate_state.sh
echo "delete cilium connectivity test resources and re-validate state"
kubectl delete ns cilium-test
kubectl get pod -owide -A
bash hack/scripts/validate_state.sh
name: "validatePods"
displayName: "Validate Pods"

- script: |
ARTIFACT_DIR=$(Build.ArtifactStagingDirectory)/test-output/
Expand Down
20 changes: 12 additions & 8 deletions .pipelines/singletenancy/overlay/overlay-e2e-step-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@ steps:
pathtoPublish: "$(Build.ArtifactStagingDirectory)/test-output"
condition: always()

- script: |
echo "validate pod IP assignment and check systemd-networkd restart"
kubectl apply -f hack/manifests/hostprocess.yaml
kubectl get pod -owide -A
bash hack/scripts/validate_state.sh
name: "validatePods"
displayName: "Validate Pods"

- script: |
echo "Run Service Conformance E2E"
export PATH=${PATH}:/usr/local/bin/gsutil
Expand All @@ -136,6 +128,18 @@ steps:
cilium connectivity test
name: "ciliumConnectivityTests"
displayName: "Run Cilium Connectivity Tests"

- script: |
echo "validate pod IP assignment and check systemd-networkd restart"
kubectl apply -f hack/manifests/hostprocess.yaml
kubectl get pod -owide -A
bash hack/scripts/validate_state.sh
echo "delete cilium connectivity test resources and re-validate state"
kubectl delete ns cilium-test
kubectl get pod -owide -A
bash hack/scripts/validate_state.sh
name: "validatePods"
displayName: "Validate Pods"

- script: |
ARTIFACT_DIR=$(Build.ArtifactStagingDirectory)/test-output/
Expand Down
4 changes: 3 additions & 1 deletion hack/scripts/validate_state.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ do
node_name="${node##*/}"
node_ip=$(kubectl get "$node" -o jsonpath='{$.status.addresses[?(@.type=="InternalIP")].address}')
echo "Node internal ip: $node_ip"
# Check pod count after restarting nodes, statefile does not exist after restart
echo "checking whether the node has any pods deployed to it or not"
pod_count=$(kubectl get pods -o wide | grep "$node_name" -c)
pod_count=$(kubectl get pods -A -o wide | grep "$node_name" -c)
if [[ $pod_count -eq 0 ]]; then
echo "Skipping validation for this node. No pods were deployed after the restart, so no statefile exists"
continue
fi
privileged_pod=$(kubectl get pods -n kube-system -l app=privileged-daemonset -o wide | grep "$node_name" | awk '{print $1}')
Expand Down