Skip to content

Commit 5edc83f

Browse files
committed
add feature gate ServiceHealthCheckTimeout
allows people to set old behavior
1 parent b3b374f commit 5edc83f

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

docs/deploy/configurations.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ This document covers configuration of the AWS Load Balancer controller
33

44
!!!warning "limitation"
55
The v2.0.0+ version of AWSLoadBalancerController currently only support one controller deployment(with one or multiple replicas) per cluster.
6-
6+
77
The AWSLoadBalancerController assumes it's the solo owner of worker node security group rules with `elbv2.k8s.aws/targetGroupBinding=shared` description, running multiple controller deployment will cause these controllers compete with each other updating worker node security group rules.
8-
8+
99
We will remove this limitation in future versions: [tracking issue](https://github.com/kubernetes-sigs/aws-load-balancer-controller/issues/2185)
1010

1111
## AWS API Access
@@ -158,3 +158,4 @@ They are a set of kye=value pairs that describe AWS load balance controller feat
158158
| EnableServiceController | string | true | Toggles support for `Service` type resources. |
159159
| EnableIPTargetType | string | true | Used to toggle support for target-type `ip` across `Ingress` and `Service` type resources. |
160160
| SubnetsClusterTagCheck | string | true | Enable or disable the check for `kubernetes.io/cluster/${cluster-name}` during subnet auto-discovery |
161+
| ServiceHealthCheckTimeout | string | true | Enable or disable the use of `service.beta.kubernetes.io/aws-load-balancer-healthcheck-timeout` for `Service` type resources (NLB) |

pkg/config/feature_gates.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package config
22

33
import (
44
"fmt"
5-
"github.com/spf13/pflag"
65
"strconv"
76
"strings"
7+
8+
"github.com/spf13/pflag"
89
)
910

1011
type Feature string
@@ -17,6 +18,7 @@ const (
1718
EnableServiceController Feature = "EnableServiceController"
1819
EnableIPTargetType Feature = "EnableIPTargetType"
1920
SubnetsClusterTagCheck Feature = "SubnetsClusterTagCheck"
21+
ServiceHealthCheckTimeout Feature = "ServiceHealthCheckTimeout"
2022
)
2123

2224
type FeatureGates interface {
@@ -51,6 +53,7 @@ func NewFeatureGates() FeatureGates {
5153
EnableServiceController: true,
5254
EnableIPTargetType: true,
5355
SubnetsClusterTagCheck: true,
56+
ServiceHealthCheckTimeout: true,
5457
},
5558
}
5659
}

pkg/service/model_build_target_group.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"k8s.io/apimachinery/pkg/util/intstr"
1919
elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1"
2020
"sigs.k8s.io/aws-load-balancer-controller/pkg/annotations"
21+
"sigs.k8s.io/aws-load-balancer-controller/pkg/config"
2122
"sigs.k8s.io/aws-load-balancer-controller/pkg/k8s"
2223
elbv2model "sigs.k8s.io/aws-load-balancer-controller/pkg/model/elbv2"
2324
"sigs.k8s.io/aws-load-balancer-controller/pkg/networking"
@@ -319,6 +320,9 @@ func (t *defaultModelBuildTask) buildTargetGroupHealthCheckIntervalSeconds(_ con
319320
}
320321

321322
func (t *defaultModelBuildTask) buildTargetGroupHealthCheckTimeoutSeconds(_ context.Context, defaultHealthCheckTimeout int64) (int64, error) {
323+
if !t.featureGates.Enabled(config.ServiceHealthCheckTimeout) {
324+
return 0, nil
325+
}
322326
timeoutSeconds := defaultHealthCheckTimeout
323327
if _, err := t.annotationParser.ParseInt64Annotation(annotations.SvcLBSuffixHCTimeout, &timeoutSeconds, t.service.Annotations); err != nil {
324328
return 0, err

pkg/service/model_build_target_group_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"k8s.io/apimachinery/pkg/util/intstr"
1616
elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1"
1717
"sigs.k8s.io/aws-load-balancer-controller/pkg/annotations"
18+
"sigs.k8s.io/aws-load-balancer-controller/pkg/config"
1819
"sigs.k8s.io/aws-load-balancer-controller/pkg/model/elbv2"
1920
)
2021

@@ -351,6 +352,7 @@ func Test_defaultModelBuilderTask_buildTargetHealthCheck(t *testing.T) {
351352
builder := &defaultModelBuildTask{
352353
service: tt.svc,
353354
annotationParser: parser,
355+
featureGates: config.NewFeatureGates(),
354356
defaultAccessLogsS3Bucket: "",
355357
defaultAccessLogsS3Prefix: "",
356358
defaultLoadBalancingCrossZoneEnabled: false,

0 commit comments

Comments
 (0)