sallok00
sallok00
RRunPod
Created by sallok00 on 5/7/2024 in #⚡|serverless
How to authenticate with Google Cloud in a Docker container running Serverless?
Amazing - thanks a lot!
28 replies
RRunPod
Created by sallok00 on 5/7/2024 in #⚡|serverless
How to authenticate with Google Cloud in a Docker container running Serverless?
Thanks @MuddyRumbles, and sorry for my slow reply. Looks like I somehow missed your ping. I've also tried to save it as a secret but it gets truncated. For now I'm doing something similar to what you do above - saving the .json file in the container and read it directly. This is not ideal on longer term though due to the security risk.
28 replies
RRunPod
Created by sallok00 on 5/7/2024 in #⚡|serverless
How to authenticate with Google Cloud in a Docker container running Serverless?
Friendly ping @flash-singh, is this something you could help out with? Similar to discussed here: https://discord.com/channels/912829806415085598/1195092101671690260/1195092101671690260
28 replies
RRunPod
Created by sallok00 on 5/7/2024 in #⚡|serverless
How to authenticate with Google Cloud in a Docker container running Serverless?
I'm trying the service account approach as I explained above but it's not working. Workload identity federation seem a little bit trickier (and it's not clear whether that key is shorter) so I think I'll just wait to see if they can extend the Secret length to 4k instead - it seems like a potentially easier solution 🙂
28 replies
RRunPod
Created by sallok00 on 5/7/2024 in #⚡|serverless
How to authenticate with Google Cloud in a Docker container running Serverless?
@zacksparrow would it be possible to extend the Secret length to 4000 characters similar to the Registry Credentials? That way I would be able to read the credentials directly as follows:
storage_client = Client.from_service_account_info(
info=GOOGLE_APPLICATION_CREDENTIALS,
)
storage_client = Client.from_service_account_info(
info=GOOGLE_APPLICATION_CREDENTIALS,
)
28 replies
RRunPod
Created by sallok00 on 5/7/2024 in #⚡|serverless
How to authenticate with Google Cloud in a Docker container running Serverless?
This is how I read the credentials and upload the objects:
from google.cloud.storage import Client, transfer_manager
GOOGLE_APPLICATION_CREDENTIALS = os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', None)

storage_client = Client.from_service_account_json(
json_credentials_path=GOOGLE_APPLICATION_CREDENTIALS,
)

# Upload the files
transfer_manager.upload_many(
file_blob_pairs,
worker_type="thread",
max_workers=workers,
)
from google.cloud.storage import Client, transfer_manager
GOOGLE_APPLICATION_CREDENTIALS = os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', None)

storage_client = Client.from_service_account_json(
json_credentials_path=GOOGLE_APPLICATION_CREDENTIALS,
)

# Upload the files
transfer_manager.upload_many(
file_blob_pairs,
worker_type="thread",
max_workers=workers,
)
28 replies
RRunPod
Created by sallok00 on 5/7/2024 in #⚡|serverless
How to authenticate with Google Cloud in a Docker container running Serverless?
Thanks @nerdylive. I'm using GOOGLE_APPLICATION_CREDENTIALS the way you suggest during local development. However, for deployment this would require me to keep the JSON file inside the Docker container which is not great practice from a security perspective.
28 replies