Skip to content

fix(templates): runtime Kubernetes arch detection for arm64#663

Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/arm64-kubernetes-arch-default
Feb 13, 2026
Merged

fix(templates): runtime Kubernetes arch detection for arm64#663
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/arm64-kubernetes-arch-default

Conversation

@ArangoGutierrez
Copy link
Collaborator

Summary

  • Replace hardcoded amd64 default for Kubernetes arch with runtime detection
  • Use dpkg --print-architecture (falls back to uname -m mapping)
  • Affects kubeadm, kubelet, kubectl, CNI plugins, and crictl binary downloads
  • User-specified Arch still takes precedence
  • Updated all 3 kubeadm template variants (standard, legacy, multinode)

Test plan

  • Unit tests: empty Arch produces runtime detection in template (3 template variants)
  • Unit tests: explicit Arch produces hardcoded value in template
  • go test ./pkg/provisioner/templates/... passes
  • golangci-lint run ./... passes (0 issues)
  • CI passes

Copilot AI review requested due to automatic review settings February 13, 2026 10:50
@coveralls
Copy link

coveralls commented Feb 13, 2026

Pull Request Test Coverage Report for Build 21984708330

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 47.481%

Totals Coverage Status
Change from base Build 21955389842: -0.02%
Covered Lines: 2498
Relevant Lines: 5261

💛 - Coveralls

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Kubernetes provisioner templates to avoid hardcoding amd64 as the default architecture, instead emitting runtime architecture detection logic when spec.kubernetes.arch is not provided—improving support for arm64 environments.

Changes:

  • Switched kubeadm (release/git/latest) templates from ARCH="{{.Arch}}" to an if .Arch branch that otherwise detects arch at runtime via dpkg --print-architecture with a uname -m fallback mapping.
  • Updated NewKubernetes defaults/tests so Arch is empty by default (meaning “detect at runtime”).
  • Added unit tests asserting the rendered templates include runtime detection when Arch is empty, and hardcode when Arch is explicitly set.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/provisioner/templates/kubernetes.go Emits runtime arch detection in kubeadm template variants and stops defaulting Arch to amd64 in NewKubernetes.
pkg/provisioner/templates/kubernetes_test.go Updates expectations for default Arch and adds coverage for the new template rendering behavior.

Comment on lines 1546 to +1549
if env.Spec.Kubernetes.Arch != "" {
kubernetes.Arch = env.Spec.Kubernetes.Arch
} else {
kubernetes.Arch = "amd64"
}
// When Arch is empty, the template uses runtime detection
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

NewKubernetes now leaves kubernetes.Arch empty when the user doesn’t specify spec.kubernetes.arch. That works for the kubernetes.go kubeadm templates because they added runtime detection, but it breaks other kubeadm scripts that still render ARCH="{{.Arch}}" (e.g. KubeadmInitTemplate / KubeadmPrereqTemplate), producing ARCH="" and invalid download URLs like .../bin/linux//kubectl.

Suggested fix: apply the same runtime-detection logic in those other templates (preferred), or keep a non-empty default in NewKubernetes and only use runtime detection in templates that explicitly opt into it.

Copilot uses AI. Check for mistakes.
…ng to amd64

When the user doesn't explicitly set Kubernetes.Arch, use runtime
detection (dpkg --print-architecture) instead of hardcoding "amd64".
This ensures arm64 nodes download the correct architecture binaries
for kubeadm, kubelet, kubectl, CNI plugins, and crictl.

The user can still explicitly set Arch to override runtime detection.

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
@ArangoGutierrez ArangoGutierrez force-pushed the fix/arm64-kubernetes-arch-default branch from d601033 to e38ecca Compare February 13, 2026 11:11
@ArangoGutierrez ArangoGutierrez merged commit c8f5e71 into NVIDIA:main Feb 13, 2026
19 checks passed
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.

2 participants