Skip to content

Commit

Permalink
build: passing context parameter as required
Browse files Browse the repository at this point in the history
Version 0.18.0 of github.com/kubernetes-csi/csi-lib-utils
added support for structured logging.
This commit includes passing the context parameter for the
necessary function.

ref: kubernetes-csi/csi-lib-utils#149

Signed-off-by: Praveen M <[email protected]>
  • Loading branch information
iPraveenParihar committed May 15, 2024
1 parent c1aa091 commit 9e60d6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions sidecar/internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ type clientImpl struct {
}

// Connect to the GRPC client
func (c *clientImpl) connect(address string) (*grpc.ClientConn, error) {
return connection.Connect(address, metrics.NewCSIMetricsManager(""), connection.OnConnectionLoss(connection.ExitOnConnectionLoss()))
func (c *clientImpl) connect(ctx context.Context, address string) (*grpc.ClientConn, error) {
return connection.Connect(ctx, address, metrics.NewCSIMetricsManager(""), connection.OnConnectionLoss(connection.ExitOnConnectionLoss()))
}

// New creates and returns the GRPC client
func New(address string, timeout time.Duration) (Client, error) {
func New(ctx context.Context, address string, timeout time.Duration) (Client, error) {
c := &clientImpl{}
cc, err := c.connect(address)
cc, err := c.connect(ctx, address)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion sidecar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func main() {
klog.Fatalf("Failed to validate controller endpoint: %v", err)
}

csiClient, err := client.New(*csiAddonsAddress, *timeout)
csiClient, err := client.New(context.Background(), *csiAddonsAddress, *timeout)
if err != nil {
klog.Fatalf("Failed to connect to %q : %v", *csiAddonsAddress, err)
}
Expand Down

0 comments on commit 9e60d6e

Please sign in to comment.