Skip to content

Commit

Permalink
envoy/cds: set mandatory connect_timeout on synthetic cluster
Browse files Browse the repository at this point in the history
`connect_timeout` is mandatory for a cluster. Resolves
the error reported by Envoy when a synthetic cluster
is programmed.

Signed-off-by: Shashank Ram <shashr2204@gmail.com>
  • Loading branch information
shashankram committed Feb 16, 2021
1 parent 24edf3c commit 6cdd8a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/envoy/cds/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ func getSyntheticCluster(name string) *xds_cluster.Cluster {
ClusterDiscoveryType: &xds_cluster.Cluster_Type{
Type: xds_cluster.Cluster_STATIC,
},
LbPolicy: xds_cluster.Cluster_ROUND_ROBIN,
LbPolicy: xds_cluster.Cluster_ROUND_ROBIN,
ConnectTimeout: ptypes.DurationProto(clusterConnectTimeout),
}
}

Expand Down
11 changes: 11 additions & 0 deletions pkg/envoy/cds/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,14 @@ func TestGetLocalServiceCluster(t *testing.T) {
})
}
}

func TestGetSyntheticCluster(t *testing.T) {
assert := tassert.New(t)

actual := getSyntheticCluster("foo")
assert.NotNil(actual)
assert.Equal("foo", actual.Name)
assert.Equal(&xds_cluster.Cluster_Type{Type: xds_cluster.Cluster_STATIC}, actual.ClusterDiscoveryType)
assert.Equal(xds_cluster.Cluster_ROUND_ROBIN, actual.LbPolicy)
assert.Equal(ptypes.DurationProto(clusterConnectTimeout), actual.ConnectTimeout)
}

0 comments on commit 6cdd8a7

Please sign in to comment.