-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(aws): multiple zone roles #5057
base: master
Are you sure you want to change the base?
feat(aws): multiple zone roles #5057
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 |
Welcome @hjoshi123! |
Hi @hjoshi123. 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. |
Hey. It will not fixes the issue, but it relates. As the issue is more about HOW to, and not WHY something is not supported. The problem should be clear enough, so that the maintainers will decide where or not it worth to be added to master (disclaimer, I'm not one of them) You may need to start or look at documentation. As not clear how and what this pull request is solving. It's more like a new feature. So worth to explain you case and setup. As well as share how this was tested, specifically need to make sure this not break current functionality and what is wrong with current flags like |
For more context @ivankatliarchuk I am trying to solve the problem where one external dns instance can manage multiple aws hosted zones through role assumption. So ideally we wouldn't need multiple instances or an umbrella chart if my proposal is accepted. My change currently uses the map:
Once the map is ready then the configured profile through the aws profile or the default profile is used to assume roles for different domains and then whenever the change matches to the hosted zone those creds are used. @szuecs or @mloiseleur do you guys feel this is within the scope? If yes I could start adding unit tests and make the PR cleaner |
Worth adding to the header of the pull request a description |
@@ -347,7 +347,7 @@ func TestAWSZones(t *testing.T) { | |||
func TestAWSZonesWithTagFilterError(t *testing.T) { | |||
client := NewRoute53APIStub(t) | |||
provider := &AWSProvider{ | |||
clients: map[string]Route53API{defaultAWSProfile: client}, | |||
clients: map[string][]*AWSZoneConfig{defaultAWSProfile: {{Route53Config: client}}}, |
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.
Hmm that reads not obvious enough to me for being a "clients".
type AWSZoneConfig struct { | ||
Config awsv2.Config | ||
HostedZoneName string | ||
Route53Config Route53API |
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.
On my phone so no lookup possible, so maybe I am wrong.
The name seems to be wrong. I think elsewhere we call it client iirc.
Not sure what this statement even means. In the issue itself I have described a way, as all the AWS IAM roles should be least privilege, all the external-dns deployments are isolated and deployed to a required location. Umbrella chart was given as an example tool that could be used, but not required. So it's not a disadvantage, it's one of the options how to manage multiple AWS accounts and zones in a secure way. Initial issue #4526 is about HOW to setup, as there are missing documentation, not missing capabilities. At the moment And issue #4526 is about multiple accounts not multiple Domains to be managed by different IAM roles. I would love to see a tutorial, currently not too clear how this will work when there are 100+ zones in account and let's say are a dozen of AWS accounts. |
@ivankatliarchuk this solution handles the problem of multiple accounts. It allows you mention the roles you want to use for the hosted zone/domain you want. It could be delegated domains in different accounts or diff domains altogether. As long as the profile you mention has permission to assume the role(s), this solution can manage it. As @szuecs also pointed during my discussion with him in slack, I would also add documentation around this and that if there are multiple roles within the same account then there could be rate limit issues. |
Just few concerns
|
@ivankatliarchuk to address some of your concerns:
|
…aws-multiple-zones-roles
/retitle feat(aws): multiple zone roles |
@hjoshi123 Would you please update documentation accordingly to show how it can be used ? /ok-to-test |
@mloiseleur should I also edit the helm chart to add the option to the schema and values file as part of the PR? |
High level though and observations that needs to be addressed
I'm not sure how is all set. But what stopping an engineer, let's say when there are accounts A,B,C,D,E to simply configure an IAM roles and trusts for account X where I may misunderstood something, same time releasing as is, sounds quite risky option. |
@ivankatliarchuk Clarifying some points as you told:
This is not possible as that would be role chaining.. let's say the primary external dns has a pod identity, it can now assume only one role which can have access to a particular account. We can't give the pod identity access to multiple accounts because AWS doesn't allow that. This option would be good if AWS allowed it. |
…aws-multiple-zones-roles
This pull request is a bit controversial to me. There is no matching issue, linked issue is asking for HOW to do it. On aws, I could create a role A, attach to external DNS and create roles B,C,D,E,.... in other accounts and configure a trust to role A. Hence external-dns could have access to all route53 endpoints in account B,C,D,E without code changes in current codebase. More important, we not following the model for other k8s-sigs products, where single instance-single account. I could be wrong here, but not found other examples. |
@ivankatliarchuk I am not sure if the approach you were mentioning works. Let's say external dns has credentials through pod identity or IRSA it can be told to assume only one role. That role can only have access to route53 of that account. Role chaining is not possible with the current setup. About the second point, I am not sure. I would defer it to you guys to decide @ivankatliarchuk @szuecs @mloiseleur. I do know in external secrets you can deploy multiple secret stores in a declarative way with different roles on a single deployment without using umbrella charts. |
I don't know if we always need an issue. I think a PR is also an issue if you propose something not too complex.
I think our user base has already a bunch of cross account roles. At least I remember some issues about it that told that they have this style running. |
I'm not too sure what is expected from me. What I was saying, external-dns supports cross-account at the moment, there are no need of any code changes. There is no documentation describing how to do it. Would be nice to understand the use case for what aws provider assume-role rewrite is required and what's wrong with |
@ivankatliarchuk I would like to elaborate on that. This PR came from a use-case that we were tackling regarding cross account aws access. The way it works currently and how we have it deployed is that we have a EKS Pod Identity which gives external dns access to STS and then we use Let's say you want to access Route53 in Acct B from Acct A. Then you create a role in Acct B with IAM policy access to route53 and trust policy of Account A's role. Account A's role will have an IAM policy to assume the role in Account B.
The Account A's trust policy will be using Pod Identity or IRSA to allow the service account to use the role. Now with `--aws-assume-role` you can only mention one role which can be assumed.
So if I have Account C then I can't tell external dns to assume another role in the same instance of external-dns. The code currently, uses both approaches and --aws-assume-role can still be used by clients who don't want cross account access. |
…aws-multiple-zones-roles
@mloiseleur what do you think we should do with this PR? I am not sure how to proceed. |
Cross account on single tenant is a bit tricky. I already shared implications. Will try to share a view from slightly different angle
|
I have mixed feeling about it, TBH. I understand from your use case that you have 5 accounts, each with a different dns zone in route 53, and so 5 instances of external-dns. You probably had (good) reasons to have separate accounts, each with its own zone, so I'm not sure to understand the benefits of having the dns of all those accounts managed by a single instance. From a resources point of view, external-dns usually run with little amount of cpu and memory. I see the potential bad consequences of this approach: the reasons you had to separate those accounts are hijacked. A software error, a human error or a CVE could cause issues on all the dns of all those accounts. A common pattern I'm aware of for multi-cloud or multi-account users who want simple dns management is to manage all their zones in the same source (so a single AWS account in your case). For those who want to split for security or availability, they usually deploy a dedicated instance for each account to align with their goal. |
Got it @mloiseleur @ivankatliarchuk. I understand the considerations that you are pointing regarding security issues. I would like to give a bit of background. So this PR came out of a scenario that we had to solve wherein we have around 60 or so accounts which manage their own hosted zones and we cant delegate the zones due to the fact that they are different teams which came into our org through acquisitions.. so now we are faced a scenario where we are building a platform and inorder to manage all of them centrally we are to deploy 60 odd instances of external dns as opposed to only one which could do that. |
Maybe try to came out with a document outlining cross account deployment options that is available to users with security best practices in mind. I could do a follow up on that. |
the assumeRole functionality is already within the codebase this change uses a map to specify how to parameterize existing functionality per-domain. |
60 instances of a controller with a dyanamc need to deploy more is a non-trivial piece of infra for any team. |
Description
For more context I am trying to solve the problem where one external dns instance can manage multiple aws hosted zones through role assumption. So ideally we wouldn't need multiple instances or an umbrella chart if my proposal is accepted.
As far the --aws-profile= that would still be valid since external dns would need a profile to have permissions to do the sts:AssumeRole. For backwards compatibility, we could still keep the --aws-assume-role= too although my current change would create a breaking change for it.
My change currently uses the map:
aws-domain-roles=zzz.com=aws:arn...
Once the map is ready then the configured profile through the aws profile or the default profile is used to assume roles for different domains and then whenever the change matches to the hosted zone those creds are used.
Fixes #4526
Checklist