@@ -47,12 +47,33 @@ spec:
4747 echo "Nodebalancer config found, updating config stickiness"
4848
4949 kubectl annotate --overwrite svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-default-stickiness=source_ip
50- sleep 5s
51-
52- echo "Verifying that stickiness is set to source_ip"
53- nbconfig=$(LINODE_TOKEN=$LINODE_TOKEN NBID=$nbid ../scripts/get-nb-config.sh)
54- stickiness=$(echo $nbconfig | jq -r '.stickiness')
55- echo "stickiness is $stickiness"
50+
51+ echo "Waiting for stickiness to be updated to source_ip..."
52+ max_attempts=12
53+ for i in $(seq 1 $max_attempts); do
54+ echo "Attempt $i/$max_attempts: Checking stickiness..."
55+ nbconfig=$(LINODE_TOKEN=$LINODE_TOKEN NBID=$nbid ../scripts/get-nb-config.sh)
56+ stickiness=$(echo $nbconfig | jq -r '.stickiness')
57+ echo "Current stickiness: $stickiness"
58+
59+ if [[ "$stickiness" == "source_ip" ]]; then
60+ echo "Stickiness successfully updated to source_ip"
61+ break
62+ fi
63+
64+ if [[ $i -eq $max_attempts ]]; then
65+ echo "Timeout: Stickiness was not updated to source_ip after $max_attempts attempts"
66+ exit 1
67+ fi
68+
69+ echo "Waiting 10 seconds before next check..."
70+ sleep 10
71+ done
5672 check :
5773 ($error == null) : true
58- (contains($stdout, 'stickiness is source_ip')) : true
74+ (contains($stdout, 'Stickiness successfully updated to source_ip')) : true
75+ catch :
76+ - script :
77+ content : |
78+ echo "Test failed. Fetching CCM logs..."
79+ kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-udp-ports-stickiness"
0 commit comments