-
Notifications
You must be signed in to change notification settings - Fork 435
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
Add new authentication type UserAssignedIdentityCredentials #5421
base: main
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5421 +/- ##
==========================================
+ Coverage 52.55% 52.57% +0.02%
==========================================
Files 272 272
Lines 29423 29465 +42
==========================================
+ Hits 15463 15492 +29
- Misses 13153 13165 +12
- Partials 807 808 +1 ☔ View full report in Codecov by Sentry. |
bd3805c
to
f56022b
Compare
/test all |
f56022b
to
7ccf8c6
Compare
7ccf8c6
to
c87574e
Compare
/test all |
/test pull-cluster-api-provider-azure-e2e-aks |
c87574e
to
3c7c616
Compare
/retest |
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.
Thanks for your work on this! Just a few comments regarding webhook validation and unit testing.
@@ -62,6 +62,14 @@ type AzureClusterIdentitySpec struct { | |||
// CertPath is the path where certificates exist. When set, it takes precedence over ClientSecret for types that use certs like ServicePrincipalCertificate. | |||
// +optional | |||
CertPath string `json:"certPath,omitempty"` | |||
// UserAssignedIdentityCredentialsPath is the path where an existing JSON file exists containing the JSON format of | |||
// a UserAssignedIdentityCredentials struct. | |||
// See the msi-dataplane for more details on UserAssignedIdentityCredentials - https://github.com/Azure/msi-dataplane/blob/63fb37d3a1aaac130120624674df795d2e088083/pkg/dataplane/internal/generated_client.go#L156C6-L156C37 |
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.
nit: Are you able to shorten this link here to main
or another branch rather than the full sha?
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.
This actually worked out because they moved the place where this was defined 😅
if authErr != nil { | ||
return nil, authErr | ||
} | ||
|
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.
Are you able to add some test cases to TestGetTokenCredential
to cover this new flow?
// UserAssignedIdentityCredentialsCloudType is used with UserAssignedIdentityCredentialsPath to specify the Cloud | ||
// type. Can only be one of the following values: public, china, or usgovernment | ||
// If a value is not specified, defaults to AzurePublicCloud | ||
UserAssignedIdentityCredentialsCloudType string `json:"userAssignedIdentityCredentialsCloudType,omitempty"` |
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.
For these new types, can you add some defaulting and validating webhooks to azureclusteridentity_webhook.go
and azureclusteridentity_validation.go
respectively? For example, these should not be set if IdentityType is not UserAssignedIdentityCredential
. Some logic also needs to exist to set the default for UserAssignedIdentityCredentialsCloudType
depending on IdentityType`
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.
Hey @willie-yao I updated azureclusteridentity_validation.go
. I don't understand what is needed for 'azureclusteridentity_webhook.go' as I didn't see any defaulting for other identity types, but I could be missing it.
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.
Comment on line 47 needs to be updated to include the new IdentityType
go.mod
Outdated
@@ -1,8 +1,8 @@ | |||
module sigs.k8s.io/cluster-api-provider-azure | |||
|
|||
go 1.22.7 | |||
go 1.23.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.
Can this go bump be its own PR that we merge before this one?
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.
This comment is OBE based on - #5421 (comment)
Also, it looks like the netlify jobs are failing with |
3c7c616
to
f79a44c
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
During the CAPZ SIG meeting today, we discussed what to do about the Golang bump being brought in when I included the ASO code needed for this new authentication type. The project I'm on isn't using ASO so I don't believe I need this newly added ASO code and this new authentication type is only for 1st party Microsoft applications. I don't believe many other projects will be using this new authentication type soon. Given these reasons, I am planning to:
If the ASO part is indeed needed now, I'll reach back out. |
aeba66e
to
feb5f4b
Compare
This commit adds documentation for UserAssignedIdentityCredentials. Signed-off-by: Bryan Cox <brcox@redhat.com>
d38d830
to
74df21d
Compare
This commit adds a new authentication type, UserAssignedIdentityCredentials. This allows a 1st party Microsoft application to authenticate using a managed identity's certificate, which is accessed through the MSI data plane. More information on this authentication type can be found here - https://github .com/Azure/msi-dataplane/blob/63fb37d3a1aaac130120624674df795d2e088083 /pkg/dataplane/reloadCredentials.go#L60. Signed-off-by: Bryan Cox <brcox@redhat.com>
74df21d
to
4814884
Compare
What type of PR is this?
/kind feature
What this PR does / why we need it:
This pull request adds the capability to authenticate with Azure using a new authentication type available only to 1st party Microsoft applications, UserAssignedIdentityCredentials. More information on this new authentication type can be found here - https://github.com/Azure/msi-dataplane/blob/main/pkg/dataplane/reloadCredentials.go#L60.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):N/A
Special notes for your reviewer:
TODOs:
Release note: