-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 API service agents in BootstrapPSARole()
utils
#12784
Closed
wyardley
wants to merge
1
commit into
GoogleCloudPlatform:main
from
wyardley:wyardley/bootstraputils
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In accordance with Stephen's suggestion. Wdyt about the following pattern? I can understand how it may get difficult to understand weird implicit logic. This change might make things more explicit overall at the consumer level without needing to know about special behavior for certain characters.
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.
High level, this seems to be a much better design, albeit one I may not want to get too deep into implementing as an afternoon project 😅
Couple questions:
BootstrapAllPSARoles()
for now, just providing a cleaner interface, but with the idea of doing more structural fixes later?${prefix}-${projectNumber}@foo.iam.gserviceaccount.com
(is this PSA?), where "prefix" is usuallyservice-
and then[project_number]@foo.gserviceaccount.com
(Google Service Agent?). So I guess in this example, you'd have prefix as nil or empty string to do the latter, and set it toservice-
for the former?In fact, even in my current use case, could possibly hard-code the project number bit into the function, which would simplify my use case further.
serviceAccount:
prefix too? Not sure if that's too much YAGNI?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.
{prefix}-${projectNumber}@foo.iam.gserviceaccount.com
. We might want to omit project number altogether from the ServiceAccountConfig object. With the existing calling into our function. I believe you are correct on PSA (Project Service Account) being this specific pattern.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.
Ok, let me see if I can come up with something that uses that pattern, and if it's possible to do this while keeping
BootstrapAllPSARoles()
more or less as it is. It might delay #12728, which I've now rolled a fix for another breaking test into, so up to you if you want to ship that first or wait for this.Ideally, there would be some tests as well, for the logic of constructing email addresses, at least, and maybe for some of the role related stuff... but that may also have to wait for some bigger project, especially since adding them with the way the functions are structured now might involve either adding some new functions, or figuring out how to stub some of the network calls.