Add impersonation to Google operators#10052
Conversation
|
@amithmathew Can you look at it? |
|
Changed |
e339d6b to
d664dfc
Compare
|
Implemented impersonation in newly added Datastore operators (#10032) |
d664dfc to
25f3d3f
Compare
|
@olchas would you mind adding an example DAG to show how users can use impersonation? |
25f3d3f to
34fadb3
Compare
Codecov Report
@@ Coverage Diff @@
## master #10052 +/- ##
===========================================
- Coverage 89.06% 35.10% -53.96%
===========================================
Files 1037 1037
Lines 49923 50230 +307
===========================================
- Hits 44464 17634 -26830
- Misses 5459 32596 +27137
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
34fadb3 to
9f41190
Compare
Codecov Report
@@ Coverage Diff @@
## master #10052 +/- ##
===========================================
- Coverage 89.44% 35.11% -54.34%
===========================================
Files 1037 1037
Lines 49927 50234 +307
===========================================
- Hits 44658 17639 -27019
- Misses 5269 32595 +27326
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
a411d19 to
97353d8
Compare
97353d8 to
53cd3df
Compare
|
Implemented impersonation in newly added Bigtable operator (#10340) |
53cd3df to
06b99f7
Compare
|
I have added instructions of setting up and using direct impersonation in docs/howto/connection/gcp.rst. @mik-laj, could you take a look? @turbaszek, do you think it will suffice for usage example? I am not sure if there is much point building a whole example dag around impersonation - usage for every Google operator is the same. |
|
That's huge. The docs look good and I hope that the auto refactors worked as expected. Regarding the example, I think we should add it but we can create an issue for that so no need to do this now. |
|
I would like to do a review. Please wait a moment. |
|
Are you planning to add impersonations for DataflowCreatePythonJobOperator and DataflowCreateJavaJobOperator, GKEStartPodOperator and BigQueryTablePartitionExistenceSensor? |
06b99f7 to
e7549f6
Compare
e7549f6 to
3fca76f
Compare
|
@mik-laj I have added impersonation to BigQueryTablePartitionExistenceSensor. As I mentioned in PR's description, DataflowCreatePythonJobOperator, DataflowCreateJavaJobOperator and GKEStartPodOperator use different form of authentication (they do not use |
This PR adds direct impersonation of a service account in Google services. Part-of #8803
A few notes summarizing the changes:
GKEStartPodOperator,DataflowCreateJavaJobOperatorandDataflowCreatePythonJobOperator- as these operators do not useCredentialsclass for authenticationimpersonation_chain(if applicable)google_impersonation_chainget_credentials_and_projectmethod of_CredentialProviderclass so that ifimpersonation_chainargument is used thenproject_idreturned is extracted from the e-mail of the impersonated account (target_principal). This is for the scenario when impersonated service account is from different project than the account from Connection.project_idwill still be overridden if specified in Connection's extras or explicitly in operator's arguments.GCSToS3Operatorwas modified so that it no longer derivatives fromGCSListObjectsOperatorimpersonation_chainwas moved to be the last argument of hooks (if it was not already) to avoid potentially breaking changes when initializing these hooks with positional argumentsMake sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.