mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
grpc: set localhost Authority to unix client calls
Several reports exist (both with device plugins and CSI) that kubelet w/ grpc-go sends invalid Authority header and some non grpc-go servers reject these unix domain socket client connections. grpc-go sets the Authority header correct when the dial address is in a format where the its address scheme can be determined. Instead of making changes to get the all server addresses to unix:// prefixed format, set grpc.WithAuthority("localhost") client connection override to get the same result. Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
This commit is contained in:
parent
f0823c0f59
commit
fbcdf48bb8
@ -119,6 +119,7 @@ func dial(unixSocketPath string) (api.DevicePluginClient, *grpc.ClientConn, erro
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
c, err := grpc.DialContext(ctx, unixSocketPath,
|
c, err := grpc.DialContext(ctx, unixSocketPath,
|
||||||
|
grpc.WithAuthority("localhost"),
|
||||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||||
grpc.WithBlock(),
|
grpc.WithBlock(),
|
||||||
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
|
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
|
||||||
|
@ -535,6 +535,7 @@ func newGrpcConn(addr csiAddr, metricsManager *MetricsManager) (*grpc.ClientConn
|
|||||||
|
|
||||||
return grpc.Dial(
|
return grpc.Dial(
|
||||||
string(addr),
|
string(addr),
|
||||||
|
grpc.WithAuthority("localhost"),
|
||||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||||
grpc.WithContextDialer(func(ctx context.Context, target string) (net.Conn, error) {
|
grpc.WithContextDialer(func(ctx context.Context, target string) (net.Conn, error) {
|
||||||
return (&net.Dialer{}).DialContext(ctx, network, target)
|
return (&net.Dialer{}).DialContext(ctx, network, target)
|
||||||
|
Loading…
Reference in New Issue
Block a user