ginolegigot opened a new pull request, #22910:
URL: https://github.com/apache/airflow/pull/22910
The parameter delegate_to parameter in the ComputeEngineSSHHook seems not
working at all.
So we dug into the code and added impersonation_chain parameter which is
fully supported by the other file compute.py. So we barely added a few lines in
compute_ssh.py to make it work.
This allows to properly impersonate service account using
ComputeEngineSSHHook. An example with iap_tunnel :
```python
task1 = SSHOperator(
task_id="task1_id",
ssh_hook=ComputeEngineSSHHook(
gcp_conn_id='test_connection_gcp',
instance_name="instance_target",
zone="instance_zone",
user="airflow",
project_id="instance_project",
use_oslogin=False,
use_iap_tunnel=True,
use_internal_ip=False,
impersonation_chain="service_account_to_impersonate",
expire_time="3m"
),
command="ls -la"
)
```
Only tested with IAP tunnel and only one service account email in
impersonation_chain. Linted with flake8 and formatted with black.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]