diff --git a/CHANGELOG.md b/CHANGELOG.md index d86305d..eccbff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## 2026-06-XX - Tiny Cloud v3.3.3 +## 2026-06-15 - Tiny Cloud v3.3.3 * Support IPv6 and multiple endpoints [#68](https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud/-/work_items/68) @@ -9,6 +9,10 @@ routable. Fixes race condition between `dhcpcd` starting and attempting to reach IMDS before routes are resolved. +* Currently the most recent IMDS endpoint that worked is cached, but only if + **root** is running `imds`. We may consider keeping track of this per user + in the future + ## 2026-06-08 - Tiny Cloud v3.3.2 * Fixes an autodetect regression introduced in v3.3.1 diff --git a/bin/imds b/bin/imds index 177c21a..cae8877 100755 --- a/bin/imds +++ b/bin/imds @@ -120,7 +120,7 @@ _imds_has_route() { } _imds() { - local endpoint endpoints routed attempts=1 + local endpoint endpoints routed attempts=1 cached if [ "$IMDS_ENDPOINT_WAIT_ATTEMPTS" -le 0 ]; then endpoints="$(_imds_endpoints)" fi @@ -148,7 +148,8 @@ _imds() { wget --quiet --timeout 1 --output-document - \ --header "$(_imds_header)" \ "http://$endpoint/$IMDS_URI/$1$IMDS_QUERY" && { - echo "$endpoint" > "$IMDS_ENDPOINT_CACHE" + cached="$(cat "$IMDS_ENDPOINT_CACHE" 2>/dev/null)" || : + [ "$endpoint" = "$cached" ] || echo "$endpoint" 2>/dev/null > "$IMDS_ENDPOINT_CACHE" || : return 0 } done