-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Azure resource ID as userAssignedIdentityID
#1290
Support Azure resource ID as userAssignedIdentityID
#1290
Conversation
Welcome @ArchangelSDY! |
Hi @ArchangelSDY. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
userAssignedIdentityID
userAssignedIdentityID
pkg/auth/azure_auth.go
Outdated
return adal.NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint, | ||
resource, | ||
config.UserAssignedIdentityID) | ||
if config.UserAssignedIdentityID[0] == '/' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about changing the validation to something like below:
var isResourceID = regexp.MustCompile(
`(?i)/subscriptions/(.+?)/resourcegroups/(.+?)/providers/Microsoft..*`).MatchString
if if isResourceID(config.UserAssignedIdentityID) {...}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Updated to use a standard function azure.ParseResourceID()
pkg/auth/azure_auth.go
Outdated
resource, | ||
config.UserAssignedIdentityID) | ||
} else { | ||
klog.V(4).Info("azure: User Assigned MSI ID is client ID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be error here instead of info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resource ID paring error doesn't necessarily mean a config error because it could be a client id (GUID). I will include the error message in the info log for better diagnostics.
Is it possible to enrich unit test for this change? |
/ok-to-test |
Added some unit tests. |
Don't forget to squash the commits. |
dbf9cb8
to
945b6f1
Compare
This makes it a bit more convenient.
Squashed. |
/retest |
1 similar comment
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ArchangelSDY, nilo19 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
are we planning on cherry-picking this PR? |
@lzhecheng could you help to cherry-pick this PR? |
/cherrypick release-1.23 |
/cherrypick release-1.1 |
/cherrypick release-1.0 |
@lzhecheng: new pull request created: #1616 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@lzhecheng: new pull request created: #1617 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@lzhecheng: new pull request created: #1618 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
config.UserAssignedIdentityID) | ||
} | ||
|
||
klog.V(4).Info("azure: User Assigned MSI ID is client ID. Resource ID parsing error: %+v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ArchangelSDY , I got this error now, from current code logic, looks like it's just an info log, I think we need to refine the logging, otherwise there will be following error as long as User Assigned MSI ID is client ID
[pod/csi-blob-node-8trh8/blob] I0812 03:15:51.934107 1 azure_auth.go:245] Using AzurePublicCloud environment
[pod/csi-blob-node-8trh8/blob] I0812 03:15:51.934127 1 azure_auth.go:96] azure: using managed identity extension to retrieve access token
[pod/csi-blob-node-8trh8/blob] I0812 03:15:51.934131 1 azure_auth.go:102] azure: using User Assigned MSI ID to retrieve access token
[pod/csi-blob-node-8trh8/blob] I0812 03:15:51.934162 1 azure_auth.go:113] azure: User Assigned MSI ID is client ID. Resource ID parsing error: %+vparsing failed for 82e9bd91-c283-4b2d-8708-6d11b07d630d. Invalid resource Id format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anyway, let me refine the logging to fix this error msg
What type of PR is this?
/kind feature
What this PR does / why we need it:
Support Azure resource ID as
userAssignedIdentityID
. This makes it a bit more convenient as resource ID is more user-friendly.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: