-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Fill Role names in kops-controller-config instead of instance profile names when it is specified #10728
Conversation
Hi @h3poteto. Thanks for your PR. I'm waiting for a kubernetes 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/test-infra repository. |
/ok-to-test |
/cc @johngmyers if you have time to review this. I'm debating the pros and cons of having kops-controller fetch the list of roles for each instance profile at startup time vs having the kops CLI get that list and populate the configmap with the list of roles. I'll admit I don't fully understand how having multiple roles associated with an instance profile and having that instance profile attached to an instance affects credentials provided via instance metadata, specifically when nodeup creates an sts.GetCallerIdentity request. How is the role chosen between all of the roles associated with the instance's instance profile? |
First I considered it, that is the kops CLI gets IAM Roles and fill it in kops-controller-config. But it is difficult because kops-controller-config is generated in template functions:
So it is difficult to call AWS API in this function.
OK, I'll check it. |
Per AWS documentation, an instance profile can contain at most one IAM role. (I admit to being baffled as to why instance profiles exist, as opposed to assigning roles directly.) The role in an instance profile can change, but I don't think kops needs to support noticing this change without an apply_cluster. I would prefer early binding of the permitted role, during apply_cluster. I would accept binding upon kops-controller startup, but think doing an API query on every token verify like the code appears to do is questionable. I think we need to add a field of type |
Indeed, if Which do you think is better, to get IAM Roles in kops-controller or to get IAM Roles in template functions and write it in configmap? |
Thank you. |
My mistake, I was remembering incorrectly and was thrown off by the Roles field here being a list. I agree in preferring the lookup happen in TemplateFunctions and providing the role list in the config file. We will need to provide a fi.Cloud to template functions. TemplateFunctions is setup in apply_cluster.go which already has a fi.Cloud so it should be straight forward to pass in. |
I see. I will rewrite this changes. |
684cfc7
to
8c5dc5f
Compare
/retest |
@rifelpet I rewrote this pull request, please review this again. |
… names when it is specified The role names are checked in node bootstrap. If profile names are provided, bootstrap will fail. Because profile name and role name do not always mactch in AWS IAM
/retest |
This looks good, thanks! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: h3poteto, rifelpet 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 |
/retest |
…28-origin-release-1.20 Automated cherry pick of #10728: Fill Role names in kops-controller-config instead of instance
…28-origin-release-1.19 Automated cherry pick of #10728: Fill Role names in kops-controller-config instead of instance
refs: #10719
The role names are checked in node bootstrap. If profile names are provided, bootstrap will fail. Because profile name and role name do not always mactch in AWS IAM. So I fixed
nodesRoles
in kops-controller-config to store IAM Role names associated with specified IAM Instance Profile.I think that this should be cherry-picked to 1.19.