feat(anc): add check-hotfix subcommand to read hotfix pointer from ConfigMap#8696
Draft
Devinwong wants to merge 4 commits into
Draft
feat(anc): add check-hotfix subcommand to read hotfix pointer from ConfigMap#8696Devinwong wants to merge 4 commits into
Devinwong wants to merge 4 commits into
Conversation
…2.1b)
Add a fail-open 'check-hotfix' CLI subcommand that reads the
kube-system/anc-hotfix-version ConfigMap published by the
live-patching-controller and stages the resolved {hotfixes:{...}} pointer
to the path download-hotfix already reads. download-hotfix keeps its
unchanged patch-only, strictly-higher gating; check-hotfix only fetches and
writes the pointer.
- Raw net/http HTTPS GET (no client-go); creds from AKSNodeConfig bootstrap
token + apiserver FQDN (primary) or on-node kubeconfigs (secondary).
- Shares the 2.1a hotfixConfig parser/data contract with download-hotfix.
- Always exits 0; emits CheckHotfix telemetry (configMapRead,
noHotfixForBase, customDataFallback, failed).
- PoC cold-start fallback reads a lenient top-level hotfixes object from the
node config when the ConfigMap read fails (TODO: typed absvc contract).
- Injectable App fields (checkHotfixConfigMapFetcher, nodeConfigPath) for
network-free unit tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The legacy readHotfixVersion function had no production callers after downloadHotfix switched to readHotfixConfig + resolveVersion. Remove it and fold its forward-compat coverage into TestReadHotfixConfig. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…2.1b)
Add a fail-open 'check-hotfix' CLI subcommand that reads the
kube-system/anc-hotfix-version ConfigMap published by the
live-patching-controller and stages the resolved {hotfixes:{...}} pointer
to the path download-hotfix already reads. download-hotfix keeps its
unchanged patch-only, strictly-higher gating; check-hotfix only fetches and
writes the pointer.
- Raw net/http HTTPS GET (no client-go); creds from AKSNodeConfig bootstrap
token + apiserver FQDN (primary) or on-node kubeconfigs (secondary).
- Shares the 2.1a hotfixConfig parser/data contract with download-hotfix.
- Always exits 0; emits CheckHotfix telemetry (configMapRead,
noHotfixForBase, customDataFallback, failed).
- PoC cold-start fallback reads a lenient top-level hotfixes object from the
node config when the ConfigMap read fails (TODO: typed absvc contract).
- Injectable App fields (checkHotfixConfigMapFetcher, nodeConfigPath) for
network-free unit tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…g/anc-check-hotfix-configmap
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.
Add a
check-hotfixsubcommand that reads the hotfix pointer from a ConfigMapThis adds a new fail-open
check-hotfixsubcommand toaks-node-controller. It reads a cluster ConfigMap that maps an ANC version base to a hotfix version, and writes that pointer to the filedownload-hotfixalready consumes.download-hotfixthen re-resolves the pointer and keeps its existing patch-only, strictly-higher gating.check-hotfixonly fetches and stages the pointer - it never installs anything and never blocks provisioning.Stacking
This branch is stacked on the base-to-version hotfix map change (PR #8694). The PR base is set to that branch so the diff shows only this change (
app.gowiring +checkhotfix.go+checkhotfix_test.go). It must merge after #8694; if #8694 merges first, retarget this PR tomain.What it does
kube-system/anc-hotfix-versionConfigMap from the apiserver with a rawnet/httpHTTPS GET (no client-go dependency)./etc/kubernetes/certs/ca.crt.bootstrap-kubeconfig, thenkubeconfig, for server, CA, and client-cert/key or token..dataholds the full{"hotfixes":{...}}JSON object under a single key (prefershotfixes.json, else the only entry). The value unmarshals directly into the same config typedownload-hotfixuses, so both commands share one parser and data contract./opt/azure/containers/aks-node-controller-hotfix.jsonin the same{"hotfixes":{...}}shape (atomic temp-file + rename), sodownload-hotfixre-resolves it and applies its unchanged gating.hotfixesobject embedded in the node config and uses that. (Marked with a TODO to switch to a typed config field once that contract exists.)CheckHotfixwith outcomesconfigMapRead,noHotfixForBase,customDataFallback,failed.Net effect (examples)
ConfigMap published to the cluster:
{ "data": { "hotfixes.json": "{\"hotfixes\":{\"202604.01\":\"202604.01.1\",\"202605.01\":\"202605.01.2\"}}" } }check-hotfixstages/opt/azure/containers/aks-node-controller-hotfix.json:{"hotfixes":{"202604.01":"202604.01.1","202605.01":"202605.01.2"}}hotfixesTests
New network-free unit tests (creds/ConfigMap source injected, no real networking): success read+write, 404/403/timeout/connection fail-open, invalid ConfigMap JSON fail-open,
noHotfixForBase, cold-start fallback (and no-pointer failure), telemetry outcomes and always-exit-0 wiring, shared-parser equivalence withdownload-hotfix, and kubeconfig parsing (token + client-cert, inline-data and file forms).All new tests pass. The full
go test ./...run shows no new failures versus the base branch. The only failures are pre-existing Windows-only environmental ones (they need/etc/os-release, bash, and unix file perms) that pass in Linux CI.Note: wiring this command into the provisioning wrapper script is intentionally out of scope for this PR and will land separately behind a feature flag.