AgentBaker icon indicating copy to clipboard operation
AgentBaker copied to clipboard

feat(anc): add check-hotfix subcommand to read hotfix pointer from LPS

Open Devinwong opened this issue 5 months ago • 1 comments

Add a check-hotfix subcommand that reads the hotfix pointer from the live-patching-service

check-hotfix (new aks-node-controller subcommand) fetches a base-to-hotfix-version pointer from the live-patching-service (LPS) over an IMDS-attested HTTPS path reachable before kubelet, stages it to the file download-hotfix already consumes, and falls back to an embedded pointer if the LPS is unreachable. It only fetches and stages - download-hotfix keeps its unchanged patch-only, strictly-higher gating - and it always exits 0, so provisioning is never blocked.

flowchart LR
    START["check-hotfix runs<br/>(pre-kubelet)"] --> FETCH["Fetch hotfix pointer<br/>from LPS"]
    FETCH --> GOT{"Got it?"}
    GOT -- "yes" --> STAGE["Stage pointer file"]
    GOT -- "nothing for me<br/>(401/403/404)" --> NOOP["Skip - benign"]
    GOT -- "LPS unreachable" --> COLD["Fall back to<br/>embedded pointer"]
    COLD --> STAGE
    STAGE --> DH["download-hotfix<br/>reads &amp; applies it later"]
    NOOP --> EXIT["Always exit 0<br/>(never blocks provisioning)"]
    STAGE --> EXIT

Stacking

2.1a (#8694) has merged, so this PR targets main directly (app.go wiring + checkhotfix.go + checkhotfix_test.go). It is always-on by itself; the feature gate arrives later in 2.1d.

main  (#8694 2.1a base->version hotfix map - merged)
 \- #8696  2.1b  check-hotfix LPS endpoint reader (Go)        <- this PR
     \- #8715  2.1c  wire check-hotfix into wrapper (shell)
         \- #8717  2.1d  enable_provisioning_hotfix contract field + Go self-gate

Open dependency (placeholder route)

The LPS route/schema for the pointer is a planned-maintenance deliverable that is not finalized; the prototype only proved reachability. The route is a named placeholder (lpsHotfixPath = "/v1/anc-hotfix") with a TODO, and the IMDS/LPS client helpers are flagged in-code to be de-duplicated into a shared LPS client when that lands. This PR is held DRAFT until the route finalizes.

Net effect (examples)

LPS serves {"hotfixes":{"202604.01":"202604.01.1"}}; check-hotfix stages the same JSON to /opt/azure/containers/aks-node-controller-hotfix.json.

Node baked ANC version LPS read outcome download-hotfix then does
202604.01.0 OK lpsRead base 202604.01 -> 202604.01.1, patch 1 > 0, upgrades
202607.15.0 OK (no matching base) noHotfixForBase no pointer for this base, no-op
any 401 / 403 / 404 noHotfixAvailable no overlay staged, benign no-op
202604.01.0 unreachable, embedded hotfixes present customDataFallback reads staged fallback pointer, resolves as above
202604.01.0 unreachable, no fallback failed (still exit 0) nothing staged, no-op

Tests

Network-free unit tests (LPS fetcher + attested-token injected) cover every outcome above, fail-open on parse/transport errors, shared-parser equivalence with download-hotfix, the SNI-pinned TLS client (CA required, no insecure fallback), and the 0644 staged-file mode. All new tests pass; the only go test ./... failures are pre-existing Windows-only environmental ones that pass in Linux CI.

Devinwong avatar Jun 12 '26 00:06 Devinwong

Failed gate

Run: https://msazure.visualstudio.com/CloudNativeCompute/_build/results?buildId=170741296

Failed job/stage/task: build2204gen2containerd / Test, Scan, and Cleanup (logId 431).

Detective summary

Known VHD scan/CIS-CAT gate failure recurred. vhd-scanning.sh failed twice after CIS-CAT Pro Assessor v4.57.1 completed Assessment 1 with exit value 122; the wrapper then surfaced task exit code 2. The same build stage shows multiple VHD legs failing Test, Scan, and Cleanup with the same exit-code shape.

Likely cause / signature

Likely known CIS-CAT assessor scan tooling failure, not this PR. Signature: AB-GATE-LINUX-VHD-SCAN-CISCAT-EXIT122. Confidence: High.

Strongest alternative: a real Ubuntu image compliance/package regression affecting CIS-CAT. Less likely because this exactly matches the existing repeated exit-122 signature and PR #8696 changes ANC/check-hotfix Go code and tests, not image generation, Packer, scan configuration, CSE, or provisioning scripts.

Recommended action

No PR author action recommended. Node Lifecycle/VHD gate owner should continue repair item #38671557.

Evidence

  • Timeline/build status: build stage failed in VHD Test, Scan, and Cleanup tasks with exit code 2
  • Log: vhd-scanning.sh failed twice; CIS-CAT Pro v4.57.1 reported Assessment 1 Exit Value: 122
  • PR metadata: changes are ANC/check-hotfix Go code and tests only
  • Wiki signature: AB-GATE-LINUX-VHD-SCAN-CISCAT-EXIT122

aks-node-assistant[bot] avatar Jul 02 '26 19:07 aks-node-assistant[bot]