Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func run(ctrlConfig spirev1alpha1.ControllerManagerConfig, options ctrl.Options)
setupLog.Error(err, "invalid trust domain name")
return err
}
setupLog.Info("Dialing SPIRE Server socket")
spireClient, err := spireapi.DialSocket(ctx, ctrlConfig.SPIREServerSocketPath)
if err != nil {
setupLog.Error(err, "unable to dial SPIRE Server socket")
Expand Down
6 changes: 5 additions & 1 deletion pkg/spireapi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"io"
"path/filepath"
"time"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
Expand All @@ -41,7 +42,10 @@ func DialSocket(ctx context.Context, path string) (Client, error) {
} else {
target = "unix:" + path
}
grpcClient, err := grpc.DialContext(ctx, target, grpc.WithTransportCredentials(insecure.NewCredentials()))

ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
grpcClient, err := grpc.DialContext(ctx, target, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
if err != nil {
return nil, fmt.Errorf("failed to dial API socket: %w", err)
}
Expand Down