fix: retry transient ARM deployment polling 404s - #6507
Conversation
|
Skipping CI for Draft Pull Request. |
Retry short-lived DeploymentNotFound responses from ARM operation status polling with the codebase-standard Kubernetes wait helper so eventual consistency does not fail valid provision pipelines. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bcb44f7 to
3414fdc
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates templatize’s ARM deployments client to tolerate a known ARM eventual-consistency edge case during LRO polling (operationStatuses returning transient 404 DeploymentNotFound immediately after deployment creation), preventing otherwise-valid pipeline runs from failing.
Changes:
- Attach a custom
azcoreper-call policy to thearmresources.DeploymentsClientused by templatize. - Add a narrowly scoped retry policy that retries only
GET .../deployments/.../operationStatuses/...when ARM returns 404DeploymentNotFound, usingwait.ExponentialBackoffWithContext. - Add unit tests covering match/non-match behavior, retry success/exhaustion, non-retryable errors, and context cancellation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tooling/templatize/pkg/pipeline/arm.go | Wires the new retry policy into the ARM deployments client via azcorearm.ClientOptions per-call policies. |
| tooling/templatize/pkg/pipeline/arm_retry_policy.go | Implements the targeted retry policy for transient DeploymentNotFound 404s on deployment operationStatuses polling. |
| tooling/templatize/pkg/pipeline/arm_retry_policy_test.go | Adds focused unit tests to validate the policy’s retry eligibility and stop conditions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Steve Kuznetsov (stevekuznetsov)
left a comment
There was a problem hiding this comment.
/lgtm
/approve
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: roivaz, stevekuznetsov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Related: AROSLSRE-1787
Historical context: ARO-23706
What
Ports the E2E test client's ARM deployment LRO retry handling into templatize and attaches it to the deployment client.
The policy retries only
GETrequests toMicrosoft.Resources/deployments/.../operationStatuses/...that fail with HTTP 404 and error codeDeploymentNotFound. It uses the codebase-standardk8s.io/apimachinery/pkg/util/wait.Backoffhelper for two short retries with 1-second initial delay, exponential growth, and jitter.Why
ARM can briefly return
DeploymentNotFoundwhen templatize polls a deployment immediately after creating it. CIHealth recorded five provision failures from August 5-11 where polling failed within 142 ms of deployment creation; the deployments subsequently appeared asSucceeded.ARO-23706 tracked the same ARM eventual-consistency failure and was closed after the E2E test binary gained retry handling. Applying the same narrowly scoped handling to templatize prevents valid provision pipelines from failing without delaying ordinary deployment-resource GETs used for cache lookup.
Testing
cd tooling/templatize && go test ./pkg/pipeline -count=1Special notes for your reviewer
This intentionally does not use the broader implementation from
origin/arm-deployment-retry-policy, which also retries ordinary deployment GETs and could delay expected cache misses.PR Checklist