Skip to content

Commit

Permalink
MIWI bug fix - deny assignment (#3977)
Browse files Browse the repository at this point in the history
* Augment unit tests to cover the case we missed

* Fix pointer-related bug
  • Loading branch information
kimorris27 authored Dec 2, 2024
1 parent 47c5fdb commit 51df910
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cluster/deploybaseresources_additional.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (m *manager) denyAssignment() *arm.Resource {
if m.doc.OpenShiftCluster.UsesWorkloadIdentity() {
for _, identity := range m.doc.OpenShiftCluster.Properties.PlatformWorkloadIdentityProfile.PlatformWorkloadIdentities {
excludePrincipals = append(excludePrincipals, mgmtauthorization.Principal{
ID: &identity.ObjectID,
ID: ptr.To(identity.ObjectID),
Type: to.StringPtr(string(mgmtauthorization.ServicePrincipal)),
})
}
Expand Down
9 changes: 9 additions & 0 deletions pkg/cluster/deploybaseresources_additional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ func TestDenyAssignment(t *testing.T) {
ClientID: "11111111-1111-1111-1111-111111111111",
ResourceID: "/subscriptions/22222222-2222-2222-2222-222222222222/resourceGroups/something/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
},
"something other than anything": {
ObjectID: "88888888-8888-8888-8888-888888888888",
ClientID: "99999999-9999-9999-9999-999999999999",
ResourceID: "/subscriptions/22222222-2222-2222-2222-222222222222/resourceGroups/something/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
},
},
},
},
Expand All @@ -77,6 +82,10 @@ func TestDenyAssignment(t *testing.T) {
ID: to.StringPtr("00000000-0000-0000-0000-000000000000"),
Type: to.StringPtr(string(mgmtauthorization.ServicePrincipal)),
},
{
ID: to.StringPtr("88888888-8888-8888-8888-888888888888"),
Type: to.StringPtr(string(mgmtauthorization.ServicePrincipal)),
},
},
},
}
Expand Down

0 comments on commit 51df910

Please sign in to comment.