Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utils command to migrate to pod identity associations #7343

Merged
merged 7 commits into from Dec 7, 2023

Conversation

TiberiuGC
Copy link
Collaborator

@TiberiuGC TiberiuGC commented Nov 29, 2023

Description

eksctl introduces a new utils command for migrating existing IAM Roles for service accounts to pod identity associations, i.e.

eksctl utils migrate-to-pod-identity --cluster my-cluster --approve

Behind the scenes, the command will apply the following steps:

  • install the eks-pod-identity-agent addon if not already active on the cluster
  • identify all IAM Roles that are associated with K8s service accounts
  • update the IAM trust policy of all roles, with an additional trusted entity, pointing to the new EKS Service principal (and, optionally, remove exising OIDC provider trust relationship)
  • create pod identity associations between all identified roles and the respective service accounts

Running the command without the --approve flag will only output a plan consisting of a set of tasks reflecting the steps above, e.g.

[ℹ]  (plan) would migrate 2 iamserviceaccount(s) to pod identity association(s) by executing the following tasks
[ℹ]  (plan) 
3 sequential tasks: { install eks-pod-identity-agent addon, 
    2 parallel sub-tasks: { 
        update trust policy for owned role "eksctl-my-cluster-addon-iamserv-Role1-beYhlhzpwQte",
        update trust policy for unowned role "Unowned-Role1",
    }, 
    2 parallel sub-tasks: { 
        create pod identity association for service account "default/sa1",
        create pod identity association for service account "default/sa2",
    } 
}
[ℹ]  all tasks were skipped
[!]  no changes were applied, run again with '--approve' to apply the changes

Additionally, to delete the existing OIDC provider trust relationship from all IAM Roles, run the command with --remove-oidc-provider-trust-relationship flag, e.g.

eksctl utils migrate-to-pod-identity --cluster my-cluster --approve --remove-oidc-provider-trust-relationship

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the userdocs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes
  • (Core team) Added labels for change area (e.g. area/nodegroup) and kind (e.g. kind/improvement)

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@TiberiuGC TiberiuGC added the kind/feature New feature or request label Nov 29, 2023
@TiberiuGC TiberiuGC force-pushed the podidentityassociation-migrate branch from 6878727 to 6bc1cf1 Compare December 4, 2023 17:54
@TiberiuGC TiberiuGC force-pushed the podidentityassociation-migrate branch from 3a68290 to 59b4f4e Compare December 5, 2023 09:44
@TiberiuGC TiberiuGC marked this pull request as ready for review December 5, 2023 10:01
@TiberiuGC TiberiuGC requested a review from cPu1 December 5, 2023 10:50
TiberiuGC and others added 2 commits December 7, 2023 21:34
Co-authored-by: Chetan Patwal <cPu1@users.noreply.github.com>
@TiberiuGC TiberiuGC enabled auto-merge (squash) December 7, 2023 19:34
@TiberiuGC TiberiuGC merged commit 02e44cd into eksctl-io:main Dec 7, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants