You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
azure: download assets from the OCI registry on nodes
The bootstrap script and nodeup's asset store fetch OCI blobs by digest,
authenticating with the instance's managed identity. Pod and sandbox
images are pulled through the acr-credential-provider kubelet plugin.
return"", fmt.Errorf("OCI asset registry is not supported on cloud provider %q", b.CloudProvider)
266
+
}
267
+
268
+
// Azure Container Registry: exchange a managed-identity token from the instance
269
+
// metadata service for a registry refresh token, then for a pull-scoped access token.
270
+
return`
271
+
# Download an OCI blob by digest. args: file, hash, url (oci://<registry>/<repository>)
272
+
download-oci() {
273
+
local -r file="$1"
274
+
local -r hash="$2"
275
+
local -r url="$3"
276
+
277
+
local -r stripped="${url#oci://}"
278
+
local -r registry="${stripped%%/*}"
279
+
local -r repository="${stripped#*/}"
280
+
local aad_token refresh_token registry_token
281
+
282
+
if ! aad_token=$(curl -fsS -H "Metadata: true" "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fmanagement.azure.com%2F" | sed -e 's/.*"access_token":"//' -e 's/".*//'); then
283
+
echo "== Failed to get an identity token from the instance metadata service =="
284
+
return 1
285
+
fi
286
+
if ! refresh_token=$(curl -fsS "https://${registry}/oauth2/exchange" --data-urlencode "grant_type=access_token" --data-urlencode "service=${registry}" --data-urlencode "access_token=${aad_token}" | sed -e 's/.*"refresh_token":"//' -e 's/".*//'); then
287
+
echo "== Failed to exchange the identity token for a registry refresh token =="
288
+
return 1
289
+
fi
290
+
if ! registry_token=$(curl -fsS "https://${registry}/oauth2/token" --data-urlencode "grant_type=refresh_token" --data-urlencode "service=${registry}" --data-urlencode "scope=repository:${repository}:pull" --data-urlencode "refresh_token=${refresh_token}" | sed -e 's/.*"access_token":"//' -e 's/".*//'); then
291
+
echo "== Failed to get a registry access token =="
u, err:=url.Parse(fmt.Sprintf("https://github.com/kubernetes-sigs/cloud-provider-azure/releases/download/%s/azure-acr-credential-provider-linux-%s", acrCredentialProviderVersion, arch))
0 commit comments