Azure 46: Argo Rollouts canary steps + Analysis
easy⏱ 5 mincourseazure
Anatomy of a Rollout step list
Each step is exactly one of: setWeight: N (shift traffic to N% canary), pause: {} (wait for manual kubectl argo rollouts promote), pause: { duration: 5m } (wait then continue), or analysis: { templates: [name], args: [...] } (run a probe; abort if it fails). The chart picks a sensible default for each env via mesh.canary.requiresApproval.
spec:
strategy:
canary:
trafficRouting:
istio:
virtualService: { name: odyssey-api-vs, routes: [primary] }
destinationRule: { name: odyssey-api-dr, stableSubsetName: stable, canarySubsetName: canary }
steps:
- setWeight: 10
- pause: { duration: 5m }
- analysis: { templates: [{ templateName: latency-p99 }] }
- setWeight: 50
- pause: { duration: 10m }
- setWeight: 100
AnalysisTemplate as a guardrail
An AnalysisTemplate queries Datadog / Prometheus and decides Pass / Fail. Example: latency-p99 returns Fail if p99 > 400ms over the last 5 minutes. A failed analysis triggers abort — Argo flips the weights back to 100/0 and pages on-call. Pass means continue to the next step. Analyses run concurrently with pauses, not after them.
promote vs abort
kubectl argo rollouts promote <rollout> skips past the next pause. --full skips all the way to 100. abort flips back to stable; retry re-runs the failed step. Lythia's pipeline-templates/cd/jobs/promote-rollout-v2.yaml shells out to these commands as a gated stage in prod pipelines.
# pipeline-templates/cd/jobs/promote-rollout-v2.yaml
steps:
- script: |
kubectl argo rollouts promote $(rolloutName) -n $(namespace)
kubectl argo rollouts status $(rolloutName) -n $(namespace) --watch
Simulate the progression
Write simulateCanary(steps, analysisResults) where steps is the array above and analysisResults is a Record<string, boolean> keyed by template name. Walk the steps, tracking current weight and elapsed minutes. On a failing analysis, abort and return { result: 'aborted', atWeight, atMinute, failingTemplate }. On finishing all steps, return { result: 'promoted', minutes }. Log a successful run and a run where latency-p99 fails at step 3.
Keep the first weight small in prod
10% is generous in prod for a 6-pod service; 5% is better for 20-pod fleets where 1 pod is already 5%. The goal of step 1 is to expose the new version to enough traffic to fail analyses early — not to scale.
Quiz: what counts as 'paused'?
A Rollout is in 'paused' state when either an explicit pause: {} is hit OR a running analysis is pending. kubectl argo rollouts status returns 'Paused' in both cases. Pipelines that 'wait until paused' must additionally check the reason (pause vs analysis) before assuming user input is needed.