From 4154dc85e58cace23f3b7b690f1b6589de9b0e87 Mon Sep 17 00:00:00 2001 From: Jayanth Varavani <1111446+jayanthvn@users.noreply.github.com> Date: Wed, 10 Nov 2021 14:04:22 -0800 Subject: [PATCH] imdsv2 changes (#1743) --- scripts/entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 6eacd367ea..edaf78642a 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -118,6 +118,7 @@ wait_for_ipam() { fi # We sleep for 1 second between each retry sleep 1 + log_in_json info "Retrying waiting for IPAM-D" done } @@ -125,12 +126,14 @@ wait_for_ipam() { get_node_primary_v4_address() { while : do - NODE_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) + token=$(curl -Ss -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60") + NODE_IP=$(curl -H "X-aws-ec2-metadata-token: $token" -Ss http://169.254.169.254/latest/meta-data/local-ipv4) if [[ "${NODE_IP}" != "" ]]; then return 0 fi # We sleep for 1 second between each retry sleep 1 + log_in_json info "Retrying fetching node-IP" done }