Skip to content

v0.12.0

Choose a tag to compare

@github-actions github-actions released this 27 Oct 15:16
· 265 commits to main since this release
ed61f16

Breaking: the registry moved to port 4561, and loopback listeners also take [::1]

On macOS, AirPlay Receiver listens on port 5000 on all interfaces, and it's on by default. macOS
let gcpemu bind 127.0.0.1:5000 beside it, so the Instance started, but a host client that
resolves localhost to ::1 reached AirPlay and timed out. Two changes fix this:

  • The Artifact Registry port is now 4561. Host clients push and pull with localhost:4561/...
    or 127.0.0.1:4561/.... gcpemu env (GCPEMU_REGISTRY), endpoints.json and the console's pull
    and push commands give the new port. To keep the old port, start with --port ar=5000. A
    Persistent Instance needs no other change: on start its GKE nodes and Build agent pull from the
    new port.
  • With --bind 127.0.0.1 or localhost (the default), every listener on that address also
    listens on [::1] at the same port
    : the API gateway, GCS, Pub/Sub, the registry, DNS over
    TCP, the metadata server and the Google front end. Service endpoints still report the
    127.0.0.1 address. A host without IPv6 loopback runs IPv4-only, as before. But if another
    process holds [::1]:<port> itself, the Instance now doesn't start, and the error names the
    port and IPv6. To fix it, free the port, or move that listener with --port NAME=....

gcpemu doctor now checks each port on 127.0.0.1 and [::1], and warns when another process
still answers on a port it could bind: that process holds the port on all interfaces. On macOS,
for ports 5000 and 7000, the warning tells you how to turn off AirPlay Receiver (System Settings
→ General → AirDrop & Handoff).

Known issue: docker push on a VM runtime still can't reach the registry (#831). Neither
change helps it: on a VM runtime, such as Docker Desktop, the daemon pushes from inside its VM,
where 127.0.0.1 and [::1] are the VM's own loopback, not the host's. Push from the host
instead, for example docker save -o image.tar REF and then crane push --insecure image.tar REF.

Breaking: the API gateway moved from port 4510 to 4562

LocalStack publishes its whole external-service range, 4510–4559, when its container starts. With
the API gateway on 4510, whichever of gcpemu and LocalStack started second either failed to start
or, with the range published on all interfaces, shared the port with the other without any error.
The API gateway's default port is now 4562, outside that range and LocalStack's edge port, 4566.
The Web console is at http://127.0.0.1:4562/console/, and gcpemu env (GCPEMU_GATEWAY) and
endpoints.json give the new port. The container image's API gateway listens on 4562 too: publish
it with -p 4562:4562.

Update anything that names the old port: SDK endpoint overrides,
CLOUDSDK_API_ENDPOINT_OVERRIDES_*, GCPEMU_GATEWAY, console bookmarks, and CI service-container
port mappings. To keep the old port instead, start with --port gateway=4510. A Persistent Instance
needs no other change: on start, its Managed containers, GKE nodes and Build agent reach the API
gateway on its new port, and each Build's logUrl points at it. Operations of Builds that finished
before the upgrade still give the old logUrl in their metadata.

When gcpemu doctor finds a named port in 4510–4559 or 4566 held, by a bind that fails or by
another process on all interfaces, it now says the port is in LocalStack's range.

GKE clusters serve the resource metrics API

Every emulated GKE cluster now runs k3s's bundled metrics-server and serves
metrics.k8s.io/v1beta1, as GKE does. kubectl top nodes and kubectl top pods work, and HPAs
on CPU or memory utilization scale instead of reporting FailedGetResourceMetric. Private
clusters get it too: its image is preloaded on every node. There is no setting to turn it off,
as on GKE. It runs as k3s ships it (Deployment kube-system/metrics-server), not under GKE's
metrics-server-v<version> name.

Existing clusters don't need to be recreated: a Persistent Instance installs metrics-server in each
cluster the next time it starts.

