Skip to content
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

Rolling Blue-Green Deployments for AWS-LB (ALB/*NLB) #1948

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

matt-deboer
Copy link

@matt-deboer matt-deboer commented Oct 17, 2017

This PR adds the capability of rolling (zero-downtime) deployments to the newer aws_lb resources, similar to the rolling deployment pattern used for aws_elb resources.
Even better, in this case, instances from the new ASG are available for routing until all of them are ready, and the change-over is seamless so that a given user will not received mixed-version answers from the app.

This solves #494, although the desired goal of no schema changes was not possible, due to the inherent differences in the new load-balancer resources and their decoupling from the autoscaling groups to which they route--however, if the defaults are acceptable, the 2 new optional attributes can be omitted, and the experience will be the same from the terraform user's perspective.

Changes: ( on the aws_lb_listener resource )

  • Adds a min_target_group_capacity attribute (optional); during creation and updates, the listener will wait for this number of instances to report healthy status before updating the default action. When not specified, this value is determined from the (sum of) DesiredCapacity value(s) on the autoscaling group(s) targeted by the target group. Set to 0 to disable waiting.

  • Adds a wait_for_capacity_timeout attribute (optional); this configures how long the listener should wait for the desired target group capacity before failing in error. Defaults to 10m.

The waiting occurs on the aws_lb_listener resource since Target Groups only become eligible for health checks upon attachment to a Load Balancer. This approach uses a "dummy rule" (essentially non-routable) which serves to enable health checks on the target group before it is routed any requests from the load balancer.

Edit (2017-10-23):

Note: NLB is not currently supported due to the lack of that capability in the provider overall (follow #1838 for details)

@Ninir Ninir added the bug Addresses a defect in current functionality. label Oct 18, 2017
@matt-deboer matt-deboer changed the title WIP: wait for listener with dummy rule [WIP] wait for listener with dummy rule Oct 19, 2017
@matt-deboer matt-deboer changed the title [WIP] wait for listener with dummy rule [WIP] Rolling Blue-Green Deployments for AWS-LB Oct 19, 2017
@matt-deboer matt-deboer changed the title [WIP] Rolling Blue-Green Deployments for AWS-LB Rolling Blue-Green Deployments for AWS-LB Oct 20, 2017
@matt-deboer matt-deboer changed the title Rolling Blue-Green Deployments for AWS-LB Rolling Blue-Green Deployments for AWS-LB (ALB/NLB) Oct 20, 2017
@matt-deboer matt-deboer changed the title Rolling Blue-Green Deployments for AWS-LB (ALB/NLB) Rolling Blue-Green Deployments for AWS-LB (ALB/*NLB) Oct 23, 2017
@radeksimko radeksimko added enhancement Requests to existing resources that expand the functionality or scope. and removed bug Addresses a defect in current functionality. labels Oct 27, 2017
@radeksimko radeksimko added the size/XL Managed by automation to categorize the size of a PR. label Nov 15, 2017
@bflad bflad added the service/elbv2 Issues and PRs that pertain to the elbv2 service. label Jan 28, 2018
@bacoboy
Copy link

bacoboy commented Feb 14, 2018

I can't tell if there is anything left to be done on this?

@bflad bflad added this to the v1.12.0 milestone Mar 8, 2018
@bflad bflad modified the milestones: v1.12.0, v1.13.0, v1.14.0 Mar 23, 2018
@bflad bflad removed this from the v1.14.0 milestone Apr 6, 2018
@bflad bflad added the thinking label Apr 6, 2018
@@ -61,6 +72,60 @@ The following attributes are exported in addition to the arguments listed above:
* `id` - The ARN of the listener (matches `arn`)
* `arn` - The ARN of the listener (matches `id`)

## Waiting for Capacity

A newly-created Target Group is initially empty, with it's eventual members usually
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • s/it's/its/

## Waiting for Capacity

A newly-created Target Group is initially empty, with it's eventual members usually
composed of ASG instances that initialize as the ASG comes up to it's desired
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • s/it's/its/

}

// Poll causes the poller to continuously test the output of
// it's configured url with the specified number of concurrent
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • s/it's/its/
  • s/url/URL/


errCount, err := p.waitForURLReady()
if err != nil {
return fmt.Errorf("Timed out waiting for url to become initially ready; %v", err)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • s/url/URL/

return nil
}

// waitForURLReady continuously pings the configured url until
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • s/url/URL/


// Complete stops the poller's clients and returns
// an aggregate error describing any of the errors
// which occurred while polling the configured url
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • s/url/URL/
  • Punctuate this sentence.

}

// rollingVersionPoller exists to continuously ping a particular
// url, testing the string result returned, and treating it the 'version' for
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • s/url/URL/

// after that, the endpoint is allowed to return one other value, considered the
// 'green' version--once the endpoint has returned a value for the 'green' version,
// it will be considered an error if the endpoint returns any other value.
//
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Remove blank comment line.

@markwellis
Copy link

Is this PR going to be merged? Is there another way to do this without it being merged? Thanks

@aeschright aeschright requested a review from a team June 25, 2019 18:42
@markwellis
Copy link

@aeschright @seh any chance this can be looked at? I really will make my life so much better.

Thanks

Base automatically changed from master to main January 23, 2021 00:55
@breathingdust breathingdust requested a review from a team as a code owner January 23, 2021 00:55
@kaplanben
Copy link

any chance this will get merged any time soon? It's causing production errors on apply..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/elbv2 Issues and PRs that pertain to the elbv2 service. size/XL Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants