Repository: kumahq/kuma
Pull request #2434 (2021-07-26 15:46:52)

fix(kuma-cp) set better keep-alive for bootstrap (backport #2432)
This is an automatic backport of pull request #2432 done by [Mergify](https://mergify.io).


---


<details>
<summary>Mergify commands and options</summary>

<br />

More conditions and actions can be found in the [documentation](https://docs.mergify.io/).

You can also trigger Mergify actions by commenting on this pull request:

- `@Mergifyio refresh` will re-evaluate the rules
- `@Mergifyio rebase` will rebase this PR on its base branch
- `@Mergifyio update` will merge the base branch into this PR
- `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch

Additionally, on Mergify [dashboard](https://dashboard.mergify.io/) you can:

- look at your merge queues
- generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.io/
</details>



Patch:
diff --git a/pkg/xds/bootstrap/template_v3.go b/pkg/xds/bootstrap/template_v3.go
index 02435da2c..5545d6253 100644
--- a/pkg/xds/bootstrap/template_v3.go
+++ b/pkg/xds/bootstrap/template_v3.go
@@ -159,7 +159,10 @@ static_resources:
     upstream_connection_options:
       # configure a TCP keep-alive to detect and reconnect to the admin
       # server in the event of a TCP socket half open connection
-      tcp_keepalive: {}
+      tcp_keepalive:
+        keepalive_probes: 3
+        keepalive_time: 10
+        keepalive_interval: 10
     load_assignment:
       cluster_name: access_log_sink
       endpoints:
@@ -176,7 +179,10 @@ static_resources:
     upstream_connection_options:
       # configure a TCP keep-alive to detect and reconnect to the admin
       # server in the event of a TCP socket half open connection
-      tcp_keepalive: {}
+      tcp_keepalive:
+        keepalive_probes: 3
+        keepalive_time: 10
+        keepalive_interval: 10
     load_assignment:
       cluster_name: ads_cluster
       endpoints:


Test patch:
diff --git a/pkg/xds/bootstrap/testdata/bootstrap.k8s.golden.yaml b/pkg/xds/bootstrap/testdata/bootstrap.k8s.golden.yaml
index 4c8916154..6dabf1534 100644
--- a/pkg/xds/bootstrap/testdata/bootstrap.k8s.golden.yaml
+++ b/pkg/xds/bootstrap/testdata/bootstrap.k8s.golden.yaml
@@ -80,7 +80,10 @@ staticResources:
     name: access_log_sink
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
   - connectTimeout: 1s
     http2ProtocolOptions: {}
     loadAssignment:
@@ -108,7 +111,10 @@ staticResources:
         sni: localhost
     type: STRICT_DNS
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
 statsConfig:
   statsTags:
   - regex: ^grpc\.((.+)\.)
diff --git a/pkg/xds/bootstrap/testdata/bootstrap.overridden.golden.yaml b/pkg/xds/bootstrap/testdata/bootstrap.overridden.golden.yaml
index 2bdce08e3..707448b90 100644
--- a/pkg/xds/bootstrap/testdata/bootstrap.overridden.golden.yaml
+++ b/pkg/xds/bootstrap/testdata/bootstrap.overridden.golden.yaml
@@ -87,7 +87,10 @@ staticResources:
     name: access_log_sink
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
   - connectTimeout: 1s
     http2ProtocolOptions: {}
     loadAssignment:
@@ -115,7 +118,10 @@ staticResources:
         sni: localhost
     type: STRICT_DNS
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
 statsConfig:
   statsTags:
   - regex: ^grpc\.((.+)\.)
diff --git a/pkg/xds/bootstrap/testdata/bootstrap.universal.golden.yaml b/pkg/xds/bootstrap/testdata/bootstrap.universal.golden.yaml
index 14b3eaddc..7a1036e33 100644
--- a/pkg/xds/bootstrap/testdata/bootstrap.universal.golden.yaml
+++ b/pkg/xds/bootstrap/testdata/bootstrap.universal.golden.yaml
@@ -80,7 +80,10 @@ staticResources:
     name: access_log_sink
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
   - connectTimeout: 1s
     http2ProtocolOptions: {}
     loadAssignment:
@@ -108,7 +111,10 @@ staticResources:
         sni: localhost
     type: STRICT_DNS
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
 statsConfig:
   statsTags:
   - regex: ^grpc\.((.+)\.)
diff --git a/pkg/xds/bootstrap/testdata/generator.custom-config-minimal-request.golden.yaml b/pkg/xds/bootstrap/testdata/generator.custom-config-minimal-request.golden.yaml
index ceee99e20..22acd0280 100644
--- a/pkg/xds/bootstrap/testdata/generator.custom-config-minimal-request.golden.yaml
+++ b/pkg/xds/bootstrap/testdata/generator.custom-config-minimal-request.golden.yaml
@@ -60,7 +60,10 @@ staticResources:
     name: access_log_sink
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
   - connectTimeout: 2s
     http2ProtocolOptions: {}
     loadAssignment:
@@ -88,7 +91,10 @@ staticResources:
         sni: localhost
     type: STRICT_DNS
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
 statsConfig:
   statsTags:
   - regex: ^grpc\.((.+)\.)
diff --git a/pkg/xds/bootstrap/testdata/generator.custom-config.golden.yaml b/pkg/xds/bootstrap/testdata/generator.custom-config.golden.yaml
index 6fd8d99b4..d49543873 100644
--- a/pkg/xds/bootstrap/testdata/generator.custom-config.golden.yaml
+++ b/pkg/xds/bootstrap/testdata/generator.custom-config.golden.yaml
@@ -94,7 +94,10 @@ staticResources:
     name: access_log_sink
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
   - connectTimeout: 2s
     http2ProtocolOptions: {}
     loadAssignment:
@@ -122,7 +125,10 @@ staticResources:
         sni: localhost
     type: STRICT_DNS
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
 statsConfig:
   statsTags:
   - regex: ^grpc\.((.+)\.)
diff --git a/pkg/xds/bootstrap/testdata/generator.default-config-minimal-request.golden.yaml b/pkg/xds/bootstrap/testdata/generator.default-config-minimal-request.golden.yaml
index 6324d5b8f..7950d50ff 100644
--- a/pkg/xds/bootstrap/testdata/generator.default-config-minimal-request.golden.yaml
+++ b/pkg/xds/bootstrap/testdata/generator.default-config-minimal-request.golden.yaml
@@ -53,7 +53,10 @@ staticResources:
     name: access_log_sink
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
   - connectTimeout: 1s
     http2ProtocolOptions: {}
     loadAssignment:
@@ -81,7 +84,10 @@ staticResources:
         sni: localhost
     type: STRICT_DNS
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
 statsConfig:
   statsTags:
   - regex: ^grpc\.((.+)\.)
diff --git a/pkg/xds/bootstrap/testdata/generator.default-config.golden.yaml b/pkg/xds/bootstrap/testdata/generator.default-config.golden.yaml
index 746680dc8..653a9a6b0 100644
--- a/pkg/xds/bootstrap/testdata/generator.default-config.golden.yaml
+++ b/pkg/xds/bootstrap/testdata/generator.default-config.golden.yaml
@@ -69,7 +69,10 @@ staticResources:
     name: access_log_sink
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
   - connectTimeout: 1s
     http2ProtocolOptions: {}
     loadAssignment:
@@ -97,7 +100,10 @@ staticResources:
         sni: localhost
     type: STRICT_DNS
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
 statsConfig:
   statsTags:
   - regex: ^grpc\.((.+)\.)
diff --git a/pkg/xds/bootstrap/testdata/generator.default-config.kubernetes.golden.yaml b/pkg/xds/bootstrap/testdata/generator.default-config.kubernetes.golden.yaml
index f33298006..6e3875e8e 100644
--- a/pkg/xds/bootstrap/testdata/generator.default-config.kubernetes.golden.yaml
+++ b/pkg/xds/bootstrap/testdata/generator.default-config.kubernetes.golden.yaml
@@ -67,7 +67,10 @@ staticResources:
     name: access_log_sink
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
   - connectTimeout: 1s
     http2ProtocolOptions: {}
     loadAssignment:
@@ -95,7 +98,10 @@ staticResources:
         sni: localhost
     type: STRICT_DNS
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
 statsConfig:
   statsTags:
   - regex: ^grpc\.((.+)\.)
diff --git a/pkg/xds/bootstrap/testdata/generator.default-config.kubernetes.ipv6.golden.yaml b/pkg/xds/bootstrap/testdata/generator.default-config.kubernetes.ipv6.golden.yaml
index 8c9403bf9..f869d6bac 100644
--- a/pkg/xds/bootstrap/testdata/generator.default-config.kubernetes.ipv6.golden.yaml
+++ b/pkg/xds/bootstrap/testdata/generator.default-config.kubernetes.ipv6.golden.yaml
@@ -67,7 +67,10 @@ staticResources:
     name: access_log_sink
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
   - connectTimeout: 1s
     http2ProtocolOptions: {}
     loadAssignment:
@@ -95,7 +98,10 @@ staticResources:
         sni: fd00:a123::1
     type: STATIC
     upstreamConnectionOptions:
-      tcpKeepalive: {}
+      tcpKeepalive:
+        keepaliveInterval: 10
+        keepaliveProbes: 3
+        keepaliveTime: 10
 statsConfig:
   statsTags:
   - regex: ^grpc\.((.+)\.)