Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Feature: status reporting for ALB releases #1567

Merged
merged 3 commits into from
Jun 3, 2021
Merged

Conversation

izaaklauer
Copy link
Contributor

@izaaklauer izaaklauer commented Jun 2, 2021

This implements status reports for the aws alb releaser plugin. It waits briefly for the release's target group to finish initializing, then reports on the health of the targets.

A few caveats:

  • For applications that are slow to start (and most ec2 deployments), the initial status check will return unhealthy or partial.
  • I'm not looking at target group health. Currently not reporting on the state of the ALB, security group, DNS records, or any other resources at play during a release.
  • This assumes we only have one target group associated with each release. When we implement more complex deployment strategies that require having multiple target groups behind the same ALB, this will need to be re-thought.
  • Lambda function target groups have health checks disabled. Rather than present state UNKNOWN for all lambda releases, I'm mapping disabled to healthy. If that disabled state shows up in any other scenarios, we may need to revisit this.
  • I'm not nil-checking before dereferencing pointers returned by the aws api, in keeping with our existing patterns.

Tested with deployments from ec2 and lambda.

@@ -304,9 +315,145 @@ func (r *Releaser) Release(
return &Release{
Url: "http://" + hostname,
LoadBalancerArn: *lb.LoadBalancerArn,
TargetGroupArn: target.Arn,
Region: target.Region,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed the region to build the right client. Other plugins have this on their config. Not sure which pattern we prefer.

) (*sdk.StatusReport, error) {

if release.Region == "" {
log.Debug("Region is not available for this release. Unable to determine status.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a feeling that we might hit this case in the upgrade path, where someone upgrades a server then tries to promote a deployment that didn't encode the region?

Copy link
Contributor

Choose a reason for hiding this comment

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

This would be good to test, sounds like a correct assumption.


var health sdk.StatusReport_Health

switch *tgHealth.TargetHealth.State {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Potentially a dangerous deference, but we seem to do it in other places and it's ok.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe leave a note above the switch?

@izaaklauer izaaklauer changed the title Health reporting for ALB releases Feature: health reporting for ALB releases Jun 2, 2021
@izaaklauer izaaklauer changed the title Feature: health reporting for ALB releases Feature: status reporting for ALB releases Jun 2, 2021
Copy link
Contributor

@krantzinator krantzinator left a comment

Choose a reason for hiding this comment

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

I haven't fully tested this, but the basics look good.

builtin/aws/alb/plugin.proto Outdated Show resolved Hide resolved
builtin/aws/alb/releaser.go Outdated Show resolved Hide resolved
builtin/aws/alb/releaser.go Outdated Show resolved Hide resolved
builtin/aws/alb/releaser.go Outdated Show resolved Hide resolved
builtin/aws/alb/releaser.go Outdated Show resolved Hide resolved
builtin/aws/alb/releaser.go Outdated Show resolved Hide resolved
builtin/aws/alb/releaser.go Outdated Show resolved Hide resolved

var health sdk.StatusReport_Health

switch *tgHealth.TargetHealth.State {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe leave a note above the switch?

builtin/aws/alb/releaser.go Outdated Show resolved Hide resolved
Also some logic simplification, conforming to protobuf naming convention, and improved terminal UI.
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

Code looks good to me! 🎉

@briancain briancain added this to the 0.4.0 milestone Jun 2, 2021
@izaaklauer izaaklauer merged commit 0379721 into main Jun 3, 2021
@izaaklauer izaaklauer deleted the feature/aws-alb/status branch June 3, 2021 13:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants