Skip to content

Commit

Permalink
fix: enable connections to endpoints with public certs
Browse files Browse the repository at this point in the history
gRPC enforces having some transport credentials.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Sep 28, 2021
1 parent 509e9b2 commit e9d5dfa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"context"
"crypto/cipher"
"crypto/rand"
"crypto/tls"
"fmt"
"io"
"sync"
Expand All @@ -19,6 +20,7 @@ import (
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/durationpb"

Expand Down Expand Up @@ -244,6 +246,8 @@ func (client *Client) Run(ctx context.Context, logger *zap.Logger, notifyCh chan

if client.options.Insecure {
opts = append(opts, grpc.WithInsecure())
} else {
opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
}

discoveryConn, err = grpc.DialContext(ctx, client.options.Endpoint, opts...)
Expand Down

0 comments on commit e9d5dfa

Please sign in to comment.