Skip to content

feat (operator): add support for IRSA (aws resources access) - #3128

Merged
FxKu merged 24 commits into
masterfrom
option-irsa-aws
Jul 15, 2026
Merged

FxKu merged 24 commits into
masterfrom
option-irsa-aws

Conversation

@tcondeixa

@tcondeixa tcondeixa commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Changes

Add irsa_role_arn config field to enable IRSA (IAM Roles for Service Accounts) as an alternative to kube2iam.

Setting irsa_role_arn to a full IAM role ARN annotates the pod ServiceAccount with eks.amazonaws.com/role-arn, which causes the EKS mutating webhook to inject an OIDC web identity token volume into new pods. The AWS SDK credential chain prefers this token over the EC2 metadata endpoint (kube2iam), so IRSA takes effect immediately on the next pod rotation.

Zero-downtime migration: running pods are not patched in-place — the kube2iam annotation (iam.amazonaws.com/role) drains naturally as pods rotate. Both kube_iam_role and irsa_role_arn can be set simultaneously during migration. Once all pods have rotated, kube_iam_role can be removed. The operator logs migration progress on every reconcile.

Fix date to use POSIX format and auto-detect gsed when available, so make works on macOS.

Test

  • Update operator without irsa_role_arn set — existing DBs unaffected, no SA annotation changes
  • Update operator with irsa_role_arn set and kube_iam_role kept — SA annotated immediately, new pods get IRSA token volume, existing pods keep kube2iam until rotated
  • Update operator with only irsa_role_arn (single deploy, no kube_iam_role) — one rotation produces clean pod with IRSA only
  • Create new DB with irsa_role_arn set — pod starts with IRSA from day one
  • Operator logs "IRSA migration complete" after all pods have rotated

@tcondeixa tcondeixa added the major Major feature changes or updates, e.g. feature rollout to a new country, new API calls. label Jul 13, 2026
@tcondeixa tcondeixa changed the title fix data to POSIX and sed working on macos Add support for IRSA Jul 13, 2026
@tcondeixa tcondeixa changed the title Add support for IRSA feat: add support for IRSA (aws resources access) Jul 13, 2026
@tcondeixa
tcondeixa marked this pull request as ready for review July 13, 2026 17:04
@tcondeixa tcondeixa changed the title feat: add support for IRSA (aws resources access) feat (operator): add support for IRSA (aws resources access) Jul 13, 2026
@FxKu

FxKu commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

can you move syncPodServiceAccount into the sync.go file for now so we have it all in one place? In general, it's a good idea to split the code into single files per K8s resource type, but lets do that in a separate PR.

Comment thread pkg/apis/acid.zalan.do/v1/operator_configuration_type.go Outdated
Comment thread Makefile
Comment thread pkg/cluster/sync_service_account.go Outdated
@tcondeixa

Copy link
Copy Markdown
Collaborator Author

move sa sync code to existing sync.go file to be all together

sure, I moved it to the existing sync.go file in d150b92

@FxKu

FxKu commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@FxKu FxKu added this to the 2.0.0 milestone Jul 15, 2026
@FxKu FxKu moved this to Open Questions in Postgres Operator Jul 15, 2026
@tcondeixa

Copy link
Copy Markdown
Collaborator Author

I addressed all the feedback and I updated all the markdown files (even the administrator.md), so please check again @mikkeloscar @FxKu

@mikkeloscar

Copy link
Copy Markdown
Member

@tcondeixa build is failing

@tcondeixa

tcondeixa commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

@tcondeixa build is failing

sorry, it was a network issues with vendor the module. After a retry in the pipeline the build is working.
I see the github actions failed for the operator-e2e-test, I will check if it's something I introduced or if we have flaky tests.

@mikkeloscar

Copy link
Copy Markdown
Member

👍

1 similar comment
@FxKu

FxKu commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

👍

@FxKu
FxKu merged commit 7578f9d into master Jul 15, 2026
15 checks passed
@FxKu
FxKu deleted the option-irsa-aws branch July 15, 2026 16:19
@github-project-automation github-project-automation Bot moved this from Open Questions to Done in Postgres Operator Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major Major feature changes or updates, e.g. feature rollout to a new country, new API calls.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants