Skip to content

Add profile query param#3

Open
bmcdonald3 wants to merge 10 commits intoOpenCHAMI:mainfrom
bmcdonald3:profile-param
Open

Add profile query param#3
bmcdonald3 wants to merge 10 commits intoOpenCHAMI:mainfrom
bmcdonald3:profile-param

Conversation

@bmcdonald3
Copy link
Copy Markdown
Member

This PR implements phase 2 of the plan outlined in OpenCHAMI/roadmap#121 by adding a profile query param.

To test, first a "Default" configuration that points to the stable kernel is created.

$ go run ./cmd/client/main.go bootconfiguration create --spec '{"kernel":"http://boot.server/vmlinuz-stable", "params":"console=tty0", "hosts":["x1000c0s0b0n0"]}'
{
  "apiVersion": "v1",
  "kind": "BootConfiguration",
  "schemaVersion": "v1",
  "metadata": {
    "name": "",
    "uid": "boo-248b33d3",
    "createdAt": "2026-02-02T10:42:46.100635-08:00",
    "updatedAt": "2026-02-02T10:42:46.100635-08:00"
  },
  "spec": {
    "hosts": [
      "x1000c0s0b0n0"
    ],
    "kernel": "http://boot.server/vmlinuz-stable",
    "params": "console=tty0"
  },
  "status": {}
}

Next, a "Staging" configuration is added that points to the beta kernel, tagged with profile: staging.

$ go run ./cmd/client/main.go bootconfiguration create --spec '{"kernel":"http://boot.server/vmlinuz-beta", "params":"console=tty0", "hosts":["x1000c0s0b0n0"], "profile":"staging"}'
{
  "apiVersion": "v1",
  "kind": "BootConfiguration",
  "schemaVersion": "v1",
  "metadata": {
    "name": "",
    "uid": "boo-5034631c",
    "createdAt": "2026-02-02T10:42:52.153509-08:00",
    "updatedAt": "2026-02-02T10:42:52.153509-08:00"
  },
  "spec": {
    "hosts": [
      "x1000c0s0b0n0"
    ],
    "profile": "staging",
    "kernel": "http://boot.server/vmlinuz-beta",
    "params": "console=tty0"
  },
  "status": {}
}

Then, the node is registered so the Boot Service can resolve the XName.

$ go run ./cmd/client/main.go node create --spec '{"xname":"x1000c0s0b0n0", "nid":1000, "bootMac":"00:11:22:33:44:55"}'
{
  "apiVersion": "v1",
  "kind": "Node",
  "schemaVersion": "v1",
  "metadata": {
    "name": "",
    "uid": "nod-c0b9171c",
    "createdAt": "2026-02-02T10:43:35.000814-08:00",
    "updatedAt": "2026-02-02T10:43:35.000814-08:00"
  },
  "spec": {
    "xname": "x1000c0s0b0n0",
    "nid": 1000,
    "bootMac": "00:11:22:33:44:55"
  },
  "status": {}
}

Test A: Default Boot (No Profile)

Boot script requested without specifying a profile. The service correctly serves the stable kernel.

$ curl "http://localhost:8080/boot/v1/bootscript?host=x1000c0s0b0n0"
#!ipxe
# iPXE Boot Script
# Generated by OpenCHAMI Boot Service
# Node: x1000c0s0b0n0 (NID: 1000)
# Configuration:
# Role:

echo Starting boot for x1000c0s0b0n0
echo Using configuration:
echo Role:

# Configure network interface
dhcp

# Set boot parameters
set kernel http://boot.server/vmlinuz-stable
set params console=tty0

# Download and verify kernel
echo Downloading kernel: vmlinuz-stable
kernel ${kernel} ${params}

# Boot the system
echo Booting x1000c0s0b0n0...
boot

Test B: Staging Boot (Sticky Profile)

Boot script requested with ?profile=staging. The service correctly identifies the override and serves the beta kernel.

$ curl "http://localhost:8080/boot/v1/bootscript?host=x1000c0s0b0n0&profile=staging"
#!ipxe
# iPXE Boot Script
# Generated by OpenCHAMI Boot Service
# Node: x1000c0s0b0n0 (NID: 1000)
# Configuration:
# Role:

echo Starting boot for x1000c0s0b0n0
echo Using configuration:
echo Role:

# Configure network interface
dhcp

# Set boot parameters
set kernel http://boot.server/vmlinuz-beta
set params console=tty0

# Download and verify kernel
echo Downloading kernel: vmlinuz-beta
kernel ${kernel} ${params}

# Boot the system
echo Booting x1000c0s0b0n0...
boot

Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
@alexlovelltroy
Copy link
Copy Markdown
Member

merging this on top of the updates in #7 wasn't going to be pretty. I've moved the functionality across.

@alexlovelltroy alexlovelltroy mentioned this pull request Apr 7, 2026
13 tasks
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