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

Split CARMv2 functionality into Team Level Role and Service Level Role #158

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

TiberiuGC
Copy link
Member

@TiberiuGC TiberiuGC commented Aug 21, 2024

Issue #, if available:

Description of changes:

This PR aims to resolve a concern where a user migrating from CARMv1 to v2 (i.e. to teamIDs and service level isolation support) might end up with their resources re-created into incorrect accounts just by enabling the feature flag, due to lack of v2 configuration.

The PR splits CARMv2 feature into 2 different features, each behind its own feature flag:

  1. team level role - TeamLevelCARM , the mappings are being stored in a new configmap ack-role-team-map
  2. service level role - ServiceLevelCARM , the mappings can be stored in both the existing configmap ack-role-account-map and the new configmap ack-role-team-map

When both feature flags are ENABLED, the configmap setup may look like below (this is currently all squeezed into the CARMv2 map i.e. ack-carm-map):

ack-role-team-map 👇

data:
  team-a: "arn:aws:iam::111111111111:role/team-a-global-role"
  s3.team-a: "arn:aws:iam::111111111111:role/team-a-s3-role"
  dynamodb.team-a: "arn:aws:iam::111111111111:role/team-a-dynamodb-role"

ack-role-account-map 👇

data:
  111111111111: arn:aws:iam::111111111111:role/global-role
  s3.111111111111: arn:aws:iam::111111111111:role/s3-role
  dynamodb.111111111111: arn:aws:iam::111111111111:role/dynamodb-role 

When both feature flags are DISABLED, or neither teamID annotation or service level roles are setup, runtime continues to use the existing CARMv1 setup:

ack-role-account-map 👇

data:
  111111111111: arn:aws:iam::111111111111:role/global-role

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

ack-prow bot commented Aug 21, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ack-prow ack-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 21, 2024
@ack-prow ack-prow bot requested review from a-hilaly and jlbutler August 21, 2024 06:18
@TiberiuGC
Copy link
Member Author

/test all

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work! Thanks Tibi!

pkg/featuregate/features.go Outdated Show resolved Hide resolved
Comment on lines 138 to -151
// The user is specifying a namespace that is annotated with an owner account ID.
// Requeue if the corresponding roleARN is not available in the Accounts (CARMv1) configmap.
roleARN, err = r.getRoleARN(acctID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment stating that we're looking i the classic CARM?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is stating we're looking in Accounts configmap. Which is the default one. I refrained from using CARMv1 and v2 terminology as with this new approach.

pkg/runtime/cache/cache.go Outdated Show resolved Hide resolved
@a-hilaly a-hilaly marked this pull request as ready for review August 27, 2024 00:25
@ack-prow ack-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 27, 2024
@ack-prow ack-prow bot requested a review from a-hilaly August 27, 2024 00:25
@a-hilaly
Copy link
Member

/retest

2 similar comments
@a-hilaly
Copy link
Member

/retest

@TiberiuGC
Copy link
Member Author

/retest

@a-hilaly
Copy link
Member

This looks stable to me. Any other updates you want to make to the code/PR description? cc @TiberiuGC

@TiberiuGC
Copy link
Member Author

TiberiuGC commented Aug 27, 2024

This looks stable to me. Any other updates you want to make to the code/PR description? cc @TiberiuGC

I could rename the flags as per your suggestion, just to be more descriptive? TeamLevelCARM/ServiceLevelCARM e.g.

--feature-gates TeamLevelCARM=true

@TiberiuGC
Copy link
Member Author

This looks stable to me. Any other updates you want to make to the code/PR description? cc @TiberiuGC

I could rename the flags using your suggestion, just to be more descriptive? TeamLevelCARM/ServiceLevelCARM e.g.

--feature-gates TeamLevelCARM=true

Done c2213da

@a-hilaly
Copy link
Member

/test all

1 similar comment
@a-hilaly
Copy link
Member

/test all

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff, thanks a lot @TiberiuGC !
/lgtm

@ack-prow ack-prow bot added lgtm Indicates that a PR is ready to be merged. approved labels Aug 29, 2024
@a-hilaly
Copy link
Member

/retest

@ack-prow ack-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 29, 2024
@a-hilaly
Copy link
Member

/test all

@a-hilaly
Copy link
Member

/retest

@a-hilaly
Copy link
Member

/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Aug 29, 2024
Copy link

ack-prow bot commented Aug 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-hilaly, TiberiuGC

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow bot merged commit b52262f into aws-controllers-k8s:main Aug 29, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants