Wave 7: Argo Rollouts canary + metric-gated auto-rollback for instant-api (operator-apply)#59
Merged
Merged
Conversation
…-api (operator-apply)
A bad instant-api image today reaches 100% of api.instanode.dev traffic on
`kubectl set image` (RollingUpdate) and is only caught AFTER users hit it. This
ships the operator-apply manifests to make a bad deploy auto-roll-back on metric
regression instead.
OPERATOR-APPLY ONLY — nothing here touches prod (CLAUDE.md rule 15: infra has no
auto-apply). The live deploy path (api/.github/workflows/deploy.yml →
`kubectl set image deployment/instant-api`) and k8s/app.yaml are UNCHANGED. The
PR is zero-risk; migration is a deliberate, reversible operator action.
What's added (k8s/canary/, operator-apply):
- Rollout/instant-api — canary strategy setWeight 10 → pause 5m (bake) →
analysis → setWeight 50 → pause 5m → analysis → setWeight 100 → pause 2m.
Uses workloadRef to the existing Deployment so replicas/resources/probes/env/
imagePullSecrets/affinity stay a drop-in (zero pod-spec duplication).
- AnalysisTemplate/instant-api-canary-analysis — gates each promotion on REAL
prod metrics (names verified vs prometheus-rules.yaml + newrelic/alerts):
(a) 5xx rate instant_http_errors_total{status_class=5xx} / *_count < 2%
(b) deploy health increase(instant_deploy_job_failed_detected_total)==0
+ up{job=instant-api} >= 1
(c) auth-probe increase(instant_auth_probe_outcome_total{result=fail})==0
failureLimit/inconclusiveLimit per the documented Argo Rollouts pattern; a
breach fails the AnalysisRun → Rollout aborts → traffic back to stable
(auto-rollback). Prometheus provider default; New Relic provider blocks
included (commented) since prod observability is NR today.
- stable + canary Services the controller routes between (existing
Service/instant-api + api Ingress untouched).
Runbook: CANARY-ROLLOUT-RUNBOOK.md — install controller (NOT installed today),
provider setup (no in-cluster Prometheus today → Prom-or-NR options),
workloadRef cutover (safe + reversible), the api deploy.yml flip to
`kubectl argo rollouts set image` (operator does at migration, NOT in this PR),
manual abort/undo/promote, and full back-out of Argo Rollouts.
Rule 25: canary outcome observability shipped — NR alert
canary-analysis-aborted.json + 2 dashboard tiles on instanode-reliability.json
+ METRICS-CATALOG row (rollout_info / analysis_run_info, lazy until the
controller is installed + scraped).
validate.yml stays green: kubeconform -ignore-missing-schemas SKIPS the Argo
Rollouts CRDs (Rollout/AnalysisTemplate — same as the existing cert-manager/
Cilium CRDs); the two Services validate strictly. Verified locally:
99 valid / 0 invalid / 9 skipped, yamllint clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wave 7 — canary deploy with metric-gated AUTO-ROLLBACK for instant-api
A bad instant-api image today reaches 100% of
api.instanode.devtraffic the momentkubectl set image deployment/instant-apiruns (RollingUpdate), and a regression is only caught after users hit it. This ships the operator-apply manifests + runbook to make a bad deploy auto-roll-back on metric regression instead of being detected after the fact.Zero prod risk — operator-apply only
infrahas no auto-apply (CLAUDE.md rule 15).api/.github/workflows/deploy.yml→kubectl set image deployment/instant-apiandk8s/app.yaml(the live Deployment) are not modified. No CI workflow is changed.The canary ladder
What the AnalysisTemplate gates on (real prod metrics, names verified vs
prometheus-rules.yaml+newrelic/alerts/)sum(rate(instant_http_errors_total{job="instant-api",status_class="5xx"}[2m])) / clamp_min(sum(rate(instant_http_request_duration_seconds_count{job="instant-api"}[2m])),1e-9) < 0.02sum(increase(instant_deploy_job_failed_detected_total[5m])) == 0andsum(up{job="instant-api"}) >= 1sum(increase(instant_auth_probe_outcome_total{result="fail"}[10m])) == 0A breach of
failureLimitfails the AnalysisRun → Rollout aborts → traffic returns to the stable ReplicaSet. Prometheus provider is the default; New Relic provider blocks are included (commented) because prod observability is NR today (no in-cluster Prometheus).Files
k8s/canary/rollout-instant-api.yamlRollout/instant-apicanary,workloadRefto the existing Deployment → drop-in parity (replicas/resources/probes/env/imagePullSecrets/affinity), zero pod-spec duplicationk8s/canary/analysistemplate-instant-api.yamlfailureLimit/inconclusiveLimitk8s/canary/services-instant-api-canary.yamlinstant-api-stable+instant-api-canaryServices (existing Service +apiIngress untouched)CANARY-ROLLOUT-RUNBOOK.mdworkloadRefcutover → CI flip (operator, NOT this PR) → manual abort/undo → full back-outOperator action required (NOT done in this PR)
kubectl get crd rollouts.argoproj.io→ NotFound indo-nyc3-instant-prod) → runbook §install.job="instant-api", OR switch the template to the NR provider).deploy.ymlflip tokubectl argo rollouts set imageis documented for the operator to do at migration time so current deploys never break.Rule 25 — canary observability shipped in-PR
newrelic/alerts/canary-analysis-aborted.json(auto-pickup bynewrelic/apply.sh)newrelic/dashboards/instanode-reliability.json(rollout phase + AnalysisRun outcomes)observability/METRICS-CATALOG.mdrow (rollout_info/analysis_run_info, lazy until controller installed + scraped)validate.yml stays green
kubeconform -ignore-missing-schemasskips the Argo Rollouts CRDs (Rollout/AnalysisTemplate) — exactly like the existing cert-manager/Cilium/CNPG CRDs — while the two Services validate strictly. Verified locally with the exact CI command: 99 valid / 0 invalid / 9 skipped, yamllint clean onk8s/canary/.🤖 Generated with Claude Code