Skip to content

Commit

Permalink
Merge pull request #2908 from bennerv/fix-timeout-on-checkaccess
Browse files Browse the repository at this point in the history
Update timeout on check permissions to >5 min for ARM RA cache
  • Loading branch information
bennerv authored May 16, 2023
2 parents c32f5df + 6b7f74c commit 19751c9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/api/validate/dynamic/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,18 +367,17 @@ func (dv *dynamic) validateNatGatewayPermissions(ctx context.Context, s Subnet)
}

func (dv *dynamic) validateActions(ctx context.Context, r *azure.Resource, actions []string) error {
// ARM has a 5 minute cache around role assignment creation, so wait one minute longer
timeoutCtx, cancel := context.WithTimeout(ctx, 6*time.Minute)
defer cancel()

c := closure{dv: dv, ctx: ctx, resource: r, actions: actions}
conditionalFunc := c.usingListPermissions
timeout := 20 * time.Second
if dv.pdpClient != nil {
conditionalFunc = c.usingCheckAccessV2
timeout = 65 * time.Second // checkAccess refreshes data every min. This allows ~3 retries.
}

timeoutCtx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()

return wait.PollImmediateUntil(timeout, conditionalFunc, timeoutCtx.Done())
return wait.PollImmediateUntil(30*time.Second, conditionalFunc, timeoutCtx.Done())
}

// closure is the closure used in PollImmediateUntil's ConditionalFunc
Expand Down

0 comments on commit 19751c9

Please sign in to comment.