Skip to content

Commit f07637a

Browse files
committed
Fix Node Architecture Mismatch
Signed-off-by: Davanum Srinivas <[email protected]>
1 parent 07990ca commit f07637a

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

tilt/Tiltfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,31 @@ helm_resource(
7272
namespace_create('gpu-operator')
7373
namespace_create('nvsentinel')
7474

75+
# Detect architecture early for KWOK node creation
76+
arch = str(local('uname -m')).strip()
77+
# Normalize architecture names for Kubernetes
78+
if arch in ['arm64', 'aarch64']:
79+
k8s_arch = 'arm64'
80+
elif arch in ['x86_64', 'amd64']:
81+
k8s_arch = 'amd64'
82+
else:
83+
k8s_arch = 'amd64' # Default to amd64 for unknown architectures
84+
7585
skip_kwok_nodes = os.getenv('SKIP_KWOK_NODES_IN_TILT', '0') == '1'
7686

7787
if not skip_kwok_nodes:
7888
# Create regular GPU nodes (all NUM_GPU_NODES are regular nodes)
7989
kwok_node_template = str(read_file('./kwok-node-template.yaml'))
8090
for i in range(num_gpu_nodes):
81-
node_yaml = kwok_node_template.replace('PLACEHOLDER', str(i))
91+
node_yaml = kwok_node_template.replace('PLACEHOLDER', str(i)).replace('amd64', k8s_arch)
8292
k8s_yaml(blob(node_yaml))
8393

8494
# Create separate Kata test nodes (in addition to regular nodes)
8595
# These are named differently (kwok-kata-test-node-*) to avoid conflicts
8696
# Set NUM_KATA_TEST_NODES=0 to disable kata testing
8797
kwok_kata_test_node_template = str(read_file('./kwok-kata-test-node-template.yaml'))
8898
for i in range(num_kata_test_nodes):
89-
node_yaml = kwok_kata_test_node_template.replace('PLACEHOLDER', str(i))
99+
node_yaml = kwok_kata_test_node_template.replace('PLACEHOLDER', str(i)).replace('amd64', k8s_arch)
90100
k8s_yaml(blob(node_yaml))
91101
else:
92102
print("Skipping KWOK node creation in Tilt (SKIP_KWOK_NODES_IN_TILT=1)")
@@ -115,8 +125,8 @@ values_files = [
115125
if use_postgresql:
116126
values_files.append('../distros/kubernetes/nvsentinel/values-tilt-postgresql.yaml')
117127

118-
arch = str(local('uname -m')).strip()
119-
if arch in ['arm64', 'aarch64']:
128+
# Add ARM64-specific values if on ARM64 (arch already detected earlier)
129+
if k8s_arch == 'arm64':
120130
values_files.append('../distros/kubernetes/nvsentinel/values-tilt-arm64.yaml')
121131

122132
yaml = helm(

tilt/create-kwok-nodes.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,31 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2222
NODE_TEMPLATE="$SCRIPT_DIR/kwok-node-template.yaml"
2323
KATA_NODE_TEMPLATE="$SCRIPT_DIR/kwok-kata-test-node-template.yaml"
2424

25+
# Detect architecture and normalize for Kubernetes
26+
ARCH=$(uname -m)
27+
case "$ARCH" in
28+
arm64|aarch64)
29+
K8S_ARCH="arm64"
30+
;;
31+
x86_64|amd64)
32+
K8S_ARCH="amd64"
33+
;;
34+
*)
35+
K8S_ARCH="amd64" # Default to amd64
36+
;;
37+
esac
38+
39+
echo "Detected architecture: $ARCH (using k8s arch: $K8S_ARCH)"
40+
2541
echo "Creating $NUM_GPU_NODES regular KWOK GPU nodes..."
2642
for i in $(seq 0 $((NUM_GPU_NODES - 1))); do
27-
sed "s/PLACEHOLDER/$i/g" "$NODE_TEMPLATE" | kubectl apply -f - >/dev/null 2>&1 || true
43+
sed "s/PLACEHOLDER/$i/g; s/amd64/$K8S_ARCH/g" "$NODE_TEMPLATE" | kubectl apply -f - >/dev/null 2>&1 || true
2844
done
2945
echo "Created $NUM_GPU_NODES regular KWOK GPU nodes"
3046

3147
echo "Creating $NUM_KATA_TEST_NODES KWOK Kata test nodes..."
3248
for i in $(seq 0 $((NUM_KATA_TEST_NODES - 1))); do
33-
sed "s/PLACEHOLDER/$i/g" "$KATA_NODE_TEMPLATE" | kubectl apply -f - >/dev/null 2>&1 || true
49+
sed "s/PLACEHOLDER/$i/g; s/amd64/$K8S_ARCH/g" "$KATA_NODE_TEMPLATE" | kubectl apply -f - >/dev/null 2>&1 || true
3450
done
3551
echo "Created $NUM_KATA_TEST_NODES KWOK Kata test nodes"
3652

0 commit comments

Comments
 (0)