Skip to content

wal-g prefix overwrites credentials in the env dir, breaking archiving on metadata-server credentials #1211

Description

@cbascom

Problem

Since WAL-E was removed, configure_spilo.py writes the generated wal-g bucket prefix into a credentials variable in the wal-g env dir. Any deployment whose object-storage credentials come from the cloud metadata service rather than a key file loses WAL archiving and basebackups the moment it moves to an affected image.

Observed on ghcr.io/zalando/spilo-18:4.1-p2 (GKE, Workload Identity, GCS). Every archive_command fails:

ERROR: Failed to configure multi-storage: configure primary storage: configure storage with prefix
"gs://<bucket>/spilo/<scope>/wal/14": create Google Cloud storage: create GCS client: dialing:
google: error getting credentials using GOOGLE_APPLICATION_CREDENTIALS environment variable:
open gs://<bucket>/spilo/<scope>/wal/14: no such file or directory

because the env dir contains the prefix in both variables:

/run/etc/wal-e.d/env/WALG_GS_PREFIX                 = gs://<bucket>/spilo/<scope>/wal/14
/run/etc/wal-e.d/env/GOOGLE_APPLICATION_CREDENTIALS = gs://<bucket>/spilo/<scope>/wal/14

pg_stat_archiver shows archived_count = 0 with a climbing failed_count on every cluster. Pods stay healthy and Patroni reports the cluster as running, so nothing surfaces this except the archiver counters — the failure is silent until someone needs a restore.

There is no workaround possible via a configuration change.

Cause

prefix_env_name is write_envdir_names[0], and the compatibility block copies it to write_envdir_names[1]:

prefix_env_name = write_envdir_names[0]
...
# Set WALG_*_PREFIX for future compatibility
if store_type in ('S3', 'GS') and not walg.get(write_envdir_names[1]):
    walg[write_envdir_names[1]] = walg[prefix_env_name]

Before WAL-E was removed the lists began with the WAL-E prefix, so index 1 was the wal-g prefix. They now begin with the wal-g prefix:

gs_names = ['WALG_GS_PREFIX', 'GOOGLE_APPLICATION_CREDENTIALS']
s3_names = ['WALG_S3_PREFIX', 'AWS_ACCESS_KEY_ID', ...]

so index 1 is a credential. The copy is also redundant now that index 0 is already the wal-g prefix.

This is not GCS-specific — on S3 the same index is AWS_ACCESS_KEY_ID, so instance-role setups should be affected the same way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions