From ead12b50bec1ca66e09a0bcad8bcc3961961e1a9 Mon Sep 17 00:00:00 2001 From: Nicholas Kuechler Date: Wed, 13 Nov 2024 11:45:19 -0600 Subject: [PATCH] feat: set raid config during ironic baremetal node enroll --- .../workflowtemplates/enroll-server.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/workflows/argo-events/workflowtemplates/enroll-server.yaml b/workflows/argo-events/workflowtemplates/enroll-server.yaml index f5cb09e5d..4bd8d5f63 100644 --- a/workflows/argo-events/workflowtemplates/enroll-server.yaml +++ b/workflows/argo-events/workflowtemplates/enroll-server.yaml @@ -23,6 +23,12 @@ spec: parameters: - name: device_id value: "{{steps.enroll-server.outputs.result}}" + - - name: openstack-set-baremetal-node-raid-config + template: openstack-set-baremetal-node-raid-config + arguments: + parameters: + - name: device_id + value: "{{steps.enroll-server.outputs.result}}" - - name: manage-server template: openstack-wait-cmd arguments: @@ -109,6 +115,45 @@ spec: - name: openstack-svc-acct secret: secretName: openstack-svc-acct + - name: openstack-set-baremetal-node-raid-config + inputs: + parameters: + - name: device_id + # https://rackerlabs.github.io/understack/user-guide/openstack-ironic/#setting-baremetal-node-flavor + script: + image: ghcr.io/rackerlabs/understack/openstack-client:2024.2-ubuntu_jammy + command: [sh] + source: | + echo "setting RAID1 config for node: {{inputs.parameters.device_id}}" + # create the raid1-config.json file. I find this easier to read + # than passing a big json string on command line + cat <<'EOF' >> raid1-config.json + { "logical_disks": + [ { "controller": "RAID.SL.1-1", + "is_root_volume": true, + "physical_disks": [ + "Disk.Bay.0:Enclosure.Internal.0-1:RAID.SL.1-1", + "Disk.Bay.1:Enclosure.Internal.0-1:RAID.SL.1-1" + ], + "raid_level": "1", + "size_gb": "MAX" + } + ] + } + EOF + # apply the target raid config to the node + openstack baremetal node set {{inputs.parameters.device_id}} --target-raid-config raid1-config.json + env: + - name: OS_CLOUD + value: understack + volumeMounts: + - mountPath: /etc/openstack + name: openstack-svc-acct + readOnly: true + volumes: + - name: openstack-svc-acct + secret: + secretName: openstack-svc-acct - name: openstack-state-cmd inputs: parameters: