-
Notifications
You must be signed in to change notification settings - Fork 254
Implementing LB forwarding rules by URL to ECS tasks #871
Conversation
Signed-off-by: flaviostutz <[email protected]>
Signed-off-by: flaviostutz <[email protected]>
20379ee
to
1f9522e
Compare
…-port-url Signed-off-by: flaviostutz <[email protected]>
Signed-off-by: flaviostutz <[email protected]>
Signed-off-by: flaviostutz <[email protected]>
Signed-off-by: flaviostutz <[email protected]>
Signed-off-by: flaviostutz <[email protected]>
Signed-off-by: flaviostutz <[email protected]>
Signed-off-by: flaviostutz <[email protected]>
Signed-off-by: flaviostutz <[email protected]>
I'd prefer we don't get more Short terms one should just provide a load balancer and configure it by more specific tools. Longer terms, the Routing proposal could be used to express how to route traffic to service and external visibility (domain name, path, certificate, ...) then we can translate such a generic definition into AWS-specific components. |
I proposed some docs addition to clarify use of an external load balancer: docker/docs#11771 |
if len(ts) > 6 { | ||
ts = ts[:6] | ||
// normalizeResourceName will remove invalid template element name characters, | ||
// create a CamelCase style in resulting string and add 4 bytes of the string CRC |
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 understand the intent here but I don't like we polute the logical resource name and make them unpredictable (for a humain brain, which can't compute CRCs :P)
I don't expect conflicts to be such a common thing, and we could detect those before conversion
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 had a lot of naming collisions when adding path based rules because the path names are too long for being used as the resource name without truncating it, and by truncating/removing non alphabetic chars the chance of a collision was high. We could enhance this mechanism by verifying if there is, among all rules, a "real" collision and then add a counter to the resource name when adding path based routing to ECS here...
This PR is mixing lot's of propopsed improvements,
for all those we need to establish product direction and alignment with local developer experience: what does it mean to have path based routing on ECS if you can't test for local deployment on your workstation? this make it highly inspirational but low chance to get merged as-is |
I know there is lots of changes here. I don't mind spliting this into multiple discussions/PRs. |
closing as obsolete |
What I did
Created custom attributes
x-aws-loadbalancer_urls
andx-aws-loadbalancer_https_certificate
. The objective is to configure the access scheme/domains/apis right for the URLs used to access the services in the docker-compose.yml itself so that "releases" to multiple environments are more easily done.According to "x-aws-loadbalancer_urls", new listeners and rules are automatically added to the LB/listeners so that according to scheme (HTTP/HTTPS), Host header and Request path, the request will be forwarded to the desired TargetGroup of the service. If any url is "https", it will use the "x-aws-loadbalancer_https_certificate" parameter in order to create a HTTPS listener for the balancer. A default HTTP->HTTPS redirect rule is created on the HTTP listener for URLs that are present only in HTTPS form.
To avoid re-creating unnecessary resources during updates, the algorithm takes care to reproduce the same CloudFormation template bytes for parts that don't need to be changed by using ordering.
To avoid collisions in "normalized" names, I added a CRC32 string to the "normalize" function. This is specially needed because as we have URLs and paths on "rules" element names that needs to be normalized, the strings would get too long for names and simply truncating then would cause collisions (apart from that case, we could have collision with service names that have small differences in names).
I fixed a small bug on tty that happens on small screens/long names combinations that was arising during our tests.
I tried to implement this with minimum impact to current LB published port code base as an alternative that will only take place if the user specifies
x-aws-loadbalancer_urls
. The default behavior hasn't changed.I tested some different cases using both the published port and the URL specification scenarios with some of our real cases over the weekend.
This PR is part of an effort for us to migrate our current self managed Swarm Clusters on VMs to ECS. Today we use Traefik/Caddy labels in docker-compose.yml to configure URLs for each environment and it makes our operation very agile.
Related issue
fixes #777
(not mandatory) A picture of a cute animal, if possible in relation with what you did
