From d39a0d07ee6076e99667b18809e4b473a9d8bfc0 Mon Sep 17 00:00:00 2001 From: Moritz Sanft <58110325+msanft@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:16:01 +0100 Subject: [PATCH] packages/test-peerpods: test IMDS functionality This adds a verification of IMDS functionality to the peer-pods smoke test. --- packages/test-peerpods.sh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/packages/test-peerpods.sh b/packages/test-peerpods.sh index c2e3dc15bd..d28f6f8f8c 100644 --- a/packages/test-peerpods.sh +++ b/packages/test-peerpods.sh @@ -39,9 +39,17 @@ if [[ $found != true ]]; then exit 1 fi +run_tests() { + pod="$(kubectl get pod -l app=alpine -o jsonpath='{.items[0].metadata.name}')" + + # Check IMDS functionality. + # -f makes this fail on a 500 status code. + kubectl exec "$pod" -- curl -f -i -H "Metadata: true" http://169.254.169.254/metadata/THIM/amd/certification +} + cleanup() { - kubectl delete deploy nginx - kubectl wait --for=delete pod --selector=app=nginx --timeout=5m + kubectl delete deploy alpine + kubectl wait --for=delete pod --selector=app=alpine --timeout=5m } trap cleanup EXIT @@ -52,26 +60,29 @@ kubectl apply -f - <