Skip to content

Commit

Permalink
fix(gateway): npe without any timeout (#4548)
Browse files Browse the repository at this point in the history
fix(gateway): NPE when no timeouts

Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
(cherry picked from commit f24fdb1)
  • Loading branch information
michaelbeaumont authored and mergify[bot] committed Jul 4, 2022
1 parent 8776d42 commit 599ac9f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/plugins/runtime/gateway/cluster_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,13 @@ func newClusterBuilder(
protocol core_mesh.Protocol,
dest *route.Destination,
) *clusters.ClusterBuilder {
var timeout *mesh_proto.Timeout_Conf
if timeoutResource := timeoutPolicyFor(dest); timeoutResource != nil {
timeout = timeoutResource.Spec.GetConf()
}

builder := clusters.NewClusterBuilder(version).Configure(
clusters.Timeout(timeoutPolicyFor(dest).Spec.GetConf(), protocol),
clusters.Timeout(timeout, protocol),
clusters.CircuitBreaker(circuitBreakerPolicyFor(dest)),
clusters.OutlierDetection(circuitBreakerPolicyFor(dest)),
clusters.HealthCheck(protocol, healthCheckPolicyFor(dest)),
Expand Down

0 comments on commit 599ac9f

Please sign in to comment.