perf(nfd): publish labels, not raw features, from nfd-worker #3127
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #3127"
general
weight: 0.35
ArangoGutierrez
Summary
nfd-worker now publishes node labels instead of raw hardware features (
worker.config.core.noPublishFeaturesstrips everything exceptkernel.loadedmodule), which shrinks each node'sNodeFeatureobject and the memory nfd-master needs to cache them. The Mellanox NIC labelfeature.node.kubernetes.io/pci-15b3.present, which a cluster-side rule used to compute from the strippedpci.devicefeature, is now also computed by an nfd-worker rule in every recipe that ships network-operator.Motivation / Context
On a 1720-node GB300 cluster, nfd-master cached about 334 KB of raw features per node, mostly
kernel.config, and was OOMKilled every 2.5 minutes at the 4Gi chart default (#3038). #3046 raises the limit to 8Gi, but memory still scales with node count times object size. This change shrinks the objects instead. It ports the approach of GitLab ngn/n2-helm/nfd MR 28, which cut nfd-master memory by about 50% on GFN's 750-host data centers.Fixes: N/A
Related: #3038
Related: #3046
Type of Change
Component(s) Affected
cmd/aicr,pkg/cli)cmd/aicrd,pkg/server)pkg/recipe)pkg/bundler,pkg/component)pkg/collector,pkg/snapshotter)pkg/validator)pkg/errors,pkg/k8s)docs/,examples/)recipes/components/nfd,recipes/components/network-operator, overlays that add network-operatorImplementation Notes
sources.customrules, from the full set;noPublishFeaturesonly drops keys from theNodeFeatureit writes (NFD v0.19.0, the current pin; no chart bump). Only cluster-sideNodeFeatureRuleandNodeFeatureGroupobjects read published features.kernel.loadedmodulestays published for the GPU Operator's opt-innvidia-kernel-modulesrule.NodeFeatureRule/NodeFeatureGroup. The only enabled consumers were network-operator'snvidia-nics-rulesand AICR's AKSnfd-network-rule.yaml, both readingpci.deviceto setpci-15b3.present.components/nfd/values-nvidia-nics.yaml;values-nvidia-nics-aks.yamlmatches only the ND-series InfiniBand VFs 101c/101e) is wired only into overlays that ship network-operator. On a recipe without network-operator the label would make the GPU Operator validator wait for a MOFED driver nothing installs (GPUDirect RDMA on,useHostMofedfalse).deploy.sh --no-waitand Helm 3: nodes whose worker had not restarted lost the label, and the NicClusterPolicy operands and the AKS peermem reloader were deleted on them. With the rules kept, a node's worker write that dropspci.devicealso adds the label, so the handoff has no gap whatever the deployer order. Once workers strippci., the old rules match nothing. A follow-up removes them in the next release; clusters should take this release first.nfd-network-rulemanifest as a Helm hook (before-hook-creation), so eachnetwork-operator-postupgrade deletes and recreates it, and a node whose worker has not restarted can lose the label for about a second. Flux already recreates the AKS NicClusterPolicy the same way on every upgrade. This PR narrows that window to the nodes whose worker has not restarted; makingnetwork-operator-postwait for nfd, or dropping the hook, is a deployer change left out of scope.TestNFDFeaturePublishingContractresolves every leaf and checks, on merged values:- exactly one worker NIC rule with the right vendor and class (or, on AKS, device) values when network-operator ships, and none otherwise, including through
sources.pcior alabelsTemplaterule;- no rendered
NodeFeatureRuleorNodeFeatureGroup(chart-shipped, or a manifest parsed as YAML) reads a stripped feature, except the two transitional NIC rules, which are required on every network-operator leaf in this release and must be deleted together with the allowlist in the follow-up;- the effective strip list, including
worker.extraArgsoverrides (-no-publish-features,-options,-no-publish), equals the expected list on every nfd leaf;- nothing (
labelSources,featureSources,core.sources,extraArgs) stops the worker rule from running.Each helper that replays NFD v0.19.0 semantics has its own table test.
aicr bundlewarns when network-operator and the nfd NIC rule disagree on the final values: network-operator ships while nfd stripspci.deviceand has no worker rule forpci-15b3.present(a custom overlay that adds network-operator without the nfd values file), or nfd carries the rule without network-operator (--set networkoperator:enabled=falsewithout the--set-json).bundlers=subsets stay silent. It is a warning, not an error, because the check does not replayworker.extraArgsorlabelsTemplaterules.docs/user/component-catalog.md, each verified by rendering a bundle): publish features again for your ownNodeFeatureRules with--set-json 'nfd:worker.config.core.noPublishFeatures=[...]';sources.customis a list, so overriding it replaces the NIC rule; the AKS RDMA opt-out now also needs--set-json 'nfd:worker.config.sources.custom=[]'.nfd-ocp), nfd-master resource limits (#3046).-optionssettingsources., a template that writes a literalpci-15b3.present, and template lines that render rule content.Testing
Green at the PR head (88d28a370), run as its two halves on the same SHA because load from other jobs on the machine timed out unrelated timing tests in single runs (each passed alone):
make test-coverage coverage-check: rc=0, total coverage 85.3% (threshold 83%).make lint tuning-check e2e scan license-check api-diff openapi-diff: rc=0; golangci-lint 0 issues; chainsaw 30 passed, 0 failed; scan lists only the existing low/unknown findings ink8s.io/kubernetesandgolang.org/x/crypto; no incompatible SDK or REST contract changes.make bom-docs: no change for nfd or network-operator.go test -count=1 -run '^TestNFD' -v ./pkg/recipe/at the PR head passes 286 checks across 9 test functions, including all 133 leaves. Mutation checks, each run withgo test -overlayso the tree is untouched, turn it red:- dropping an AKS leaf's NIC values file;
- adding the NIC rule to a recipe without network-operator;
- turning the transitional chart rule off (13 leaves) or dropping the AKS manifest (14);
- enabling a non-transitional rule that reads
pci.device;- deleting or narrowing the strip list, or overriding it through
extraArgs(129 each);- a
sources.pciproducer (129) or alabelsTemplateproducer (102);- narrowing
labelSourcesorfeatureSources(27);- a manifest
feature:line with a trailing comment (14).The same mutants pass against the test before each fix.
1af4standing in for15b3): NodeFeature spec 64,709 bytes before, 2,979 after; onlykernel.loadedmodulestill published; node labels unchanged apart from a control rule that readskernel.config.pkg/recipe90.7% -> 90.7% (0.0%); the only non-test Go change is one comment inpkg/recipe/metadata.go.make qualifyat f878111 (same content as a363eb9 before the rebase onto d37ce8f), run as two halves.make lint tuning-check e2e scan license-check api-diff openapi-diff: rc=0, golangci-lint 0 issues, chainsaw 30 passed, 0 failed.make test-coverage: every package passed exceptTestApplyCRDsScript_BoundsStalledApplyinpkg/bundler/deployer/localformat, which this PR does not touch; its 2shelm listbound timed out under host load, and it passes alone (go test -race -run TestApplyCRDsScript ./pkg/bundler/deployer/localformat/). At a363eb9, the NFD guard, golden and warning tests pass. The warning has 13 table rows plus both of Mark's paths throughMake(), and each guard's mutant turns a row red. Coverage:pkg/bundler87.4% -> 87.5%,pkg/recipe90.7% -> 90.7%.Risk Assessment
Every recipe that deploys
nfdchanges what nfd-worker publishes. A user-authoredNodeFeatureRulethat matches a stripped feature stops matching until that feature is published again (documented override). The NIC label handoff is covered by the guard and the kind runs above. Production nfd-master memory has not been measured yet on the 1720-node cluster.Rollout notes: No migration step. This release keeps network-operator's
nvidia-nics-rulesand the AKSnfd-network-rule, so the NIC label stays on every node during the upgrade (Flux on AKS: see Implementation Notes). The next release removes them, so clusters should take this release before that one, or let the nfd-worker rollout finish before network-operator syncs.Checklist
make testwith-race)make lint)git commit -s -S)