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

Lay groundwork for cluster MSI usage #3757

Merged
merged 28 commits into from
Sep 24, 2024

Conversation

kimorris27
Copy link
Contributor

Which issue this PR addresses:

https://issues.redhat.com/browse/ARO-4360

What this PR does / why we need it:

This PR lays the groundwork for later usage of cluster MSI by:

  • Instantiating an MSI dataplane client
  • Creating and persisting an MSI certificate during bootstrapping and deleting the certificate during cluster deletion
  • Setting up a feature flag that the RP uses to know whether to use the mock MSI dataplane (since INT doesn't have a prod MSI RP, checking IsLocalDevelopmentMode() is not sufficient)

Test plan for issue:

  • Added unit tests for new functions
  • Added in some code (removed before opening PR) to create federated credentials on the platform workload identities, which validated that the MSI dataplane stub is working, the certificates are being handled correctly, etc.

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

I don't think so, but let me know if I missed anything.

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

MIWI will be tested extensively before the feature is released.

@kimorris27 kimorris27 added the chainsaw Pull requests or issues owned by Team Chainsaw label Aug 5, 2024
@kimorris27 kimorris27 self-assigned this Aug 5, 2024
@kimorris27 kimorris27 force-pushed the kimorris27/ARO-4360-cluster-msi-changes branch 2 times, most recently from c95aad2 to 81de97a Compare August 6, 2024 19:54
@kimorris27
Copy link
Contributor Author

/azp run ci, e2e

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Collaborator

@cadenmarchese cadenmarchese left a comment

Choose a reason for hiding this comment

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

quick first pass, looking good! Just a few small questions.

pkg/cluster/cluster.go Outdated Show resolved Hide resolved
pkg/cluster/clustermsi.go Outdated Show resolved Hide resolved
@kimorris27 kimorris27 added the hold Hold label Aug 7, 2024
@kimorris27
Copy link
Contributor Author

Stuck a hold label on this because I remembered that I had to comment out the validateResources step during cluster bootstrapping to test the cluster MSI stuff since dynamic validation for MSI clusters hasn't merged yet.

@kimorris27 kimorris27 force-pushed the kimorris27/ARO-4360-cluster-msi-changes branch from 071f769 to 179d711 Compare September 20, 2024 21:26
@github-actions github-actions bot removed the needs-rebase branch needs a rebase label Sep 20, 2024
@kimorris27
Copy link
Contributor Author

/azp run ci, e2e

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@kimorris27
Copy link
Contributor Author

/azp run e2e

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tsatam tsatam dismissed SudoBrendan’s stale review September 23, 2024 18:13

feedback has been addressed

Comment on lines +119 to +125
// Note that we are assuming that all of the platform MIs are in the same subscription.
pwiResourceId, err := arm.ParseResourceID(m.doc.OpenShiftCluster.Properties.PlatformWorkloadIdentityProfile.PlatformWorkloadIdentities[0].ResourceID)
if err != nil {
return err
}

subId := pwiResourceId.SubscriptionID
Copy link
Collaborator

@tsatam tsatam Sep 23, 2024

Choose a reason for hiding this comment

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

Not a blocking change, but I'm curious why we're getting the subscriptionID off of the first platform workload identity, if we're assuming that all identities are in the same subscription as the cluster.

Would we not be able to just access the subscriptionID directly off of the clusterdoc (e.g. m.subscriptionDoc.ID), as I had done for in-cluster secrets generation here:

subscriptionId := m.subscriptionDoc.ID
? (or do I need to update the linked implementation to get the subscriptionID off of the PWI's resourceID to match what you've done here?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I didn't think about it that much, since we're assuming we'll get the same ID from either place. Since I'll be opening a follow-up PR anyway, how about I switch to using the subscription doc there?

t.Run(tt.name, func(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()

Copy link
Collaborator

@tsatam tsatam Sep 23, 2024

Choose a reason for hiding this comment

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

Is this mock controller unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, it is. Added to my todo list for the follow-up PR.

@cadenmarchese cadenmarchese merged commit e3cec21 into master Sep 24, 2024
24 checks passed
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 ready-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants