Skip to content
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

Generate Federated Identity Credentials for MIWI Cluster #3847

Merged
merged 4 commits into from
Oct 16, 2024

Conversation

gouthamMN
Copy link
Contributor

@gouthamMN gouthamMN commented Sep 17, 2024

Which issue this PR addresses:

Fixes: https://issues.redhat.com/browse/ARO-4375

What this PR does / why we need it:

This PR perform the followings:

  1. Add/Create Role Assignments on each customer provided Platform Workload Identities over Managed Resource Group and Vnet Resource Group as mentioned in MIWI Test Matrix doc by reading the respective role definitions from PlatformWorkloadIdentityRoleSetProperties.PlatformWorkloadIdentityRole.RoleDefinitionID.
  2. Create FederatedIdentityCredentials for each customer provided Platform Workload Identities during cluster install/create for each Service accounts in PlatformWorkloadIdentityRoleSetProperties.PlatformWorkloadIdentityRole.ServiceAccounts.
  3. Delete/Cleanup FederatedIdentityCredentials for each customer provided Platform Workload Identities that were created during cluster delete.

Test plan for issue:

  • New Unit tests are added.
  • e2e

Is there any documentation that needs to be updated for this PR?

No

How do you know this will function as expected in production?

  • If the e2e pass without errors

Copy link

Please rebase pull request.

@github-actions github-actions bot added the needs-rebase branch needs a rebase label Sep 17, 2024
pkg/cluster/delete.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@rajdeepc2792 rajdeepc2792 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!!
Performed a quick review of the PR, added some comments for the federated credentials creation/deletion and RBAC part.
The review would be easier to do after the MSI PR is merged.

@github-actions github-actions bot added needs-rebase branch needs a rebase and removed ready-for-review labels Oct 10, 2024
Copy link

Please rebase pull request.

@kimorris27 kimorris27 force-pushed the gniranjan/generateFedCred branch from 821562f to 89ef266 Compare October 10, 2024 22:25
@github-actions github-actions bot removed the needs-rebase branch needs a rebase label Oct 10, 2024
Copy link
Contributor

@kimorris27 kimorris27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a few small changes after trying this out locally, since @gouthamMN 's still blocked from running a local dev RP. The main change I pushed was moving fed cred deletion to be before cluster MSI cert deletion because we need to use the MSI to delete the fed creds.

I think we need to revisit the discussion about whether to error out on fed cred deletion failures though. I went back and looked at @cadenmarchese 's comment here, and I think you all may have misunderstood what I said earlier in the conversation.

I wasn't suggesting we log the error and continue for any error that occurs during the process of trying to delete the federated credentials; I was only suggesting we do that in the case where we can't initialize the federated credentials client because the cx deleted their MSI. In other cases where the error is the service's fault (ex: the MI RP returns an internal server error while we're trying to delete a fed cred), I think we should still error out.

I left my thoughts here rather than directly making the changes so that others can confirm that that's the route we want to go. Once we have a consensus, I'm happy to make the changes and test out locally if needed.

pkg/cluster/delete.go Outdated Show resolved Hide resolved
pkg/cluster/delete.go Outdated Show resolved Hide resolved
pkg/cluster/delete.go Outdated Show resolved Hide resolved
pkg/cluster/deploybaseresources_additional.go Show resolved Hide resolved
test/util/azure/msi/armmsi.go Outdated Show resolved Hide resolved
pkg/cluster/delete.go Show resolved Hide resolved
tsatam
tsatam previously requested changes Oct 11, 2024
Copy link
Collaborator

@tsatam tsatam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should be rebased on latest master, as the merge of this PR will introduce some duplicated resources into pkg/cluster/deploybaseresources.go that will need to be manually removed.

gniranjan added 2 commits October 14, 2024 13:00
bring in more changes from master

typos

add len check for federated Identity naming

don't return cluster ID when OIDC issuer is nil

skip RBAC on CSP for WI cluster

check for invalid object ID before RBAC template creation

single qoute when passing resource Name

check for nil clusterMsiFederatedIdentityCredentials

remove unused controller

ensure the case folding of cluster MSI resourceID

Fed Cred name logic

update calls to fetch fed cred name

No RBAC for Cluster MSI

update getPlatformWorkloadIdentityFederatedCredName

fix WI RG RBAC

define constants to imporve readability

correct the call to resourceGroupRoleAssignmentWithDetails

Move fed cred deletion to be before cluster MSI cert deletion and add a log statement for fed cred deletion

Rename function for clarity and to match name of unit test function

Nitpick test case names for clarity and test data for correctness
@gouthamMN gouthamMN force-pushed the gniranjan/generateFedCred branch from 7396b81 to 820270c Compare October 14, 2024 18:00
@gouthamMN
Copy link
Contributor Author

This PR should be rebased on latest master, as the merge of this PR will introduce some duplicated resources into pkg/cluster/deploybaseresources.go that will need to be manually removed.

rebased

tsatam added a commit that referenced this pull request Oct 14, 2024
@tsatam tsatam dismissed their stale review October 14, 2024 19:29

addressed

@gouthamMN
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Contributor

@kimorris27 kimorris27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last quick question before we merge with the understanding that some of the other outstanding feedback can be addressed in a follow-up PR.

pkg/cluster/delete.go Outdated Show resolved Hide resolved
@kimorris27
Copy link
Contributor

/azp run ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@gouthamMN
Copy link
Contributor Author

One last quick question before we merge with the understanding that some of the other outstanding feedback can be addressed in a follow-up PR.

Yup, I think once we come to a conclusion about how the Fed Cred Deletion we should work that under a new JIRA item.

Copy link
Contributor

@kimorris27 kimorris27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the understanding that we can finalize the mock client issue and the fed cred deletion issue in a follow-up conversation/PR.

@gouthamMN
Copy link
Contributor Author

/azp run ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tsatam tsatam merged commit 98e5056 into master Oct 16, 2024
19 checks passed
@gouthamMN gouthamMN deleted the gniranjan/generateFedCred branch February 6, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chainsaw Pull requests or issues owned by Team Chainsaw go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants