1
1
---
2
2
apiVersion : argoproj.io/v1alpha1
3
3
metadata :
4
- name : enroll-server
4
+ name : enroll-server-clean
5
5
annotations :
6
6
workflows.argoproj.io/title : Perform server discovery and update Nautobot and Ironic
7
7
workflows.argoproj.io/description : |
8
8
Defined in `workflows/argo-events/workflowtemplates/enroll-server.yaml`
9
9
kind : WorkflowTemplate
10
10
spec :
11
11
entrypoint : main
12
+ serviceAccountName : workflow
12
13
arguments :
13
14
parameters :
14
15
- name : ip_address
@@ -28,10 +29,16 @@ spec:
28
29
arguments :
29
30
parameters :
30
31
- name : operation
31
- value : " manage"
32
+ value : manage
32
33
- name : device_id
33
34
value : " {{steps.enroll-server.outputs.result}}"
34
35
when : " {{steps.server-enroll-state.outputs.result}} == enroll"
36
+ - - name : clean-server
37
+ template : node-clean-cmd
38
+ arguments :
39
+ parameters :
40
+ - name : device_id
41
+ value : " {{steps.enroll-server.outputs.result}}"
35
42
- - name : openstack-set-baremetal-node-raid-config
36
43
template : openstack-set-baremetal-node-raid-config
37
44
arguments :
49
56
arguments :
50
57
parameters :
51
58
- name : operation
52
- value : " provide"
59
+ value : provide
53
60
- name : device_id
54
61
value : " {{steps.enroll-server.outputs.result}}"
55
62
when : " {{steps.server-manage-state.outputs.result}} == manageable"
@@ -75,18 +82,18 @@ spec:
75
82
name : understack-flavors
76
83
readOnly : true
77
84
env :
78
- - name : WF_NS
79
- value : " {{workflow.namespace}}"
80
- - name : WF_NAME
81
- value : " {{workflow.name}}"
82
- - name : WF_UID
83
- value : " {{workflow.uid}}"
84
- - name : FLAVORS_DIR
85
- valueFrom :
86
- configMapKeyRef :
87
- name : understack-flavors
88
- key : FLAVORS_DIR
89
- optional : true
85
+ - name : WF_NS
86
+ value : " {{workflow.namespace}}"
87
+ - name : WF_NAME
88
+ value : " {{workflow.name}}"
89
+ - name : WF_UID
90
+ value : " {{workflow.uid}}"
91
+ - name : FLAVORS_DIR
92
+ valueFrom :
93
+ configMapKeyRef :
94
+ name : understack-flavors
95
+ key : FLAVORS_DIR
96
+ optional : true
90
97
volumes :
91
98
- name : bmc-master
92
99
secret :
@@ -128,19 +135,49 @@ spec:
128
135
- name : openstack-svc-acct
129
136
secret :
130
137
secretName : openstack-svc-acct
138
+ - name : node-clean-cmd
139
+ inputs :
140
+ parameters :
141
+ - name : device_id
142
+ container :
143
+ image : ghcr.io/rackerlabs/understack/openstack-client:2024.2-ubuntu_jammy
144
+ command :
145
+ - openstack
146
+ args :
147
+ - baremetal
148
+ - node
149
+ - clean
150
+ - " {{inputs.parameters.device_id}}"
151
+ - --clean-steps
152
+ - ' [{"interface":"bios","step":"apply_configuration","args":{"settings":[{"name":"HttpDev1EnDis","value":"Enabled"},{"name":"HttpDev1Interface","value":"NIC.Slot.1-1"},{"name":"HttpDev1TlsMode","value":"None"}]}}]'
153
+ env :
154
+ - name : OS_CLOUD
155
+ value : understack
156
+ volumeMounts :
157
+ - mountPath : /etc/openstack
158
+ name : openstack-svc-acct
159
+ readOnly : true
160
+ volumes :
161
+ - name : openstack-svc-acct
162
+ secret :
163
+ secretName : openstack-svc-acct
131
164
- name : openstack-set-baremetal-node-raid-config
132
165
inputs :
133
166
parameters :
134
167
- name : device_id
135
- # https://rackerlabs.github.io/understack/user-guide/openstack-ironic/#setting-baremetal-node-flavor
136
168
script :
137
169
image : ghcr.io/rackerlabs/understack/openstack-client:2024.2-ubuntu_jammy
138
- command : [sh]
139
- source : |
170
+ command :
171
+ - sh
172
+ source : >
140
173
echo "setting RAID1 config for node: {{inputs.parameters.device_id}}"
174
+
141
175
# create the raid1-config.json file. I find this easier to read
176
+
142
177
# than passing a big json string on command line
178
+
143
179
cat <<'EOF' >> raid1-config.json
180
+
144
181
{ "logical_disks":
145
182
[ { "controller": "RAID.SL.1-1",
146
183
"is_root_volume": true,
@@ -153,9 +190,13 @@ spec:
153
190
}
154
191
]
155
192
}
193
+
156
194
EOF
195
+
157
196
# create the initial clean steps which will create a raid config
197
+
158
198
cat <<'EOF' >> raid-clean-steps.json
199
+
159
200
[
160
201
{
161
202
"interface": "raid",
@@ -166,10 +207,15 @@ spec:
166
207
"step": "create_configuration"
167
208
}
168
209
]
210
+
169
211
EOF
212
+
170
213
# apply the target raid config to the node
214
+
171
215
openstack baremetal node set {{inputs.parameters.device_id}} --target-raid-config raid1-config.json
216
+
172
217
# create the raid config
218
+
173
219
openstack baremetal node clean --wait 0 --clean-steps raid-clean-steps.json --disable-ramdisk {{inputs.parameters.device_id}}
174
220
env :
175
221
- name : OS_CLOUD
@@ -194,9 +240,9 @@ spec:
194
240
- baremetal
195
241
- node
196
242
- show
197
- - " -f "
243
+ - -f
198
244
- value
199
- - " -c "
245
+ - -c
200
246
- provision_state
201
247
- " {{inputs.parameters.device_id}}"
202
248
env :
0 commit comments