-
Notifications
You must be signed in to change notification settings - Fork 588
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
✨ Support setting role path and permissions boundary on managed IAM roles #5286
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @robinkb. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@robinkb PermissionsBoundary are required for CloudFormation template rendering for creating roles and permissions. |
Hi @pavansokkenagaraj, thanks for the feedback. I've amended my commit. However, I see more roles generated in the template: Do these need to be changed, too? I didn't use the bootstrap proces, so I'm not really familiar with how it works. |
…ane, EKS fargate profile, and managed machine pools Signed-off-by: Robin Ketelbuters <[email protected]>
We are in the process of testing this on our own environment now. The most recent update includes some shenanigans around pointers. I'm not sure which way I am expected to handle them, as the codebase is inconsistent. The Spec for AWSManagedControlPlane uses pointers to strings for optional values, while the Spec for AWSFargateProfile does not, for example. |
/ok-to-test |
@@ -83,6 +83,12 @@ type AWSIAMRoleSpec struct { | |||
// ExtraStatements are additional IAM statements to be included inline for the role. | |||
ExtraStatements []iamv1.StatementEntry `json:"extraStatements,omitempty"` | |||
|
|||
// Path sets the path to the role. | |||
Path string `json:"path,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new fields only need to go into the latest API version (i.e. v1beta1). These can be removed.
But what this means is that the conversions need to be updated so that values for these new fields are restored when roundtripping.
A bit like we do here: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/api/v1beta1/awscluster_conversion.go#L27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I managed to update the conversions for the other types, but I am confused as to why I need to implement conversion for this type in particular? The bootstrap API is only for a local configuration file, right? It's not stored in etcd?
There is no conversion in place for it today. If I do need to implement conversion for it, then sure, I will do that. But I will require help, because the test is spitting out vague errors that I can make neither heads nor tails out of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I managed to update the conversions for the other types, but I am confused as to why I need to implement conversion for this type in particular? The bootstrap API is only for a local configuration file, right? It's not stored in etcd?
Normally for any Kubernetes API there is a test that does roundtrip conversion. But actually looking at this API we don't have those tests. With is great. So no need to worry about the conversion. I wonder if it is worth adding conversion functions at some point in the future.
The new field(s) still only need to go into the latest API version.
@@ -83,6 +83,12 @@ type AWSIAMRoleSpec struct { | |||
// ExtraStatements are additional IAM statements to be included inline for the role. | |||
ExtraStatements []iamv1.StatementEntry `json:"extraStatements,omitempty"` | |||
|
|||
// Path sets the path to the role. | |||
Path string `json:"path,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the "optional" kubebuilder comment?
Path string `json:"path,omitempty"` | ||
|
||
// PermissionsBoundary sets the ARN of the managed policy that is used to set the permissions boundary for the role. | ||
PermissionsBoundary string `json:"permissionsBoundary,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about optional.
// | ||
// This parameter is optional. If it is not included, it defaults to a slash | ||
// (/). | ||
RolePath string `json:"rolePath,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need these in this API version (see previous comment).
@robinkb: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Yes, roles/permissions which are created in template function for eks need to be updated. The other thing I had to do was to set the permissionsBoundary if it is not nil/empty |
@pavansokkenagaraj Thanks for the testing, I will get that fixed. Regarding the failing |
@robinkb - we don't need to worry about the apidiff if its outside an |
/override pull-cluster-api-provider-aws-apidiff-main |
@richardcase: Overrode contexts on behalf of richardcase: pull-cluster-api-provider-aws-apidiff-main In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Allows setting the role path and permissions boundary on managed IAM roles for EKS control plane, EKS Fargate profile, and managed machine pools. This is typically needed in enterprise environments with more stringent IAM requirements.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #5285
Special notes for your reviewer:
This is my first PR on this repository. I noticed a warning when generating code, and I wasn't sure if this needed to be fixed:
Checklist:
Release note: