azidentity: azure_cli_credential panics in kubernetes pods before aad-pod-identity assigns an identity #17490
Labels
Azure.Identity
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Bug Report
import path of package in question:
azure-sdk-for-go/sdk/azidentity
SDK version: 0.13.2
output of
go version
:go version go1.17.6 linux/amd64
What happened?
We use kubernetes with
aad-pod-identity
to assign managed identities (MI) to our pods, and then our code usesazidentity.NewDefaultAzureCredential(nil)
to create credentials.There's a known issue with
aad-pod-identity
where it takes awhile to assign identities, and applications like mine will initially fail untilaad-pod-identity
catches up. See Azure/aad-pod-identity#181 for more, but I don't think it is relevant here.Before
aad-pod-identity
has assigned the MI, my applications get panics:I see this when using blob storage and service bus APIs, the above is the common stack trace.
An error to be returned that my application could handle.
Call
azidentity.NewDefaultAzureCredential(nil)
in a k8s withaad-pod-identity
beforeaad-pod-identity
has assigned a pod.This is a very low impact bug for me, k8s keeps trying to restart my applications and it self-heals. We monitor our logs for panics and this came up, so figured I'd let y'all know.
Analysis
I think the bug is here:
azure-sdk-for-go/sdk/azidentity/azure_cli_credential.go
Line 130 in df31752
We're not checking the return value from
errors.As
; I think it's returning false, leavingexErr
pointing to nil, and then we deference it to pull the exit code.The text was updated successfully, but these errors were encountered: