runtime: Fail when GCE metadata is inaccessible

When V23_EXPECT_GOOGLE_COMPUTE_ENGINE is set and non-empty, the runtime
will fail to initialize when the GCE metadata server is inaccessible or
some of its data cannot be retrieved.

When V23_EXPECT_GOOGLE_COMPUTE_ENGINE is not set (or is empty), the
previous behavior is preserved, i.e. we give up after 1 second and
assume we're not on GCE.

Production services cannot function properly when the metadata isn't
there. It's better to abort immediately than to keep running in a bad
state.

While at it, clean up the code around cloud VM metadata.

Fixes https://github.com/vanadium/issues/issues/1267

Change-Id: I933f97179b994c83460b2efe6658c8f098689531
14 files changed
tree: b637118d501b29bf40915566dbfb9a8d75f292a0
  1. cmd/
  2. examples/
  3. internal/
  4. lib/
  5. runtime/
  6. services/
  7. test/
  8. .gitignore
  9. AUTHORS
  10. CONTRIBUTING.md
  11. CONTRIBUTORS
  12. envvar.go
  13. envvar_test.go
  14. LICENSE
  15. PATENTS
  16. README.md
  17. VERSION
README.md

Vanadium

This repository contains a reference implementation of the Vanadium APIs.

Unlike the APIs in https://github.com/vanadium/go.v23, which promises to provide backward compatibility this repository makes no such promises.