Skip to content

Commit de63e57

Browse files
authored
Merge pull request kubernetes#85875 from yutedz/gce-ctx-timeout-inst
Utilize Context with timeout in gce_instances.go
2 parents b42f219 + 113001a commit de63e57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

staging/src/k8s.io/legacy-cloud-providers/gce/gce_instances.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (g *Cloud) NodeAddresses(_ context.Context, _ types.NodeName) ([]v1.NodeAdd
111111
// NodeAddressesByProviderID will not be called from the node that is requesting this ID.
112112
// i.e. metadata service and other local methods cannot be used here
113113
func (g *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error) {
114-
timeoutCtx, cancel := cloud.ContextWithCallTimeout()
114+
timeoutCtx, cancel := context.WithTimeout(ctx, 1*time.Hour)
115115
defer cancel()
116116

117117
_, zone, name, err := splitProviderID(providerID)
@@ -229,7 +229,7 @@ func (g *Cloud) InstanceType(ctx context.Context, nodeName types.NodeName) (stri
229229
// AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances
230230
// expected format for the key is standard ssh-keygen format: <protocol> <blob>
231231
func (g *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error {
232-
ctx, cancel := cloud.ContextWithCallTimeout()
232+
ctx, cancel := context.WithTimeout(ctx, 1*time.Hour)
233233
defer cancel()
234234

235235
return wait.Poll(2*time.Second, 30*time.Second, func() (bool, error) {

0 commit comments

Comments
 (0)