ahmetb / runsd

Drop-in Service Discovery capabilities for Google Cloud Run.

Home Page:https://ahmet.im/blog/cloud-run-service-discovery/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get Project Hash if service is not yet deployed?

madbbb opened this issue · comments

Sorry for asking question here.

I have cloudbuild.yaml file which builds an image and deploys it on Cloud Run, how do you figure out CLOUD_RUN_PROJECT_HASH if service is not yet deployed?

Sadly you can't. The only way to do this is to make runsd also capture ingress traffic, and look at the host header but I decided not to implement this as it won't work well for apps that hardcore port 8080.

I am in the exact same boat as @madbbb :(

Nothing we can do in this repo.

If you wanna automate deployment of runsd, you can deploy an unused placeholder service to that project and parse the project's hash for now.

We might add deterministic URLs to Cloud Run at some point later.

I was wondering if this could not be retrieved from metadata endpoint? not really familiar with details of the cloud run however

Deploy an example service (Cloud Run offers an example image for you in the Cloud Console) and copy the hash from there, and delete the service.

For anyone like me that doesn't know the project hash is project-wide: It is project wide! So just deploy any service once, copy the hash and delete the service again. You can use the same hash for all services. 👍

@ahmetb this fresh comment of @steinroe about hash was really helpful, and it occurred to me: why not generate this hash when somebody enables Cloud Run Admin API for the GCP project?

why not generate this hash when somebody enables Cloud Run Admin API for the GCP project?

FWIW I locked this conversation because this repository is not the place to make Cloud Run feature requests.