Merge pull request #105069 from p0lyn0mial/upstream-etcd-client-retry

etcd client starts retrying transient errors from the etcd cluster

Kubernetes-commit: 63e7ee43bb5394abd6dd5010be47ebcb22ec0ef8
This commit is contained in:
Kubernetes Publisher 2021-09-16 12:43:39 -07:00
commit 4439e08d16
1 changed files with 7 additions and 2 deletions

View File

@ -137,8 +137,13 @@ func newETCD3Client(c storagebackend.TransportConfig) (*clientv3.Client, error)
}
dialOptions := []grpc.DialOption{
grpc.WithBlock(), // block until the underlying connection is up
grpc.WithUnaryInterceptor(grpcprom.UnaryClientInterceptor),
grpc.WithStreamInterceptor(grpcprom.StreamClientInterceptor),
// use chained interceptors so that the default (retry and backoff) interceptors are added.
// otherwise they will be overwritten by the metric interceptor.
//
// these optional interceptors will be placed after the default ones.
// which seems to be what we want as the metrics will be collected on each attempt (retry)
grpc.WithChainUnaryInterceptor(grpcprom.UnaryClientInterceptor),
grpc.WithChainStreamInterceptor(grpcprom.StreamClientInterceptor),
}
if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.APIServerTracing) {
tracingOpts := []otelgrpc.Option{