Linked Instances

Two Instances, say one on a laptop and one on an office machine, can now pair and share whole
Projects (ADR 0027). The office Instance starts with --link-bind <address> (port 4511, mutual
TLS), and the laptop runs gcpemu link pair <address>, or gcpemu link discover first to find it
on the LAN over mDNS. Each side checks the other's CA fingerprint, and the office approves with
gcpemu link approve. Then:

gcpemu link share team-shared              # on the office Instance
gcpemu link delegate team-shared --to office   # on the laptop

From then on, the laptop is the front Instance: every request that names team-shared, through
any Service, REST or gRPC, goes over the link, and the office serves it as the caller's
Principal. Access tokens, ID tokens and STS exchanges that either Instance issued verify on the
other, and key files and service endpoints name addresses the caller can reach. The Web console
shows Links, Delegated Projects and Pairing requests. See "Linked Instances" in the README.

Cloud SQL and GKE LoadBalancer Services on the LAN

--sql-bind <address> serves every Cloud SQL instance with a public IP on that address:
Postgres on a port of its own, and the Auth Proxy and connectors on 3307. The usual credentials
are checked at every IAM enforcement level, and authorized networks match the LAN client's own
address. Each instance now has a dnsName, which its server certificate names.

--lb-bind now serves the ports of GKE LoadBalancer Services as well as forwarding rules, and
such a Service lists the --lb-bind address in its status.loadBalancer.ingress.

GKE Autopilot clusters

Creating a cluster with autopilot.enabled used to fail with UNIMPLEMENTED. An Autopilot cluster
now gets the settings GKE gives one, and:

  • starts with one node and adds a node for each pod Pending for lack of room, sized to the GKE
    shape the pod fits, in the zone its node affinity asks for, with compute-class and Spot labels.
    An empty node goes after 30 s. GCPEMU_GKE_MAX_NODES caps nodes for both cluster modes.
  • applies GKE's Workload restrictions through admission webhooks: default and minimum resource
    requests, and no privileged pods, host namespaces, hostPort, writable hostPath or extra
    capabilities.
  • refuses node pool changes, since GKE owns its node pools.

gcloud container clusters check-autopilot-compatibility works on Standard clusters. The Web
console creates and edits Autopilot clusters and shows each cluster's mode, and Export, Seed and
Copy keep it.

GKE managed telemetry

With the Instance's OTEL_EXPORTER_OTLP_* variables set (ADR 0034):

  • A cluster whose Managed OpenTelemetry scope is COLLECTION_AND_INSTRUMENTATION_COMPONENTS
    serves GKE's managed collector at
    opentelemetry-collector.gke-managed-otel.svc.cluster.local (4317 gRPC, 4318 HTTP). The
    Instance adds the pod's Kubernetes attributes and forwards to your endpoint. No collector pods
    run.
  • An Instrumentation object sets the OTel SDK variables on the pods it selects, so they send to
    that collector.
  • With Managed Prometheus on (the default on Autopilot), PodMonitoring and
    ClusterPodMonitoring apply, and the Instance scrapes their targets into the same endpoint.

Google's emulators behind the API gateway

--external <api>=<host:port> forwards an API with no Service, such as Firestore or Spanner, to
an emulator you run, so clients use the one gateway address. --external <api>=managed has the
Instance run Google's own emulator in a container for firestore, datastore, spanner or
bigtable. A Persistent Instance keeps Firestore's and Datastore's data across restarts. Spanner
and Bigtable keep theirs only in memory, and the Instance warns about it on start. See "External
emulators" in the README.

Also in this release

  • A runtime that gives containers no cpuset cgroup, such as a rootless Podman machine, now fails
    gcpemu doctor and GKE cluster create up front with the fix (podman machine set --rootful),
    instead of k3s exiting with an opaque error.

What's Changed

Full Changelog: v0.11.0...v0.12.0