Repository: kumahq/kuma (Go)

Issue:
Inbound cluster has defaults timeout even when there is no default policy
### What happened?

When a user upgrades to version 2.9.0 without a default policy, Kuma applies default timeouts. Previously, if no default policy was set, no timeouts were applied. However, since 2.9, default timeouts are enforced, which could potentially cause issues. 

Change:
https://github.com/kumahq/kuma/blob/master/pkg/plugins/policies/meshtimeout/plugin/v1alpha1/plugin.go#L96


Discussion:

Patch:
diff --git a/pkg/plugins/policies/meshtimeout/plugin/v1alpha1/plugin.go b/pkg/plugins/policies/meshtimeout/plugin/v1alpha1/plugin.go
index e55055cfc4b1..f4651dbc916c 100644
--- a/pkg/plugins/policies/meshtimeout/plugin/v1alpha1/plugin.go
+++ b/pkg/plugins/policies/meshtimeout/plugin/v1alpha1/plugin.go
@@ -93,7 +93,7 @@ func applyToInbounds(fromRules core_rules.FromRules, inboundListeners map[core_r
 		protocol := core_mesh.ParseProtocol(inbound.GetProtocol())
 		conf := getConf(fromRules.Rules[listenerKey], core_rules.MeshSubset())
 		if conf == nil {
-			conf = &plugin_xds.DefaultTimeoutConf
+			continue
 		}
 		configurer := plugin_xds.ListenerConfigurer{
 			Conf:     *conf,


Test patch:
diff --git a/pkg/plugins/policies/meshtimeout/plugin/testdata/basic_without_defaults_inbound_cluster.golden.yaml b/pkg/plugins/policies/meshtimeout/plugin/testdata/basic_without_defaults_inbound_cluster.golden.yaml
new file mode 100644
index 000000000000..21bbf819ffa4
--- /dev/null
+++ b/pkg/plugins/policies/meshtimeout/plugin/testdata/basic_without_defaults_inbound_cluster.golden.yaml
@@ -0,0 +1,1 @@
+name: localhost:8080
diff --git a/pkg/plugins/policies/meshtimeout/plugin/testdata/basic_without_defaults_inbound_listener.golden.yaml b/pkg/plugins/policies/meshtimeout/plugin/testdata/basic_without_defaults_inbound_listener.golden.yaml
new file mode 100644
index 000000000000..40e713880159
--- /dev/null
+++ b/pkg/plugins/policies/meshtimeout/plugin/testdata/basic_without_defaults_inbound_listener.golden.yaml
@@ -0,0 +1,32 @@
+address:
+  socketAddress:
+    address: 127.0.0.1
+    portValue: 80
+enableReusePort: false
+filterChains:
+- filters:
+  - name: envoy.filters.network.http_connection_manager
+    typedConfig:
+      '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
+      httpFilters:
+      - name: envoy.filters.http.router
+        typedConfig:
+          '@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
+      routeConfig:
+        name: inbound:backend
+        requestHeadersToRemove:
+        - x-kuma-tags
+        validateClusters: false
+        virtualHosts:
+        - domains:
+          - '*'
+          name: backend
+          routes:
+          - match:
+              prefix: /
+            route:
+              cluster: backend
+              timeout: 0s
+      statPrefix: inbound_127_0_0_1_80
+name: inbound:127.0.0.1:80
+trafficDirection: INBOUND
diff --git a/pkg/plugins/policies/meshtimeout/plugin/v1alpha1/plugin_test.go b/pkg/plugins/policies/meshtimeout/plugin/v1alpha1/plugin_test.go
index 6ac64274df05..631ab7253f29 100644
--- a/pkg/plugins/policies/meshtimeout/plugin/v1alpha1/plugin_test.go
+++ b/pkg/plugins/policies/meshtimeout/plugin/v1alpha1/plugin_test.go
@@ -247,6 +247,30 @@ var _ = Describe("MeshTimeout", func() {
 			expectedClusters:  []string{"basic_inbound_cluster.golden.yaml"},
 			expectedListeners: []string{"basic_inbound_listener.golden.yaml"},
 		}),
+		Entry("basic inbound route without defaults", sidecarTestCase{
+			resources: []core_xds.Resource{
+				{
+					Name:     "inbound",
+					Origin:   generator.OriginInbound,
+					Resource: httpInboundListenerWith(),
+				},
+				{
+					Name:     "inbound",
+					Origin:   generator.OriginInbound,
+					Resource: test_xds.ClusterWithName(fmt.Sprintf("localhost:%d", builders.FirstInboundServicePort)),
+				},
+			},
+			fromRules: core_rules.FromRules{
+				Rules: map[core_rules.InboundListener]core_rules.Rules{
+					{
+						Address: "127.0.0.1",
+						Port:    80,
+					}: []*core_rules.Rule{},
+				},
+			},
+			expectedClusters:  []string{"basic_without_defaults_inbound_cluster.golden.yaml"},
+			expectedListeners: []string{"basic_without_defaults_inbound_listener.golden.yaml"},
+		}),
 		Entry("outbound with defaults when http conf missing", sidecarTestCase{
 			resources: []core_xds.Resource{
 				{