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

[BEAM-14014] Add parameter for service account impersonation in GCP credentials #17394

Merged
merged 1 commit into from
May 6, 2022

Conversation

kennknowles
Copy link
Member

Adding this parameter, which is standardizing across GCP. It is a chain of accounts where the user invoking the API call has delegation permissions and each account has permissions to the next, until we reach the target principal.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@kennknowles
Copy link
Member Author

R: @ryanthompson591

I'm figuring I can piggyback an integration test for this on whatever you come up with for you PR #17244.

@aaltay
Copy link
Member

aaltay commented Apr 28, 2022

What is the next step on this PR?

@kennknowles kennknowles force-pushed the impersonation branch 2 times, most recently from 6c55376 to f4a7eee Compare May 5, 2022 20:08
@kennknowles kennknowles force-pushed the impersonation branch 3 times, most recently from aa0bd58 to 2bcd6ac Compare May 5, 2022 20:43
@kennknowles
Copy link
Member Author

Added a test, but unfortunately Jenkins testing runs as the same service account as the Dataflow workers (both are the default GCE service account) so I cannot remove permissions from the account and ensure the test is meaningful. I have run the test as myself locally to confirm, but more work is needed to make sure CI can truly keep this feature healthy.

@kennknowles
Copy link
Member Author

Noting that everything is green, aka I didn't break anything. And if you believe my comments and code, this works. So now I am going to continue with changes within the Google Cloud Console and a new commit that might break things again.

@kennknowles kennknowles force-pushed the impersonation branch 2 times, most recently from cdf51aa to 16ec315 Compare May 5, 2022 22:25
@kennknowles
Copy link
Member Author

PTAL. Tests are green. Most of the work was in the GCP setup. Now the pipeline option is not shipped to workers, so that solves that problem for this PR.

@kennknowles
Copy link
Member Author

run java postcommit

Copy link
Member

@aaltay aaltay left a comment

Choose a reason for hiding this comment

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

LGTM. I think one gap to address in the future is testing is that the delegation chain longer than 1 (more than just target principal) is not tested.

@kennknowles
Copy link
Member Author

Agree. I will do some set up of the apache-beam-testing project to get this tested.

@kennknowles kennknowles merged commit 2af0dc7 into apache:master May 6, 2022
y1chi pushed a commit to y1chi/beam that referenced this pull request May 10, 2022
y1chi added a commit that referenced this pull request May 10, 2022
…e account impersonation in GCP credentials (#17597)

Co-authored-by: Kenn Knowles <[email protected]>
@Nullable
String getImpersonateServiceAccount();

void setImpersonateServiceAccount(String impersonateServiceAccount);
Copy link
Member

Choose a reason for hiding this comment

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

It seems odd to take a string that we parse instead of List/String[] since PipelineOptionsFactory can do this already for us. See

String[] args = new String[] {"--string=stringValue1,stringValue2,stringValue3"};

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I did not realize this. That could be a useful follow-up. We do want the format of the parameter to be the same across SDKs and across Beam and gcloud, etc. But it seems that comma-separated strings will be the same across all of them.

@kennknowles kennknowles deleted the impersonation branch June 3, 2022 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants