Skip to content

feat(helm): machine-a-tron mac address allocation#3700

Open
akorobkov-nvda wants to merge 1 commit into
NVIDIA:mainfrom
akorobkov-nvda:feat/machine-a-tron-mac-assign
Open

feat(helm): machine-a-tron mac address allocation#3700
akorobkov-nvda wants to merge 1 commit into
NVIDIA:mainfrom
akorobkov-nvda:feat/machine-a-tron-mac-assign

Conversation

@akorobkov-nvda

Copy link
Copy Markdown
Contributor

Adds auto-generated per-pod MAC address pools to prevent collisions in multi-pod machine-a-tron deployments.

  • mac_address_pool - Standalone MACs (BMC, DPU interfaces)
  • hw_mac_address_ranges - Contiguous NIC blocks (ConnectX, storage)

Related issues

Closes #3698

Type of Change

  • Add - New feature or capability

Breaking Changes

  • This PR contains breaking changes

Testing

  • Manual testing performed

Test Results

helm template test helm/charts/nico-machine-a-tron \
  --set bmcServices.enabled=true \
  --set 'bmcServices.serviceCIDR.cidr=10.100.0.0/20' \
  --set 'pods.mat-0.cidr=10.100.0.0/22' \
  --set 'pods.mat-0.machines.compute.hwType=test' \
  --set 'pods.mat-0.machines.compute.hostCount=5' \
  --set 'pods.mat-1.cidr=10.100.4.0/22' \
  --set 'pods.mat-1.machines.compute.hwType=test' \
  --set 'pods.mat-1.machines.compute.hostCount=5' \
  2>&1 | grep -E "(mac_address_pool|hw_mac_address_ranges)" -A 3
# Pod mat-0
[mac_address_pool]
base = "02:00:00:00:00:00"
host_bits = 16

[hw_mac_address_ranges]
base = "02:01:00:00:00:00"
host_bits = 24
range_host_bits = 8

# Pod mat-1
[mac_address_pool]
base = "02:00:01:00:00:00"
host_bits = 16

[hw_mac_address_ranges]
base = "02:01:01:00:00:00"
host_bits = 24
range_host_bits = 8

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • New Features

    • Multi-pod deployments now automatically receive separate MAC address pools, reducing network conflicts between pods.
    • Added configuration options for customizing MAC address pools and hardware MAC ranges per pod.
    • Advanced users can disable automatic allocation and provide full custom configuration overrides.
  • Documentation

    • Expanded Helm chart guidance with configuration examples, allocation rules, scale requirements, and troubleshooting steps.
    • Updated multi-pod deployment requirements and clarified supported network and service configurations.

Walkthrough

The Helm chart adds deterministic, configurable per-pod MAC pools and hardware MAC ranges. Values, templates, multi-pod examples, and deployment documentation now describe automatic allocation and explicit override paths.

Changes

Per-pod MAC pool allocation

Layer / File(s) Summary
MAC allocation configuration
helm/charts/nico-machine-a-tron/values.yaml, helm-prereqs/values/machine-a-tron-multipod.yaml
Adds MAC pool defaults, hardware range settings, per-pod examples, and advanced TOML override guidance.
Deterministic MAC rendering
helm/charts/nico-machine-a-tron/templates/configmap.yaml
Sorts active pods, derives pod indexes, and renders configured or automatically generated MAC pool and hardware range TOML sections.
Usage documentation
docs/development/machine-a-tron-deployment.md, helm/charts/nico-machine-a-tron/README.md
Documents generated MAC formats, multi-pod examples, configuration overrides, and related chart usage guidance.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HelmValues
  participant ConfigMapTemplate
  participant MatToml
  HelmValues->>ConfigMapTemplate: Supply MAC defaults and pod overrides
  ConfigMapTemplate->>ConfigMapTemplate: Sort active pods and calculate podIndex
  ConfigMapTemplate->>MatToml: Render per-pod MAC pool sections
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately names the Helm MAC allocation feature added here.
Description check ✅ Passed The description matches the feature and test evidence, and is clearly related to the changeset.
Linked Issues check ✅ Passed The chart now generates per-pod MAC pools, supports host_bits and overrides, and separates standalone and NIC ranges as requested in #3698.
Out of Scope Changes check ✅ Passed The changes stay focused on MAC pool generation and supporting docs, with no clear unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@akorobkov-nvda
akorobkov-nvda requested a review from poroh July 17, 2026 22:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@helm/charts/nico-machine-a-tron/README.md`:
- Around line 47-51: Restore the TOML code-fence boundaries in
helm/charts/nico-machine-a-tron/README.md: at lines 47-51, open a toml fence
before [site_explorer] and close it after override_target_port; at lines
235-236, open a toml fence before [networks.pod-0-oob] and close it after the
final gateway. Ensure subsequent Markdown sections render normally.
- Around line 367-375: Update the troubleshooting section in the README by
changing the “Check service selector” and “Check pod labels” headings to
lower-level headings that remain nested under the parent section. Wrap each
kubectl command in its own closed bash code fence, keeping the existing commands
and making the Markdown structure render correctly.

In `@helm/charts/nico-machine-a-tron/templates/configmap.yaml`:
- Line 36: Update the $hwMacBasePrefix fallback in the ConfigMap template from
the single-octet "06" value to the documented two-octet default "02:01",
matching values.yaml and producing valid hardware address prefixes when
basePrefix is absent.
- Around line 54-60: Validate the computed $podIndex after the podList lookup
and fail template rendering when it is greater than or equal to 256, before the
mac_address_pool and hw_mac_address_ranges values format it with %02x. Preserve
the existing index calculation for valid indices and use the chart’s established
template failure mechanism.
- Around line 29-35: Update the macAddressPool and hwMacAddressRanges generation
toggle assignments, including $macPoolEnabled and $hwMacRangesEnabled, so
explicit false values are preserved instead of being replaced by default true.
Use dig with an enabled key default or an explicit key-presence check, while
retaining true as the fallback when the key is absent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 40c58f70-2d80-4a00-a75e-ab3bba7f42e5

📥 Commits

Reviewing files that changed from the base of the PR and between 0e59cee and 36866ad.

📒 Files selected for processing (5)
  • docs/development/machine-a-tron-deployment.md
  • helm-prereqs/values/machine-a-tron-multipod.yaml
  • helm/charts/nico-machine-a-tron/README.md
  • helm/charts/nico-machine-a-tron/templates/configmap.yaml
  • helm/charts/nico-machine-a-tron/values.yaml

Comment on lines +47 to 51
```text

---

## Mode 2: ClusterIP Mode (Scale Testing)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Restore code-fence boundaries around the TOML examples. Both fences begin after their intended snippets, causing following sections to render as literal text.

  • helm/charts/nico-machine-a-tron/README.md#L47-L51: open a toml fence before [site_explorer] and close it after override_target_port.
  • helm/charts/nico-machine-a-tron/README.md#L235-L236: open a toml fence before [networks.pod-0-oob] and close it after the final gateway.

As per path instructions, review Markdown for correctness and operator usability.

📍 Affects 1 file
  • helm/charts/nico-machine-a-tron/README.md#L47-L51 (this comment)
  • helm/charts/nico-machine-a-tron/README.md#L235-L236
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@helm/charts/nico-machine-a-tron/README.md` around lines 47 - 51, Restore the
TOML code-fence boundaries in helm/charts/nico-machine-a-tron/README.md: at
lines 47-51, open a toml fence before [site_explorer] and close it after
override_target_port; at lines 235-236, open a toml fence before
[networks.pod-0-oob] and close it after the final gateway. Ensure subsequent
Markdown sections render normally.

Source: Path instructions

Comment on lines +367 to +375
## Check service selector

kubectl -n nico-mat get svc nico-machine-a-tron-bmc-10-100-0-2 -o jsonpath='{.spec.selector}'

# Check pod labels
## Check pod labels

kubectl -n nico-mat get pods -l nvidia-infra-controller/pod-name=pod-0 --show-labels
```

```text

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Restore troubleshooting heading and command-block structure.

These ## headings escape the parent troubleshooting section, and the fence opens after both commands. Use lower-level headings and closed bash fences around each command.

As per path instructions, review Markdown for correctness and operator usability.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@helm/charts/nico-machine-a-tron/README.md` around lines 367 - 375, Update the
troubleshooting section in the README by changing the “Check service selector”
and “Check pod labels” headings to lower-level headings that remain nested under
the parent section. Wrap each kubectl command in its own closed bash code fence,
keeping the existing commands and making the Markdown structure render
correctly.

Source: Path instructions

Comment on lines +29 to +35
{{- $macPoolEnabled := $macPool.enabled | default true }}
{{- $macBasePrefix := $macPool.basePrefix | default "02:00" }}
{{- $macHostBits := $macPool.hostBits | default 16 }}

{{/* HW MAC address ranges config */}}
{{- $hwMacRanges := .Values.hwMacAddressRanges | default dict }}
{{- $hwMacRangesEnabled := $hwMacRanges.enabled | default true }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

cat >/tmp/mac-pools-disabled.yaml <<'EOF'
macAddressPool:
  enabled: false
hwMacAddressRanges:
  enabled: false
EOF

helm template mat helm/charts/nico-machine-a-tron \
  -f /tmp/mac-pools-disabled.yaml >/tmp/mac-pools-disabled.rendered.yaml

! rg -n '^\s*\[(mac_address_pool|hw_mac_address_ranges)\]' \
  /tmp/mac-pools-disabled.rendered.yaml

Repository: NVIDIA/infra-controller

Length of output: 204


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '\n== configmap template ==\n'
sed -n '1,120p' helm/charts/nico-machine-a-tron/templates/configmap.yaml

printf '\n== values references ==\n'
rg -n "macAddressPool|hwMacAddressRanges|basePrefix|hostBits|enabled" helm/charts/nico-machine-a-tron -g '!**/charts/**'

Repository: NVIDIA/infra-controller

Length of output: 4595


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '\n== chart values and docs ==\n'
rg -n "macAddressPool|hwMacAddressRanges|enabled|basePrefix|hostBits|rangeHostBits" \
  helm/charts/nico-machine-a-tron -g 'values*' -g 'README*' -g '*.md' -g '*.yaml'

printf '\n== surrounding values file ==\n'
for f in helm/charts/nico-machine-a-tron/values.yaml helm/charts/nico-machine-a-tron/values.yml; do
  if [ -f "$f" ]; then
    echo "--- $f"
    sed -n '1,260p' "$f"
  fi
done

Repository: NVIDIA/infra-controller

Length of output: 15683


Preserve explicit false for both generation toggles.
default true treats false as empty, so macAddressPool.enabled: false and hwMacAddressRanges.enabled: false still emit the generated sections. Use dig "enabled" true ... or an explicit key check so the documented disable path works.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@helm/charts/nico-machine-a-tron/templates/configmap.yaml` around lines 29 -
35, Update the macAddressPool and hwMacAddressRanges generation toggle
assignments, including $macPoolEnabled and $hwMacRangesEnabled, so explicit
false values are preserved instead of being replaced by default true. Use dig
with an enabled key default or an explicit key-presence check, while retaining
true as the fallback when the key is absent.

Source: Path instructions

{{/* HW MAC address ranges config */}}
{{- $hwMacRanges := .Values.hwMacAddressRanges | default dict }}
{{- $hwMacRangesEnabled := $hwMacRanges.enabled | default true }}
{{- $hwMacBasePrefix := $hwMacRanges.basePrefix | default "06" }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the documented two-octet hardware prefix as the fallback.

When hwMacAddressRanges.basePrefix is absent, "06" renders a five-octet address such as 06:00:00:00:00. It must match the valid "02:01" default in values.yaml.

Proposed fix
-{{- $hwMacBasePrefix := $hwMacRanges.basePrefix | default "06" }}
+{{- $hwMacBasePrefix := $hwMacRanges.basePrefix | default "02:01" }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- $hwMacBasePrefix := $hwMacRanges.basePrefix | default "06" }}
{{- $hwMacBasePrefix := $hwMacRanges.basePrefix | default "02:01" }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@helm/charts/nico-machine-a-tron/templates/configmap.yaml` at line 36, Update
the $hwMacBasePrefix fallback in the ConfigMap template from the single-octet
"06" value to the documented two-octet default "02:01", matching values.yaml and
producing valid hardware address prefixes when basePrefix is absent.

Comment on lines +54 to +60
{{/* Get pod index for MAC address pool */}}
{{- $podIndex := 0 }}
{{- range $i, $p := $podList }}
{{- if eq $p $podName }}
{{- $podIndex = $i }}
{{- end }}
{{- end }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

set -euo pipefail
sed -n '1,140p' helm/charts/nico-machine-a-tron/templates/configmap.yaml
printf '\n--- SEARCH MAC / POD INDEX ---\n'
rg -n "%02x|podIndex|MAC|mac" helm/charts/nico-machine-a-tron -S

Repository: NVIDIA/infra-controller

Length of output: 31333


Guard the pod-index MAC base at 256
Both mac_address_pool and hw_mac_address_ranges format $podIndex with %02x; once $podIndex >= 256, the generated octet becomes 100, so fail template rendering before emitting an invalid MAC prefix.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@helm/charts/nico-machine-a-tron/templates/configmap.yaml` around lines 54 -
60, Validate the computed $podIndex after the podList lookup and fail template
rendering when it is greater than or equal to 256, before the mac_address_pool
and hw_mac_address_ranges values format it with %02x. Preserve the existing
index calculation for valid indices and use the chart’s established template
failure mechanism.

@github-actions

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add mac address pool config to nico-machine-a-tron helm chart

2 participants