Skip to content

add env var for spilo with irsa#3135

Merged
FxKu merged 1 commit into
masterfrom
spilo-env-irsa
Jul 22, 2026
Merged

add env var for spilo with irsa#3135
FxKu merged 1 commit into
masterfrom
spilo-env-irsa

Conversation

@tcondeixa

@tcondeixa tcondeixa commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Problem detected on smoke tests

Standby and clone clusters fail to bootstrap when the operator is configured with IRSA (irsa_role_arn). Patroni exits with PatroniFatalException: Failed to bootstrap cluster after wal-g repeatedly fails with NoCredentialProviders.

Root cause: The EKS admission webhook injects AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE into the pod environment (bare, unprefixed). Spilo's configure_spilo.py writes these into the main envdir (/run/etc/wal-e.d/env/) correctly, but for standby and clone it looks for the prefixed versions (STANDBY_AWS_ROLE_ARN, CLONE_AWS_ROLE_ARN) which are never set. wal-g runs under envdir which replaces the entire environment with only the files in the target directory — so without the prefixed vars being written there, wal-g has no credentials.

Proposed Fix

In generateCloneEnvironment() and generateStandbyEnvironment() in pkg/cluster/k8sres.go, when IRSARoleARN is configured, add the prefixed IRSA env vars to the pod spec:

  • CLONE_AWS_ROLE_ARN / CLONE_AWS_WEB_IDENTITY_TOKEN_FILE
  • STANDBY_AWS_ROLE_ARN / STANDBY_AWS_WEB_IDENTITY_TOKEN_FILE

Spilo then finds these in the pod environment and writes them into the respective envdirs, giving wal-g valid IRSA credentials for S3 access.

This is the PR created for spilo: zalando/spilo#1206

@tcondeixa

Copy link
Copy Markdown
Collaborator Author

I was using AI to investigate the issue with the smoke tests, @FxKu does this change make sense? I see the env vars are copied for spilo.

Comment thread pkg/cluster/k8sres.go
@tcondeixa

Copy link
Copy Markdown
Collaborator Author

I'm closing this since this was solved in spilo directly in zalando/spilo#1206

@tcondeixa tcondeixa closed this Jul 22, 2026
@tcondeixa
tcondeixa deleted the spilo-env-irsa branch July 22, 2026 13:29
@tcondeixa
tcondeixa restored the spilo-env-irsa branch July 22, 2026 14:29
@tcondeixa tcondeixa reopened this Jul 22, 2026
@tcondeixa

tcondeixa commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

This can be temporary merged if that helps, but spilo already provides support

@FxKu

FxKu commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

👍

@FxKu FxKu added this to the 2.0.0 milestone Jul 22, 2026
@tcondeixa

Copy link
Copy Markdown
Collaborator Author

👍

@FxKu FxKu moved this to Good state for merge in Postgres Operator Jul 22, 2026
@FxKu
FxKu merged commit 1b46031 into master Jul 22, 2026
13 of 17 checks passed
@FxKu
FxKu deleted the spilo-env-irsa branch July 22, 2026 14:40
@github-project-automation github-project-automation Bot moved this from Good state for merge to Done in Postgres Operator Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants