Controller changes to improve UX for setting up TGWs on ECS #199
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this PR:
Background
In an ACL enabled Consul cluster where terminating gateway based ECS workloads are deployed, the ACL token used by the TGW proxy needs
service:write
permission on all the referenced services in the gateway config. This token will be used to pull in relevant information about those services from Consul's catalog. For example, let's consider a case where anexample-client-app
service (present in the mesh) tries to reach to an externalexample-server-app
service present outside the mesh through a TGW. The terminating gateway proxy in this case needs a token with the following policyfor the E2E to work. Without making any changes to the ECS controller, the current UX looks like this
The first 2 steps can be automated with terraform but the 3rd one has to be done manually by the operator because it is difficult to get the accessor ID of the token. Only with an accessorID in place will the operator be able to attach a policy to the token.
One possible workaround is to create a wildcard policy that looks something like
and add a binding rule to the configured auth method via the ECS controller that makes sure to add this policy to the resulting token for the TGW service identity. While this should technically work, it doesn't follow the principle of least privileges.
Proposed solution
consul-ecs-terminating-gateway-role
This way the token gets the required permissions to pull in details about the referenced external services. This also reduces manual intervention by operators.
How I've tested this PR:
How I expect reviewers to test this PR:
Checklist: