mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Utilize Context with timeout in gce_instances.go
This commit is contained in:
parent
674695c544
commit
113001ab01
@ -111,7 +111,7 @@ func (g *Cloud) NodeAddresses(_ context.Context, _ types.NodeName) ([]v1.NodeAdd
|
|||||||
// NodeAddressesByProviderID will not be called from the node that is requesting this ID.
|
// NodeAddressesByProviderID will not be called from the node that is requesting this ID.
|
||||||
// i.e. metadata service and other local methods cannot be used here
|
// i.e. metadata service and other local methods cannot be used here
|
||||||
func (g *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error) {
|
func (g *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error) {
|
||||||
timeoutCtx, cancel := cloud.ContextWithCallTimeout()
|
timeoutCtx, cancel := context.WithTimeout(ctx, 1*time.Hour)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, zone, name, err := splitProviderID(providerID)
|
_, zone, name, err := splitProviderID(providerID)
|
||||||
@ -229,7 +229,7 @@ func (g *Cloud) InstanceType(ctx context.Context, nodeName types.NodeName) (stri
|
|||||||
// AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances
|
// AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances
|
||||||
// expected format for the key is standard ssh-keygen format: <protocol> <blob>
|
// expected format for the key is standard ssh-keygen format: <protocol> <blob>
|
||||||
func (g *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error {
|
func (g *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error {
|
||||||
ctx, cancel := cloud.ContextWithCallTimeout()
|
ctx, cancel := context.WithTimeout(ctx, 1*time.Hour)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
return wait.Poll(2*time.Second, 30*time.Second, func() (bool, error) {
|
return wait.Poll(2*time.Second, 30*time.Second, func() (bool, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user