GoogleCloudPlatform / cloud-run-hello

Demo container for Google Cloud Run
https://cloud.run
Apache License 2.0
98 stars 140 forks source link

feat: use metadata package #95

Open JulienBreux opened 2 months ago

JulienBreux commented 2 months ago

Description

Use of the metadata package to show users how to properly obtain the metadata of an instance in Cloud Run.

Note

Removal of the region part in favor of the zone part. The region part is no longer part of the metadata package and API.

JulienBreux commented 2 months ago

cc @steren @grayside

steren commented 2 months ago

The original idea of this demo container was "no dependencies", and we preferred 20 lines to call metadata server that importing a package for that.

That being said, we then added some packages for cloudevents, so I'm fine with this change.

steren commented 2 months ago

Also note that Cloud Run metadata server now returns the region directly (`/computeMetadata/v1/instance/region, but I am not totally sure this is supported on GCE.