Describe the issue:
GCP documentation provides the following recommendation about local development and application authentification:
When your code is running in a local development environment, such as a development workstation, the best option is to use the credentials associated with your user account.
Simply saying we have to generate the credential json file using the following command:
gcloud auth application-default login
which will be located in ~/.config/gcloud/application_default_credentials.json. The following JSON credential file is different to service account file and does not contain some certaint fields like client_email. However, it is fully legit to specify this file in GOOGLE_APPLICATION_CREDENTIALS. The following env variable can contain a path to three types of JSON file: Workforce Identity Federation, Workload Identity Federation or service account key.
Currently, dask-cloudprovider expects that GOOGLE_APPLICATION_CREDENTIALS can contain only service account key and using Workload Identity Federation key leads to an error.
Here are a steps to reproduce the problem:
- Create
~/.config/gcloud/application_default_credentials.json by executing the command:
gcloud auth application-default login
- Set the absolute path of
~/.config/gcloud/application_default_credentials.json into GOOGLE_APPLICATION_CREDENTIALS variable.
- Try to start cluster on GCP
ER: it should work
AR: we get an error of incorrect format service account key.
I propose to change the way how Dask obtain credentials by replacing the existing logic with default Google's SDK flow of obtaining the application default credentials unless there is an importnat reason to leave the current logic.
The default Google's flow is the very close to which is implemented in Dask:
ADC searches for credentials in the following locations:
- GOOGLE_APPLICATION_CREDENTIALS environment variable
- User credentials set up by using the Google Cloud CLI
- The attached service account, returned by the metadata server
Link to PR: #430
Environment:
dask = "2024.5.2"
dask-cloudprovider = {extras = ["gcp"], version = "^2022.10.0"}
- Python version: 3.10
- Operating System: WSL
- Install method (conda, pip, source): poetry
Describe the issue:
GCP documentation provides the following recommendation about local development and application authentification:
Simply saying we have to generate the credential json file using the following command:
which will be located in
~/.config/gcloud/application_default_credentials.json. The following JSON credential file is different to service account file and does not contain some certaint fields likeclient_email. However, it is fully legit to specify this file inGOOGLE_APPLICATION_CREDENTIALS. The following env variable can contain a path to three types of JSON file: Workforce Identity Federation, Workload Identity Federation or service account key.Currently,
dask-cloudproviderexpects thatGOOGLE_APPLICATION_CREDENTIALScan contain only service account key and using Workload Identity Federation key leads to an error.Here are a steps to reproduce the problem:
~/.config/gcloud/application_default_credentials.jsonby executing the command:~/.config/gcloud/application_default_credentials.jsonintoGOOGLE_APPLICATION_CREDENTIALSvariable.ER: it should work
AR: we get an error of incorrect format service account key.
I propose to change the way how Dask obtain credentials by replacing the existing logic with default Google's SDK flow of obtaining the application default credentials unless there is an importnat reason to leave the current logic.
The default Google's flow is the very close to which is implemented in Dask:
Link to PR: #430
Environment: