AgentBaker icon indicating copy to clipboard operation
AgentBaker copied to clipboard

feat(anc): gate check-hotfix on enable_provisioning_hotfix contract field

Open Devinwong opened this issue 5 months ago • 4 comments

2.1d - gate check-hotfix on the enable_provisioning_hotfix contract field

POC / M1 draft. AgentBaker / Node SIG side only.

This is the final layer of the provisioning-hotfix stack. It makes the AKSNodeConfig contract field the single source of truth for whether aks-node-controller check-hotfix does any work, and relaxes the env gate added in 2.1c.

What changed

  • Proto contract field: add bool enable_provisioning_hotfix = 45; to aksnodeconfig/v1/config.proto (next free tag after cse_timeout = 44) and regenerate the Go bindings.
  • Go gate: check-hotfix reads the field at the very top of checkHotfix() via App.provisioningHotfixEnabled() (reads the node-config JSON that is already on disk and calls GetEnableProvisioningHotfix()). When the field is not true (false, unset, or the config cannot be read/parsed) it returns the new telemetry outcome disabled and exits 0 WITHOUT any remote hotfix call. Fail-open everywhere.
  • Wrapper relaxation: aks-node-controller-wrapper.sh now calls check-hotfix UNCONDITIONALLY (still wrapped defensively so it can never block provisioning). The Go binary self-gates on the contract field.

Read channel

The hotfix-pointer READ CHANNEL is moving from a kube-system ConfigMap (read with a bootstrap token) to the live-patching-service (LPS) IMDS-attested endpoint, validated reachable pre-kubelet in e2e. That fetch/auth rewrite lives in #8696; this PR is channel-agnostic. The enable_provisioning_hotfix contract field and the Go self-gate decide WHETHER check-hotfix runs at all, independent of which channel it then uses, so the proto field is intentionally channel-neutral and unchanged by the pivot.

Supersedes the env-delivery approach

An earlier revision of this PR delivered the toggle as an env var via a cse_cmd.sh template var plus a systemd drop-in (Environment="ENABLE_PROVISIONING_HOTFIX=...") on aks-node-controller.service, mirroring the IMDS-restriction pattern. That approach was dropped because:

  • check-hotfix already parses the AKSNodeConfig for its own connection details, so a real contract field is available to the binary with zero new plumbing - no template var, no drop-in, no env var.
  • In the self-provisioning path the wrapper and the drop-in writer are the same service, so an env/drop-in written during provisioning would only take effect on the NEXT boot. Reading the contract field directly avoids that activation-timing problem - it works on the same boot because the config JSON is on disk before the service starts.

This also means absvc sets ONE field (the contract bool), not an env var plus a field.

Relaxes the 2.1c env gate

This PR relaxes the ENABLE_PROVISIONING_HOTFIX env gate introduced in #8715 (2.1c); gating now lives in the Go binary via the enable_provisioning_hotfix contract field - single source of truth, so absvc sets ONE field, not an env var plus a field. The 2.1c env gate is intentionally added-then-relaxed across the stack so each PR stays reviewable on its own.

Default-off and fail-open

When enable_provisioning_hotfix is false or unset, behavior is byte-identical to before this stack: check-hotfix makes no remote call and provisioning proceeds unchanged. Any read or parse error is treated as off. This preserves the 6-month VHD support window in both directions (older VHD + newer config, and newer VHD + older binary are both safe).

Before / after

  • field false or unset -> check-hotfix returns outcome=disabled, no remote call, exit 0
  • field true -> check-hotfix reads the hotfix pointer from the LPS (live-patching-service) endpoint and stages it (the read channel itself is owned by #8696)

Stack

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

The aks-rp region toggle that sets the field is in a different repo and is the only remaining out-of-repo piece. With the field settable on a node, the on-node PoC e2e tests (fail-open and multi-base) become runnable.

Tests

  • go test ./... in aks-node-controller: all check-hotfix tests pass, including new gate tests (disabled -> outcome=disabled and the injected fetcher is never called; enabled -> fetch path runs). Pre-existing Windows-only failures (CRLF goldens, file locks, os-release message text) are unrelated and also fail on the base branch.
  • Wrapper shellspec updated for unconditional check-hotfix: 7 examples, 0 failures.
  • shellcheck clean on the wrapper.

Devinwong avatar Jun 16 '26 00:06 Devinwong

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJul 10, 2026, 8:12 PM

github-actions[bot] avatar Jun 16 '26 00:06 github-actions[bot]

Acknowledged - no action needed. This is the automated Buf CI status, and it reports Build, Format, Lint, and Breaking all passing for the additive optional field enable_provisioning_hotfix = 45. That matches the local buf verification (lint STANDARD clean, WIRE_JSON breaking clean against the 2.1c base, format clean), so the proto change is confirmed compatible and no change is warranted.

Devinwong avatar Jun 16 '26 02:06 Devinwong

Read-channel pivot note (no change to this PR's gating contract).

The hotfix-pointer read channel is moving from Option 2 (kube-system ConfigMap + bootstrap token) to Option 4: the live-patching-service (LPS) IMDS-attested endpoint, which e2e validated is reachable pre-kubelet. That fetch/auth rewrite lives in #8696 and is channel-specific.

This PR (2.1d) is channel-agnostic. The enable_provisioning_hotfix contract field (proto tag 45, plain bool) and the Go self-gate (App.provisioningHotfixEnabled() at the top of checkHotfix(), default-off, fail-open, no remote call when off) decide WHETHER check-hotfix runs at all, independent of which channel it then uses. So:

  • The proto field name stays enable_provisioning_hotfix (channel-neutral, correct).
  • Gate semantics are unchanged: unset/false/nil-config all resolve to disabled.
  • I scrubbed wording in the proto comment, the gate comment + log line, the wrapper comment, and the PR body so they describe the gated action as reading the hotfix pointer from the LPS endpoint rather than the ConfigMap.
  • buf lint and breaking are both clean (the comment-only proto change leaves rawDesc untouched); generated surface is config.pb.go only.

Devinwong avatar Jun 19 '26 21:06 Devinwong

Closing 2.1d as no-longer-needed — enablement delivery has been re-architected.

Decision

Per the design review on the 2.1c wrapper session, the on-node gate for check-hotfix needs only the feature-flag file /opt/azure/containers/enabled_features.sh parsed by the wrapper (aks-node-controller-wrapper.sh, merged in #8715/2.1c). The enable_provisioning_hotfix proto field this PR added is an unnecessary cross-component signal: enablement will be delivered by aks-rp writing the feature-flag file directly via native cloud-init, gated by the region toggle — not via an AgentBaker contract field or boothook.

Why this PR's approach didn't reach production anyway

This PR's boothook write lived in aks-node-controller/pkg/nodeconfigutils/utils.go (CustomData()), which is referenced only by e2e/vmss.go and the README — not the production provisioning path. Production scriptless custom data is assembled by getScriptlessNBCCustomData → its own boothookTemplate in pkg/agent/baker.go. So the flag written here would have reached only e2e nodes. Rather than re-home the write into baker.go, the cleaner architecture is aks-rp-side native cloud-init delivery (no AgentBaker contract field, single source of truth at the region toggle).

Disposition

  • No AgentBaker change is required for enablement; the only AgentBaker-side piece (the wrapper gate) already lives in #8715/2.1c.
  • Enablement is now tracked in the aks-rp enable-provisioning-hotfix toggle work, which will inject the cloud-init part writing enabled_features.sh (literal ENABLE_PROVISIONING_HOTFIX=true) before the wrapper runs.
  • Branch and commit are preserved (tag backup-2.1d-featuresfile-9102831736) in case any part is revived.

Closing.

Devinwong avatar Jul 10 '26 22:07 Devinwong

AgentBaker Linux gate detective

Run: 171764413
Failed job/stage/task: e2e / Run AgentBaker E2E / Test_Ubuntu2204_DisableKubeletServingCertificateRotationWithTags_CustomKubeletConfig/default
Detective summary: E2E failed because VMSS creation exceeded WestUS3 standardDDSv5Family quota. This is infrastructure capacity pressure, not the enable_provisioning_hotfix contract change.

Likely cause/signature: VMSS create returned ARM 409 Conflict / OperationNotAllowed: WestUS3 standardDDSv5Family cores quota was fully consumed (1300/1300) and the test needed 2 additional cores.
Confidence: High
Recommended owner/action: AgentBaker E2E / Node Lifecycle infra owner should increase/free WestUS3 standardDDSv5Family quota or reduce concurrent DDSv5 E2E usage; PR author can rerun after capacity is available.
Strongest alternative: The provisioning-hotfix contract change broke ANC/provisioning behavior, but less likely because VMSS allocation failed before provisioning logic could run and unrelated PRs hit the same quota signature.

Evidence: build metadata, timeline, failed E2E log 538, failed test results, and same-window quota failures across unrelated PRs.
Wiki signature: linux-vhd-gate-westus3-standarddsv5-quota-exceeded

aks-node-assistant[bot] avatar Jul 10 '26 23:07 aks-node-assistant[bot]