Skip to content

Commit

Permalink
Widen the default retriable conditions. (knative#6368)
Browse files Browse the repository at this point in the history
* Widen the default retriable conditions.

We should follow this up by fixing
knative#6367 for real.

* Extract to variable 'retriableConditions'.

* Split join to multiple lines.
  • Loading branch information
Nghia Tran authored and knative-prow-robot committed Dec 28, 2019
1 parent 4146e3d commit 287f9e3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/reconciler/ingress/resources/virtual_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ import (
"knative.dev/serving/pkg/resources"
)

var retriableConditions = strings.Join([]string{
"5xx",
"connect-failure",
"refused-stream",
"cancelled",
"resource-exhausted",
"retriable-status-codes"}, ",")

// VirtualServiceNamespace gives the namespace of the child
// VirtualServices for a given Ingress.
func VirtualServiceNamespace(ing *v1alpha1.Ingress) string {
Expand Down Expand Up @@ -190,6 +198,8 @@ func makeVirtualServiceRoute(hosts sets.String, http *v1alpha1.HTTPIngressPath,
Route: weights,
Timeout: types.DurationProto(http.Timeout.Duration),
Retries: &istiov1alpha3.HTTPRetry{
// TODO(https://github.com/knative/serving/issues/6367): Allow customization of this.
RetryOn: retriableConditions,
Attempts: int32(http.Retries.Attempts),
PerTryTimeout: types.DurationProto(http.Retries.PerTryTimeout.Duration),
},
Expand Down
5 changes: 5 additions & 0 deletions pkg/reconciler/ingress/resources/virtual_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func TestMakeMeshVirtualServiceSpec_CorrectRoutes(t *testing.T) {
},
Timeout: types.DurationProto(defaultMaxRevisionTimeout),
Retries: &istiov1alpha3.HTTPRetry{
RetryOn: retriableConditions,
Attempts: int32(networking.DefaultRetryCount),
PerTryTimeout: types.DurationProto(defaultMaxRevisionTimeout),
},
Expand Down Expand Up @@ -443,6 +444,7 @@ func TestMakeIngressVirtualServiceSpec_CorrectRoutes(t *testing.T) {
},
Timeout: types.DurationProto(defaultMaxRevisionTimeout),
Retries: &istiov1alpha3.HTTPRetry{
RetryOn: retriableConditions,
Attempts: int32(networking.DefaultRetryCount),
PerTryTimeout: types.DurationProto(defaultMaxRevisionTimeout),
},
Expand Down Expand Up @@ -473,6 +475,7 @@ func TestMakeIngressVirtualServiceSpec_CorrectRoutes(t *testing.T) {
},
Timeout: types.DurationProto(defaultMaxRevisionTimeout),
Retries: &istiov1alpha3.HTTPRetry{
RetryOn: retriableConditions,
Attempts: int32(networking.DefaultRetryCount),
PerTryTimeout: types.DurationProto(defaultMaxRevisionTimeout),
},
Expand Down Expand Up @@ -525,6 +528,7 @@ func TestMakeVirtualServiceRoute_Vanilla(t *testing.T) {
}},
Timeout: types.DurationProto(defaultMaxRevisionTimeout),
Retries: &istiov1alpha3.HTTPRetry{
RetryOn: retriableConditions,
Attempts: int32(networking.DefaultRetryCount),
PerTryTimeout: types.DurationProto(defaultMaxRevisionTimeout),
},
Expand Down Expand Up @@ -582,6 +586,7 @@ func TestMakeVirtualServiceRoute_TwoTargets(t *testing.T) {
}},
Timeout: types.DurationProto(defaultMaxRevisionTimeout),
Retries: &istiov1alpha3.HTTPRetry{
RetryOn: retriableConditions,
Attempts: int32(networking.DefaultRetryCount),
PerTryTimeout: types.DurationProto(defaultMaxRevisionTimeout),
},
Expand Down

0 comments on commit 287f9e3

Please sign in to comment.