This commit is contained in:
umagnus 2024-05-23 08:22:31 +00:00
Родитель f6ac19cca8
Коммит 5f100f8800
2 изменённых файлов: 8 добавлений и 26 удалений

Просмотреть файл

@ -1,11 +1,13 @@
# use sh pod_failover_test_aws.sh 100 file.txt to test 1 pod 3 pvc pod failover test on aws for 100 times and write results in file.txt.
kubectl create ns ebs-pod-failover-1pod3pvc
deletion_due_time=$(date -u -d "+3 hour" +'%Y-%m-%dT%H:%M:%SZ')
cat <<EOF | kubectl apply -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ebs-pod-failover-1pod3pvc-sc
parameters:
tagSpecification_1: "deletion_due_time=${deletion_due_time}"
csi.storage.k8s.io/fstype: xfs
type: gp2
provisioner: ebs.csi.aws.com
@ -135,26 +137,16 @@ status:
updateRevision: pod-failover-statefulset-8565df4b89
updatedReplicas: 1
EOF
readynum=$(kubectl get pod -n ebs-pod-failover-1pod3pvc --field-selector=status.phase==Running | awk 'END{print NR}')
while [ $readynum -le 1 ]
do
sleep 1
readynum=$(kubectl get pod -n ebs-pod-failover-1pod3pvc --field-selector=status.phase==Running | awk 'END{print NR}')
done
kubectl wait --for=condition=Ready pod/pod-failover-statefulset-0 -n ebs-pod-failover-1pod3pvc --timeout=600s
for i in $(seq $1)
do
nodename=$(kubectl get po pod-failover-statefulset-0 -n ebs-pod-failover-1pod3pvc -o custom-columns=NODE:.spec.nodeName --no-headers)
kubectl cordon $nodename
kubectl delete pod pod-failover-statefulset-0 -n ebs-pod-failover-1pod3pvc
predate=$(date +"%Y-%m-%d %H:%M:%S")
readynum=$(kubectl get pod -n ebs-pod-failover-1pod3pvc --field-selector=status.phase==Running | awk 'END{print NR}')
while [ $readynum -le 1 ]
do
sleep 1
kubectl wait --for=condition=Ready pod/pod-failover-statefulset-0 -n ebs-pod-failover-1pod3pvc --timeout=600s
date=$(date +"%Y-%m-%d %H:%M:%S")
readynum=$(kubectl get pod -n ebs-pod-failover-1pod3pvc --field-selector=status.phase==Running | awk 'END{print NR}')
done
echo "`date` test $i: $(( $(date -d "$date" "+%s") - $(date -d "$predate" "+%s") ))" >> $2
echo "`echo $(date -u +"%Y-%m-%dT%H:%M:%SZ")` test $i: $(( $(date -d "$date" "+%s") - $(date -d "$predate" "+%s") ))" >> $2
kubectl uncordon $nodename
done
kubectl delete ns ebs-pod-failover-1pod3pvc

Просмотреть файл

@ -136,26 +136,16 @@ status:
updateRevision: pod-failover-statefulset-8565df4b89
updatedReplicas: 1
EOF
readynum=$(kubectl get pod -n azdisk-pod-failover-1pod3pvc --field-selector=status.phase==Running | awk 'END{print NR}')
while [ $readynum -le 1 ]
do
sleep 1
readynum=$(kubectl get pod -n azdisk-pod-failover-1pod3pvc --field-selector=status.phase==Running | awk 'END{print NR}')
done
kubectl wait --for=condition=Ready pod/pod-failover-statefulset-0 -n azdisk-pod-failover-1pod3pvc --timeout=600s
for i in $(seq $1)
do
nodename=$(kubectl get po pod-failover-statefulset-0 -n azdisk-pod-failover-1pod3pvc -o custom-columns=NODE:.spec.nodeName --no-headers)
kubectl cordon $nodename
kubectl delete pod pod-failover-statefulset-0 -n azdisk-pod-failover-1pod3pvc
predate=$(date +"%Y-%m-%d %H:%M:%S")
readynum=$(kubectl get pod -n azdisk-pod-failover-1pod3pvc --field-selector=status.phase==Running | awk 'END{print NR}')
while [ $readynum -le 1 ]
do
sleep 1
kubectl wait --for=condition=Ready pod/pod-failover-statefulset-0 -n azdisk-pod-failover-1pod3pvc --timeout=600s
date=$(date +"%Y-%m-%d %H:%M:%S")
readynum=$(kubectl get pod -n azdisk-pod-failover-1pod3pvc --field-selector=status.phase==Running | awk 'END{print NR}')
done
echo "`date` test $i: $(( $(date -d "$date" "+%s") - $(date -d "$predate" "+%s") ))" >> $2
echo "`echo $(date -u +"%Y-%m-%dT%H:%M:%SZ")` test $i: $(( $(date -d "$date" "+%s") - $(date -d "$predate" "+%s") ))" >> $2
kubectl uncordon $nodename
done
kubectl delete ns azdisk-pod-failover-1pod3pvc