Skip to content

Commit 4275faf

Browse files
authored
Emit metrics on failed credential fetching and allow 0.1% pod restart (#537)
1 parent 41757c8 commit 4275faf

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/assets/eks-pod-identity/pod-default.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ spec:
4343
start_epoch=$(date +%s%3N)
4444
# fetch credentials
4545
status_code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 2 -H "Authorization: $AUTH_TOKEN" http://169.254.170.23/v1/credentials)
46+
end_epoch=$(date +%s%3N)
4647
if [ "$status_code" -eq 200 ]; then
47-
end_epoch=$(date +%s%3N)
4848
printf "Endpoint is reachable at try %d\n" "$i"
4949
5050
latency_ms=$((end_epoch - start_epoch))

tests/tekton-resources/tasks/generators/clusterloader/load-pod-identity.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,13 @@ spec:
290290
int_p999=$(echo "$p999" | awk '{printf "%d", $1}')
291291
echo "p99.9 is $p999"
292292
293-
if [ "$int_p999" -lt 1 ] && [ "$total_samples" -eq "$expected_pods" ]; then
293+
# Calculate 0.1% tolerance (expected_pods * 0.001)
294+
tolerance=$(echo "$expected_pods" | awk '{printf "%.0f", $1 * 0.001}')
295+
max_allowed=$((expected_pods + tolerance))
296+
297+
echo "Tolerance: $tolerance, max allowed samples: $max_allowed"
298+
299+
if [ "$int_p999" -lt 1 ] && [ "$total_samples" -ge "$expected_pods" ] && [ "$total_samples" -le "$max_allowed" ]; then
294300
echo "1" | tee $(results.datapoint.path)
295301
else
296302
echo "0" | tee $(results.datapoint.path)

0 commit comments

Comments
 (0)