Skip to content

Commit 0ac28e3

Browse files
hughcapetFxKu
andauthored
Do not set aws-load-balancer-connection-idle-timeout by default (#3054)
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
1 parent 27c969d commit 0ac28e3

6 files changed

Lines changed: 14 additions & 51 deletions

File tree

docs/administrator.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -891,15 +891,13 @@ cluster manifest. In the case any of these variables are omitted from the
891891
manifest, the operator configuration settings `enable_master_load_balancer` and
892892
`enable_replica_load_balancer` apply. Note that the operator settings affect
893893
all Postgresql services running in all namespaces watched by the operator.
894-
If load balancing is enabled two default annotations will be applied to its
895-
services:
894+
If load balancing is enabled the following default annotation will be applied to
895+
its services:
896896

897897
- `external-dns.alpha.kubernetes.io/hostname` with the value defined by the
898898
operator configs `master_dns_name_format` and `replica_dns_name_format`.
899899
This value can't be overwritten. If any changing in its value is needed, it
900900
MUST be done changing the DNS format operator config parameters; and
901-
- `service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout` with
902-
a default value of "3600".
903901

904902
There are multiple options to specify service annotations that will be merged
905903
with each other and override in the following order (where latter take

e2e/tests/test_e2e.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,14 +724,12 @@ def test_enable_disable_connection_pooler(self):
724724

725725
master_annotations = {
726726
"external-dns.alpha.kubernetes.io/hostname": "acid-minimal-cluster-pooler.default.db.example.com",
727-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
728727
}
729728
self.eventuallyTrue(lambda: k8s.check_service_annotations(
730729
master_pooler_label+","+pooler_label, master_annotations), "Wrong annotations")
731730

732731
replica_annotations = {
733732
"external-dns.alpha.kubernetes.io/hostname": "acid-minimal-cluster-pooler-repl.default.db.example.com",
734-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
735733
}
736734
self.eventuallyTrue(lambda: k8s.check_service_annotations(
737735
replica_pooler_label+","+pooler_label, replica_annotations), "Wrong annotations")

pkg/cluster/cluster_test.go

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,7 @@ func TestServiceAnnotations(t *testing.T) {
680680
operatorAnnotations: make(map[string]string),
681681
serviceAnnotations: make(map[string]string),
682682
expect: map[string]string{
683-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
684-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
683+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
685684
},
686685
},
687686
{
@@ -702,8 +701,7 @@ func TestServiceAnnotations(t *testing.T) {
702701
operatorAnnotations: make(map[string]string),
703702
serviceAnnotations: make(map[string]string),
704703
expect: map[string]string{
705-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
706-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
704+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
707705
},
708706
},
709707
{
@@ -714,8 +712,7 @@ func TestServiceAnnotations(t *testing.T) {
714712
operatorAnnotations: make(map[string]string),
715713
serviceAnnotations: map[string]string{"foo": "bar"},
716714
expect: map[string]string{
717-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
718-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
715+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
719716
"foo": "bar",
720717
},
721718
},
@@ -737,8 +734,7 @@ func TestServiceAnnotations(t *testing.T) {
737734
operatorAnnotations: map[string]string{"foo": "bar"},
738735
serviceAnnotations: make(map[string]string),
739736
expect: map[string]string{
740-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
741-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
737+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
742738
"foo": "bar",
743739
},
744740
},
@@ -780,8 +776,7 @@ func TestServiceAnnotations(t *testing.T) {
780776
"external-dns.alpha.kubernetes.io/hostname": "wrong.external-dns-name.example.com",
781777
},
782778
expect: map[string]string{
783-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
784-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
779+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
785780
},
786781
},
787782
{
@@ -792,8 +787,7 @@ func TestServiceAnnotations(t *testing.T) {
792787
serviceAnnotations: make(map[string]string),
793788
operatorAnnotations: make(map[string]string),
794789
expect: map[string]string{
795-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
796-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
790+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg.test.db.example.com,test-stg.acid.db.example.com",
797791
},
798792
},
799793
{
@@ -835,8 +829,7 @@ func TestServiceAnnotations(t *testing.T) {
835829
operatorAnnotations: make(map[string]string),
836830
serviceAnnotations: make(map[string]string),
837831
expect: map[string]string{
838-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
839-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
832+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
840833
},
841834
},
842835
{
@@ -857,8 +850,7 @@ func TestServiceAnnotations(t *testing.T) {
857850
operatorAnnotations: make(map[string]string),
858851
serviceAnnotations: make(map[string]string),
859852
expect: map[string]string{
860-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
861-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
853+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
862854
},
863855
},
864856
{
@@ -869,8 +861,7 @@ func TestServiceAnnotations(t *testing.T) {
869861
operatorAnnotations: make(map[string]string),
870862
serviceAnnotations: map[string]string{"foo": "bar"},
871863
expect: map[string]string{
872-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
873-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
864+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
874865
"foo": "bar",
875866
},
876867
},
@@ -892,8 +883,7 @@ func TestServiceAnnotations(t *testing.T) {
892883
operatorAnnotations: map[string]string{"foo": "bar"},
893884
serviceAnnotations: make(map[string]string),
894885
expect: map[string]string{
895-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
896-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
886+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
897887
"foo": "bar",
898888
},
899889
},
@@ -935,8 +925,7 @@ func TestServiceAnnotations(t *testing.T) {
935925
"external-dns.alpha.kubernetes.io/hostname": "wrong.external-dns-name.example.com",
936926
},
937927
expect: map[string]string{
938-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
939-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
928+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
940929
},
941930
},
942931
{
@@ -947,8 +936,7 @@ func TestServiceAnnotations(t *testing.T) {
947936
serviceAnnotations: make(map[string]string),
948937
operatorAnnotations: make(map[string]string),
949938
expect: map[string]string{
950-
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
951-
"service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout": "3600",
939+
"external-dns.alpha.kubernetes.io/hostname": "acid-test-stg-repl.test.db.example.com,test-stg-repl.acid.db.example.com",
952940
},
953941
},
954942
{
@@ -1377,7 +1365,6 @@ func TestCompareServices(t *testing.T) {
13771365
serviceWithOwnerReference := newService(
13781366
map[string]string{
13791367
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1380-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
13811368
},
13821369
v1.ServiceTypeClusterIP,
13831370
[]string{"128.141.0.0/16", "137.138.0.0/16"},
@@ -1406,15 +1393,13 @@ func TestCompareServices(t *testing.T) {
14061393
current: newService(
14071394
map[string]string{
14081395
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1409-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
14101396
},
14111397
v1.ServiceTypeClusterIP,
14121398
[]string{"128.141.0.0/16", "137.138.0.0/16"},
14131399
nil, defaultPolicy),
14141400
new: newService(
14151401
map[string]string{
14161402
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1417-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
14181403
},
14191404
v1.ServiceTypeClusterIP,
14201405
[]string{"128.141.0.0/16", "137.138.0.0/16"},
@@ -1426,15 +1411,13 @@ func TestCompareServices(t *testing.T) {
14261411
current: newService(
14271412
map[string]string{
14281413
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1429-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
14301414
},
14311415
v1.ServiceTypeClusterIP,
14321416
[]string{"128.141.0.0/16", "137.138.0.0/16"},
14331417
nil, defaultPolicy),
14341418
new: newService(
14351419
map[string]string{
14361420
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1437-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
14381421
},
14391422
v1.ServiceTypeLoadBalancer,
14401423
[]string{"128.141.0.0/16", "137.138.0.0/16"},
@@ -1447,15 +1430,13 @@ func TestCompareServices(t *testing.T) {
14471430
current: newService(
14481431
map[string]string{
14491432
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1450-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
14511433
},
14521434
v1.ServiceTypeLoadBalancer,
14531435
[]string{"128.141.0.0/16", "137.138.0.0/16"},
14541436
nil, defaultPolicy),
14551437
new: newService(
14561438
map[string]string{
14571439
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1458-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
14591440
},
14601441
v1.ServiceTypeLoadBalancer,
14611442
[]string{"185.249.56.0/22"},
@@ -1468,15 +1449,13 @@ func TestCompareServices(t *testing.T) {
14681449
current: newService(
14691450
map[string]string{
14701451
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1471-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
14721452
},
14731453
v1.ServiceTypeLoadBalancer,
14741454
[]string{"128.141.0.0/16", "137.138.0.0/16"},
14751455
nil, defaultPolicy),
14761456
new: newService(
14771457
map[string]string{
14781458
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1479-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
14801459
},
14811460
v1.ServiceTypeLoadBalancer,
14821461
[]string{},
@@ -1489,7 +1468,6 @@ func TestCompareServices(t *testing.T) {
14891468
current: newService(
14901469
map[string]string{
14911470
constants.ZalandoDNSNameAnnotation: "clstr.acid.zalan.do",
1492-
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
14931471
},
14941472
v1.ServiceTypeClusterIP,
14951473
[]string{"128.141.0.0/16", "137.138.0.0/16"},

pkg/cluster/connection_pooler.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,6 @@ func (c *Cluster) generatePoolerServiceAnnotations(role PostgresRole, spec *acid
533533
annotations := c.getCustomServiceAnnotations(role, spec)
534534

535535
if c.shouldCreateLoadBalancerForPoolerService(role, spec) {
536-
// set ELB Timeout annotation with default value
537-
if _, ok := annotations[constants.ElbTimeoutAnnotationName]; !ok {
538-
annotations[constants.ElbTimeoutAnnotationName] = constants.ElbTimeoutAnnotationValue
539-
}
540536
// -repl suffix will be added by replicaDNSName
541537
clusterNameWithPoolerSuffix := c.connectionPoolerName(Master)
542538
if role == Master {

pkg/cluster/k8sres.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,11 +2029,6 @@ func (c *Cluster) generateServiceAnnotations(role PostgresRole, spec *acidv1.Pos
20292029
if c.shouldCreateLoadBalancerForService(role, spec) {
20302030
dnsName := c.dnsName(role)
20312031

2032-
// Just set ELB Timeout annotation with default value, if it does not
2033-
// have a custom value
2034-
if _, ok := annotations[constants.ElbTimeoutAnnotationName]; !ok {
2035-
annotations[constants.ElbTimeoutAnnotationName] = constants.ElbTimeoutAnnotationValue
2036-
}
20372032
// External DNS name annotation is not customizable
20382033
annotations[constants.ZalandoDNSNameAnnotation] = dnsName
20392034
}

pkg/util/constants/annotations.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package constants
33
// Names and values in Kubernetes annotation for services, statefulsets and volumes
44
const (
55
ZalandoDNSNameAnnotation = "external-dns.alpha.kubernetes.io/hostname"
6-
ElbTimeoutAnnotationName = "service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout"
7-
ElbTimeoutAnnotationValue = "3600"
86
KubeIAmAnnotation = "iam.amazonaws.com/role"
97
VolumeStorateProvisionerAnnotation = "pv.kubernetes.io/provisioned-by"
108
PostgresqlControllerAnnotationKey = "acid.zalan.do/controller"

0 commit comments

Comments
 (0)