Skip to content

Commit 9330999

Browse files
authored
ci: validate async delete (#2379)
* test async delete in pipeline * test in swift stage only * check cns patch is removed * fix syntax in patch check
1 parent d221d3b commit 9330999

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

.pipelines/singletenancy/aks-swift/e2e-step-template.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ steps:
110110
retryCountOnTaskFailure: 3
111111
name: "WireserverMetadataConnectivityTests"
112112
displayName: "Run Wireserver and Metadata Connectivity Tests"
113+
114+
- ${{ if eq( parameters['testDropgz'], true) }}:
115+
- script: |
116+
cd hack/scripts
117+
chmod +x async-delete-test.sh
118+
./async-delete-test.sh
119+
if ! [ -z $(kubectl -n kube-system get ds azure-cns | grep non-existing) ]; then
120+
kubectl -n kube-system patch daemonset azure-cns --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'
121+
fi
122+
name: "testAsyncDelete"
123+
displayName: "Verify Async Delete when CNS is down"
113124
114125
- script: |
115126
ARTIFACT_DIR=$(Build.ArtifactStagingDirectory)/aks-swift-output/

hack/scripts/async-delete-test.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
echo "create busybox deployment and verify async delete"
2+
kubectl apply -f ../manifests/busybox.yaml
3+
kubectl rollout status deployment busybox
4+
5+
echo "temporarily disable CNS daemonset and attempt busybox pod delete"
6+
kubectl -n kube-system patch daemonset azure-cns -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'
7+
8+
echo "delete busybox pod"
9+
for node in $(kubectl get nodes -o name);
10+
do
11+
node_name="${node##*/}"
12+
busybox_pod=$(kubectl get pods -l k8s-app=busybox -o wide | grep "$node_name" | awk '{print $1}')
13+
if [ -z $busybox_pod ]; then
14+
continue
15+
else
16+
echo "wait 1 min for delete to processes and error to catch. expect a file to be written to var/run/azure-vnet/deleteIDs"
17+
kubectl delete pod $busybox_pod
18+
sleep 60s
19+
20+
echo "restore azure-cns pods"
21+
kubectl -n kube-system patch daemonset azure-cns --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'
22+
echo "wait 5s for cns to start back up"
23+
sleep 5s
24+
25+
echo "check directory for pending delete"
26+
cns_pod=$(kubectl get pods -l k8s-app=azure-cns -n kube-system -o wide | grep "$node_name" | awk '{print $1}')
27+
file=$(kubectl exec -it $cns_pod -n kube-system -- ls var/run/azure-vnet/deleteIDs)
28+
if [ -z $file ]; then
29+
while [ -z $file ];
30+
do
31+
file=$(kubectl exec -i $cns_pod -n kube-system -- ls var/run/azure-vnet/deleteIDs)
32+
done
33+
fi
34+
echo "pending deletes"
35+
echo $file
36+
37+
echo "wait 30s for filesystem delete to occur"
38+
sleep 30s
39+
echo "check directory is now empty"
40+
check_directory=$(kubectl exec -i $cns_pod -n kube-system -- ls var/run/azure-vnet/deleteIDs)
41+
if [ -z $check_directory ]; then
42+
echo "async delete success"
43+
break
44+
else
45+
echo "##[error]async delete failure. file still exists in deleteIDs directory."
46+
fi
47+
fi
48+
done
49+

test/integration/manifests/cnsconfig/overlayconfigmap.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ data:
2727
"ProgramSNATIPTables" : false,
2828
"EnableCNIConflistGeneration": true,
2929
"CNIConflistFilepath": "/etc/cni/net.d/05-cilium.conflist",
30-
"CNIConflistScenario": "cilium"
30+
"CNIConflistScenario": "cilium",
31+
"EnableAsyncPodDelete": true,
32+
"AsyncPodDeletePath": "/var/run/azure-vnet/deleteIDs"
3133
}

0 commit comments

Comments
 (0)