Skip to content

v0.15.0

Choose a tag to compare

@github-actions github-actions released this 13 Nov 21:16
· 71 commits to main since this release
80e3c01

Changed: Cloud SQL backup settings are checked the way Cloud SQL checks them

Backup retention now defaults by edition and is range-checked (#1044):

  • ENTERPRISE defaults to 7 retained backups and 7 days of transaction logs. ENTERPRISE_PLUS,
    which includes POSTGRES_16 and later with no edition, defaults to 15 and 14. Before, every
    edition got 7 and 7.
  • transactionLogRetentionDays must be 1–7 on Enterprise and 1–35 on Enterprise Plus,
    backupRetentionSettings.retainedBackups must be 1–365, and the log days can't exceed the
    retained backups (7 and 7 is fine, 7 and 1 is not). An explicit retainedBackups: 0 means the
    edition's default.
  • backupConfiguration.startTime must be 24-hour HH:MM, such as 07:00 (#1059). Before, a value
    such as 7am was stored, and the instance never took an Automated backup.

A setting that breaks these rules fails with 400 INVALID_ARGUMENT on insert, patch and update.
Stored values are never rewritten, but an instance that already holds such values fails every
patch, even an unrelated one, until its retention is fixed. Local Terraform or OpenTofu that relied
on the looser checks now fails on apply, as it would against GCP. Enterprise Plus instances created
without retention settings keep more backups and WAL than before, so they use more disk.

Changed: a Cloud SQL Operation fails while another one runs

A Cloud SQL instance now has the Operation lock GKE clusters already have (#979). A request that
would start an Operation while another runs fails with 409 operationInProgress instead of
queueing behind it, as Cloud SQL does. Scripts that fire several changes at one instance back to
back need to wait for each Operation to finish.

Changed: Cloud SQL dumps and archived WAL are gzipped

Backups and State snapshots are now stored as .sql.gz and streamed through the emulator, so a
dump is never held in memory whole (#1043). With point-in-time recovery, each archived WAL segment
is stored as <segment>.gz, which makes the WAL archive several times smaller (#1048, ADR 0072).
gcpemu still reads existing plain .sql dumps and WAL segments.

Don't downgrade below v0.15.0 with a data directory this release has written to. v0.14.0 reads
only plain .sql dumps and WAL, so it can't find or restore the gzipped ones.

Changed: the GKE Node limit is a setting, and the Instance reports it

  • The Node limit is now an ordinary setting: --gke-max-nodes, GCPEMU_GKE_MAX_NODES or
    gkeMaxNodes in the config file, with a default of 5 (#1068). A value that isn't a positive
    integer, such as abc, 8 or 0, now fails gcpemu start with an error that names it.
    Before, any such value silently meant 5.
  • /_emu/v1/info and gcpemu status report the limit in force as gke.nodeLimit (#1065).
  • The Instance estimates the memory its GKE nodes need, using the README's "GKE sizing" formula.
    When the estimate passes the Runtime machine's memory, the Instance logs a warning, gcpemu status
    prints a gke overcommitted: line, and /_emu/v1/info has gke.overcommit (#1070). Nodes are never refused for this.

Changed: the CA injector refuses pods it can't give the Instance CA

The GKE webhook that gives pods the Instance CA now uses failurePolicy: Fail (#1053). If it can't
prepare the namespace's gcpemu-ca-bundle ConfigMap, it refuses the pod with a 503, and the pod's
controller retries. Before, it admitted the pod without the CA, and the pod's first Google API call
failed with x509: certificate signed by unknown authority. kube-system pods are always admitted unchanged, and most admissions no longer
call back into the cluster's API server, so the webhook no longer times out under load.

Changed: an update mask that names one map key changes only that key

An update mask path such as labels.env now sets or removes that one key, as GCP does (#1062,
#1086–#1090). Before, it replaced the whole map, and Artifact Registry also mangled the key's case. This applies
to Artifact Registry repositories (labels, cleanup_policies), Secret Manager, Pub/Sub,
Certificate Manager, IAM workload identity pool providers (attributeMapping) and Cloud Build.
A key path on a field that isn't a map is now INVALID_ARGUMENT.

Changed: CLI commands act only on a confirmed Live Instance

Every command that needs an Instance now asks the Instance at its address first, and acts only when
it answers with this data directory's Instance ID (#1024, ADR 0066). Before, a left-behind
endpoints.json sent commands to whatever answered at that address. gcpemu start goes ahead only
once a Live Instance is ruled out. gcpemu stop reports success only for an exit it confirmed, and
a stop that times out names what it waited for (#998, #999).

Changed for contributors: the build uses just, not Task

The build moved from Task to just ≥ 1.56.0 (#932, ADR 0061). Every recipe
keeps its name (just build, just vet, just e2e, …), except the ones that took arguments:

Task just
task release VERSION=v1.2.3 just release v1.2.3
task image-check IMAGE=gcpemu:check just image-check gcpemu:check
task echo:dist / task echo:image-check IMAGE=x just echo-dist / just echo-image-check x
task conformance:record just conformance-record
task prerelease RUNTIMES=a,b IMAGE=x just prerelease a,b x
task generate GOOGLEAPIS=latest just generate latest

There is no task shim. just doctor checks your toolchain.

Cloud SQL takes daily Automated backups

A running instance with backups enabled now takes an Automated backup once the Emulator clock
passes backupConfiguration.startTime each day, and keeps the newest retainedBackups of them
(#1038, ADR 0069). With point-in-time recovery, the backup also takes a Base backup, so old WAL is
dropped. Missed days produce one backup, not one per day, and an upgrade doesn't trigger one.

Artifact Registry runs cleanup policies and frees unused layers

A Registry cleanup pass now runs at start and every minute (on gcpemu time advance in a
Deterministic Instance). It applies standard repositories' cleanup policies (#1039), and frees
layers and uploads that nothing refers to (#1045). Deleting a version now frees the layers only it
used.

GKE

  • Pods behind a NEG get the readiness gate cloud.google.com/load-balancer-neg-ready, so a rollout
    waits until the load balancer finds each new pod HEALTHY (#1036, ADR 0071). Before, a rollout
    could serve 503 failed_to_pick_backend.
  • Image garbage collection on each node is measured against its node pool's boot disk size, not the
    runtime's disk, which under Docker Desktop is as big as the host's (#1052, ADR 0073).
  • A cluster counts its Cluster server's exits and failed restarts in one UNAVAILABLE condition,
    visible through clusters.get and the console (#1061).
  • A cluster delete that fails leaves the cluster in ERROR, and the delete resumes on the next
    start (#1145). A node removal cut off by a cluster delete finishes first (#1144).
  • A node readiness timeout says what each node was doing (#971).

gcpemu.log rotates by size

A detached Instance now keeps gcpemu.log under 100 MB, plus three older files, gcpemu.log.1 to
gcpemu.log.3 (#1040). gcpemu logs reads them oldest first.

Other fixes

  • On macOS, Public roots come from the keychain and never include another Instance's CA (#1138).
  • An Instance shuts down within its deadline: the API gateway, Services' own HTTP servers, Cloud
    DNS and Cloud SQL stop by force once their time is up, and Teardown saves before stopping
    Services (#1034, #1115–#1118).
  • /_emu/v1/info no longer waits on the container runtime (#1025).
  • The Web console re-sends a write that got no response (#944), and a page whose script or
    stylesheet failed to load reloads itself (#948, #969).
  • The Web console can download a Secret version's value with its exact bytes (#964). Copy can
    change line endings on Windows.

What's Changed

Full Changelog: v0.14.0...v0.15.0