AgentBaker icon indicating copy to clipboard operation
AgentBaker copied to clipboard

refactor: write ANC hotfix.json via boothook and rename target_version to scripts_version

Open Devinwong opened this issue 5 months ago • 2 comments

Summary

Write the ANC hotfix config (aks-node-controller-hotfix.json) directly from the boothook instead of via a write_files entry in nodecustomdata.yml. This eliminates the double-parse of nodecustomdata.yml in download-hotfix, and gates an optional script hotfix payload by scripts_version.

Files / source of truth

  • Source of truth (committed, edited by operators): hotfix/anc-hotfix-version.json
    • version = ANC binary hotfix version to download/install
    • scripts_version = ANC/VHD version base that should receive the script hotfix write_files
  • Embedded config read by baker.go: parts/hotfix/aks-node-controller-hotfix.json
    • Generated from hotfix/anc-hotfix-version.json by hotfix/anc_hotfix_generate.py.
    • Embedded into the ABSVC binary via parts.Templates and shipped in custom data as /opt/azure/containers/aks-node-controller-hotfix.json.
  • Embedded script hotfix payload (optional): parts/hotfix/anc-scripts-hotfix-files.yml
    • Generated by hotfix/hotfix_generate.py; shipped as /opt/azure/containers/anc-scripts-hotfix-files.yml.

Both generated files are only committed on official/* hotfix branches. On normal builds they are absent, which baker.go treats as "no active hotfix" (ships nothing).

Flow

flowchart TD
    A["ABSVC / baker.go\nreads parts/hotfix/aks-node-controller-hotfix.json\n(embedded at build time)"]
    B["Boothook\nwrite nodecustomdata.yml\nwrite aks-node-controller-hotfix.json\nwrite anc-scripts-hotfix-files.yml (if active)"]
    C["download-hotfix\nread aks-node-controller-hotfix.json"]
    D{"ANC binary\nhotfix applies?"}
    E["Download & stage\nhotfix binary"]
    F["Skip binary download"]
    S{"scripts_version\nmatches running version?"}
    T["apply script hotfix\nwrite_files"]
    U["skip script hotfix"]
    G["provision\nread nodecustomdata.yml\napply write_files\nrun NBC cmd"]

    A --> B --> C --> D
    D -- Yes --> E --> S
    D -- No --> F --> S
    S -- Yes --> T --> G
    S -- No --> U --> G

Note: the script hotfix write_files are applied inside download-hotfix (via applyScriptHotfix), which the wrapper runs before provision. provision then materializes the main nodecustomdata.yml and runs the NBC command.

Changes

File Change
pkg/agent/baker.go Add loadHotfixConfigJSON() and getLinuxNodeScriptsHotfixFilesPayload(); ship the gzipped hotfix config + optional script payload via the shared gzipFileBlockFmt boothook block / Flatcar Ignition entries. Absent embed files are treated as "no active hotfix".
hotfix/anc-hotfix-version.json Source-of-truth config ({version, scripts_version}), edited by operators on official/*.
parts/hotfix/aks-node-controller-hotfix.json Generated embed (not committed on main); produced by hotfix/anc_hotfix_generate.py.
parts/hotfix/anc-scripts-hotfix-files.yml Generated script-hotfix write_files payload (not committed on main); produced by hotfix/hotfix_generate.py.
hotfix/anc_hotfix_generate.py / hotfix/hotfix_generate.py Emit standalone payload files (no marker injection into nodecustomdata.yml); delete the generated file when no hotfix is active.
aks-node-controller/hotfix.go download-hotfix reads the config, conditionally downloads the binary, and applies the script hotfix write_files (gated by scripts_version). target_version → scripts_version.
aks-node-controller/nodecustomdata.go applyWriteFiles no-ops on a missing (optional) payload; applyNodeCustomData stays strict (errors on missing required nodecustomdata.yml).
.github/workflows/*hotfix-generate.yml Regenerate + commit/update/delete the generated embed files on hotfix PRs.
Tests / snapshots Updated renames; regenerated test data.

Devinwong avatar Jun 23 '26 22:06 Devinwong

Failed gate run

Run: https://msazure.visualstudio.com/CloudNativeCompute/_build/results?buildId=169423717
Failed job/stage/task: e2e / Run AgentBaker E2E / Run AgentBaker E2E

Detective summary

Test_Ubuntu2204_ContainerdHasCurrentVersion/scriptless_nbc reached node validation, then validators.go:1010 reported [email protected] unexpectedly entered a failed state. Timeline and build status both corroborate the E2E task exit code 1; this signature is already recurring across unrelated gate runs.

Likely cause and signature

Likely recurring LocalDNS exporter/test-infra flake rather than a deterministic PR regression. Signature: localdns-exporter-systemd-failed-state. Confidence: medium-high. Strongest alternative: this PR's hotfix/customdata changes contributed to adjacent bootstrap failures, but the LocalDNS failed-unit signature predates this PR and is already tracked.

Recommended owner/action

Node Lifecycle E2E/LocalDNS owners should continue investigating the failed-unit scenario bundle. PR author action is not clearly indicated from this evidence.

Evidence

aks-node-assistant[bot] avatar Jun 25 '26 15:06 aks-node-assistant[bot]

Failed gate run

Run: https://msazure.visualstudio.com/CloudNativeCompute/_build/results?buildId=169447199
Failed job/stage/task: e2e / Run AgentBaker E2E / Run AgentBaker E2E

Detective summary

Test_Ubuntu2204_HTTPSProxy_PrivateDNS/default failed during VMSS CSE provisioning with CustomScript ExitCode=50 and KubeletStartTime=n/a. Timeline and build status confirm the E2E task failed; the Build VHD exit-code-2 warning retried successfully and was not the failed pair.

Likely cause and signature

Known recurring CSE/provisioning flake. Signature: ubuntu2204-httpsproxy-privatedns-cse-exit50-outbound-kubelet-na. Confidence: medium-high. Strongest alternative: PR #8767 customdata/hotfix refactor caused CSE failure, but the exact kubelet-n/a plus mandb/oldlocal pattern is already tracked under repair Bug #38559852 across unrelated PRs.

Recommended owner/action

Node Lifecycle repair owner should continue Bug #38559852; PR author should investigate only if subsequent runs show a new ANC/customdata-specific signature.

Evidence

  • Task log: logId 538; job log: logId 545; VHD retry warning logId 500 succeeded after retry
  • Wiki signature: ubuntu2204-httpsproxy-privatedns-cse-exit50-outbound-kubelet-na
  • Repair item: https://msazure.visualstudio.com/CloudNativeCompute/_workitems/edit/38559852

aks-node-assistant[bot] avatar Jun 25 '26 16:06 aks-node-assistant[bot]