m1racoli commented on code in PR #37486:
URL: https://github.com/apache/airflow/pull/37486#discussion_r1494310730
##########
airflow/providers/google/cloud/hooks/kubernetes_engine.py:
##########
@@ -709,37 +709,34 @@ async def get_pod(self, name: str, namespace: str) ->
V1Pod:
:param name: Name of the pod.
:param namespace: Name of the pod's namespace.
"""
- with await self.service_file_as_context() as service_file: # type:
ignore[attr-defined]
- async with Token(scopes=self.scopes, service_file=service_file) as
token:
- async with self.get_conn(token) as connection:
- v1_api = async_client.CoreV1Api(connection)
- pod: V1Pod = await v1_api.read_namespaced_pod(
- name=name,
- namespace=namespace,
- )
- return pod
+ token = await self.get_token()
Review Comment:
In general we should replace all uses of `gcloud.aio.auth.token.Token` with
our `_CredentialsToken` implementation across the provider (there are only 2 or
3 uses left) to provide consistent support of async operations with credentials
from GCP connections.
Later on, once we have upgraded `gcloud-aio` to the lastest major version we
can look into replacing our `_CredentialsToken` with gcloud-aio's Token by
refactoring
[GoogleBaseAsyncHook.get_token](https://github.com/apache/airflow/blob/fa234e0d229dfebb6284dd851870e64186fb53e2/airflow/providers/google/common/hooks/base_google.py#L696)
appropriately.
--
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]