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

✨ Assume prerequisite role on hub if initailize with aws-irsa #807

Conversation

jaswalkiranavtar
Copy link
Contributor

@jaswalkiranavtar jaswalkiranavtar commented Jan 16, 2025

Summary

If the hub is initialized with aws-irsa, it should assume a precreated IAM role with predefined named which will allow it permission to create IAM roles and policies for spokes that are trying to join.

Related issue(s)

Ref: #514

@jaswalkiranavtar jaswalkiranavtar force-pushed the managed-cluster-identity-creator-role-changes branch 2 times, most recently from 1fd0cdf to e63a013 Compare January 16, 2025 20:21
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 10 lines in your changes missing coverage. Please review.

Project coverage is 63.82%. Comparing base (5df279f) to head (6132fc7).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...stermanagercontroller/clustermanager_controller.go 41.66% 6 Missing and 1 partial ⚠️
pkg/common/helpers/aws.go 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #807      +/-   ##
==========================================
+ Coverage   63.78%   63.82%   +0.04%     
==========================================
  Files         192      193       +1     
  Lines       18638    18673      +35     
==========================================
+ Hits        11888    11918      +30     
- Misses       5771     5774       +3     
- Partials      979      981       +2     
Flag Coverage Δ
unit 63.82% <60.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jaswalkiranavtar jaswalkiranavtar force-pushed the managed-cluster-identity-creator-role-changes branch 4 times, most recently from e394c07 to a21f7b4 Compare January 17, 2025 02:04
@jaswalkiranavtar jaswalkiranavtar force-pushed the managed-cluster-identity-creator-role-changes branch from a21f7b4 to 942f19b Compare January 17, 2025 02:30

import "strings"

func GetAwsAccountIdAndClusterName(clusterArn string) (string, string) {
Copy link
Member

Choose a reason for hiding this comment

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

some comments on both of this func will be helpful.

Copy link
Member

Choose a reason for hiding this comment

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

Checked that comments has been added.

{{ if .ManagedClusterIdentityCreatorRole }}
annotations:
eks.amazonaws.com/role-arn: {{ .ManagedClusterIdentityCreatorRole }}
{{end}}
Copy link
Member

Choose a reason for hiding this comment

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

eof

Copy link
Member

Choose a reason for hiding this comment

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

Checked.

@@ -0,0 +1,15 @@
package helpers

import "strings"
Copy link
Member

Choose a reason for hiding this comment

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

you might want to change the file name to aws.go or awsparser.go

Copy link
Member

Choose a reason for hiding this comment

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

Verified that it has been renamed to aws.go

@@ -3,3 +3,7 @@ kind: ServiceAccount
metadata:
name: registration-controller-sa
namespace: {{ .ClusterManagerNamespace }}
{{ if .ManagedClusterIdentityCreatorRole }}
annotations:
eks.amazonaws.com/role-arn: {{ .ManagedClusterIdentityCreatorRole }}
Copy link
Member

Choose a reason for hiding this comment

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

this is not quite extensible, e.g. the key is specifically for eks. How do you think the keys/values could be configured from the template?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think same needs to be applied on klusterlet SA as well. Will address it in a seperate PR.

@qiujian16
Copy link
Member

/approve

some nit comment, I think we need to think about #807 (comment) for extensibility, but does not necessarily need to be resolved in this PR.

@jaswalkiranavtar jaswalkiranavtar force-pushed the managed-cluster-identity-creator-role-changes branch 2 times, most recently from 78a5a95 to f4828a3 Compare January 17, 2025 15:27
Signed-off-by: Gaurav Jaswal <[email protected]>
@jaswalkiranavtar jaswalkiranavtar force-pushed the managed-cluster-identity-creator-role-changes branch from f4828a3 to 6132fc7 Compare January 17, 2025 15:41
Copy link
Member

@mikeshng mikeshng left a comment

Choose a reason for hiding this comment

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

/lgtm

Verified that the final Qiu Jian's Slack comment regarding updating the cluster manager (remove registrationDriver) in clustermanager_aws_test.go has been addressed.

Copy link
Contributor

openshift-ci bot commented Jan 17, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jaswalkiranavtar, mikeshng, qiujian16

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

@openshift-merge-bot openshift-merge-bot bot merged commit f62242d into open-cluster-management-io:main Jan 17, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants