Merge pull request #14473 from hakman/aws_healthcheck_interval

aws: Set the target group health check interval to 10s
This commit is contained in:
Kubernetes Prow Robot 2022-10-29 15:34:42 -07:00 committed by GitHub
commit c066b44934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 0 deletions

View File

@ -278,6 +278,7 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error {
Tags: tcpGroupTags,
Protocol: fi.String("TCP"),
Port: fi.Int64(443),
Interval: fi.Int64(10),
HealthyThreshold: fi.Int64(2),
UnhealthyThreshold: fi.Int64(2),
Shared: fi.Bool(false),
@ -300,6 +301,7 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error {
Tags: tlsGroupTags,
Protocol: fi.String("TLS"),
Port: fi.Int64(443),
Interval: fi.Int64(10),
HealthyThreshold: fi.Int64(2),
UnhealthyThreshold: fi.Int64(2),
Shared: fi.Bool(false),

View File

@ -556,6 +556,7 @@ resource "aws_lb_listener" "api-complex-example-com-8443" {
resource "aws_lb_target_group" "tcp-complex-example-com-vpjolq" {
health_check {
healthy_threshold = 2
interval = 10
protocol = "TCP"
unhealthy_threshold = 2
}
@ -575,6 +576,7 @@ resource "aws_lb_target_group" "tcp-complex-example-com-vpjolq" {
resource "aws_lb_target_group" "tls-complex-example-com-5nursn" {
health_check {
healthy_threshold = 2
interval = 10
protocol = "TCP"
unhealthy_threshold = 2
}

View File

@ -493,6 +493,7 @@ resource "aws_lb_listener" "api-minimal-ipv6-example-com-443" {
resource "aws_lb_target_group" "tcp-minimal-ipv6-example--bne5ih" {
health_check {
healthy_threshold = 2
interval = 10
protocol = "TCP"
unhealthy_threshold = 2
}

View File

@ -505,6 +505,7 @@ resource "aws_lb_listener" "api-minimal-ipv6-example-com-443" {
resource "aws_lb_target_group" "tcp-minimal-ipv6-example--bne5ih" {
health_check {
healthy_threshold = 2
interval = 10
protocol = "TCP"
unhealthy_threshold = 2
}

View File

@ -556,6 +556,7 @@ resource "aws_lb_listener" "api-minimal-ipv6-example-com-443" {
resource "aws_lb_target_group" "tcp-minimal-ipv6-example--bne5ih" {
health_check {
healthy_threshold = 2
interval = 10
protocol = "TCP"
unhealthy_threshold = 2
}

View File

@ -505,6 +505,7 @@ resource "aws_lb_listener" "api-minimal-ipv6-example-com-443" {
resource "aws_lb_target_group" "tcp-minimal-ipv6-example--bne5ih" {
health_check {
healthy_threshold = 2
interval = 10
protocol = "TCP"
unhealthy_threshold = 2
}

View File

@ -45,6 +45,7 @@ type TargetGroup struct {
// Shared is set if this is an external LB (one we don't create or own)
Shared *bool
Interval *int64
HealthyThreshold *int64
UnhealthyThreshold *int64
}
@ -88,10 +89,14 @@ func (e *TargetGroup) Find(c *fi.Context) (*TargetGroup, error) {
Port: tg.Port,
Protocol: tg.Protocol,
ARN: tg.TargetGroupArn,
Interval: tg.HealthCheckIntervalSeconds,
HealthyThreshold: tg.HealthyThresholdCount,
UnhealthyThreshold: tg.UnhealthyThresholdCount,
VPC: &VPC{ID: tg.VpcId},
}
// Interval cannot be changed after TargetGroup creation
e.Interval = actual.Interval
e.ARN = tg.TargetGroupArn
tagsResp, err := cloud.ELBV2().DescribeTags(&elbv2.DescribeTagsInput{
@ -215,6 +220,7 @@ type terraformTargetGroup struct {
}
type terraformTargetGroupHealthCheck struct {
Interval int64 `cty:"interval"`
HealthyThreshold int64 `cty:"healthy_threshold"`
UnhealthyThreshold int64 `cty:"unhealthy_threshold"`
Protocol string `cty:"protocol"`
@ -237,6 +243,7 @@ func (_ *TargetGroup) RenderTerraform(t *terraform.TerraformTarget, a, e, change
VPCID: *e.VPC.TerraformLink(),
Tags: e.Tags,
HealthCheck: terraformTargetGroupHealthCheck{
Interval: *e.Interval,
HealthyThreshold: *e.HealthyThreshold,
UnhealthyThreshold: *e.UnhealthyThreshold,
Protocol: elbv2.ProtocolEnumTcp,