Skip to content

Commit

Permalink
Use timeout ctx to get the serviceaccount
Browse files Browse the repository at this point in the history
Signed-off-by: Rokibul Hasan <[email protected]>
  • Loading branch information
RokibulHasan7 committed Dec 19, 2024
1 parent d3d1520 commit 3ff03c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/cli/connect_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,11 @@ func checkIfAlreadyConnected(ctx context.Context, vCluster *find.VCluster) (bool
return false, err
}

_, err = vKubeClient.CoreV1().ServiceAccounts("default").Get(ctx, "default", metav1.GetOptions{})
timeoutCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()

// Use the timeout context in the Get call
_, err = vKubeClient.CoreV1().ServiceAccounts("default").Get(timeoutCtx, "default", metav1.GetOptions{})
if err != nil {
return false, err
}
Expand Down

0 comments on commit 3ff03c9

Please sign in to comment.