Skip to content

Commit a34cb32

Browse files
authored
Merge of #513
2 parents 35364da + af21841 commit a34cb32

File tree

7 files changed

+362
-33
lines changed

7 files changed

+362
-33
lines changed

api/v1beta1/tinkerbellmachine_types.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20+
tinkv1 "github.com/tinkerbell/tinkerbell/api/v1alpha1/tinkerbell"
2021
corev1 "k8s.io/api/core/v1"
2122
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2223
)
@@ -25,18 +26,8 @@ const (
2526
// MachineFinalizer allows ReconcileTinkerbellMachine to clean up Tinkerbell resources before
2627
// removing it from the apiserver.
2728
MachineFinalizer = "tinkerbellmachine.infrastructure.cluster.x-k8s.io"
28-
29-
// BootModeNetboot is the mode for networking booting.
30-
BootModeNetboot BootMode = "netboot"
31-
// BootModeISO is the mode for ISO booting. This is deprecated, use BootModeIsoboot instead.
32-
BootModeISO BootMode = "iso"
33-
// BootModeIsoboot is the mode for ISO booting.
34-
BootModeIsoboot BootMode = "isoboot"
3529
)
3630

37-
// BootMode defines the type of booting that will be done. i.e. netboot, iso, etc.
38-
type BootMode string
39-
4031
// TinkerbellMachineSpec defines the desired state of TinkerbellMachine.
4132
type TinkerbellMachineSpec struct {
4233
// ImageLookupFormat is the URL naming format to use for machine images when
@@ -102,15 +93,20 @@ type BootOptions struct {
10293
// MAC address is then used to retrieve hardware specific information such as
10394
// IPAM info, custom kernel cmd line args and populate the worker ID for the tink worker/agent.
10495
// For ex. the above format would be replaced to http://$IP:$Port/iso/<macAddress>/hook.iso
96+
//
97+
// BootMode must be set to "isoboot".
10598
// +optional
10699
// +kubebuilder:validation:Format=url
107100
ISOURL string `json:"isoURL,omitempty"`
108101

109-
// BootMode is the type of booting that will be done.
110-
// Must be one of "none", "netboot", "iso", or "isoboot".
102+
// BootMode is the type of booting that will be done. One of "netboot", "isoboot", or "customboot".
111103
// +optional
112-
// +kubebuilder:validation:Enum=none;netboot;iso;isoboot
113-
BootMode BootMode `json:"bootMode,omitempty"`
104+
// +kubebuilder:validation:Enum=netboot;isoboot;iso;customboot
105+
BootMode tinkv1.BootMode `json:"bootMode,omitempty"`
106+
107+
// CustombootConfig is the configuration for the "customboot" boot mode.
108+
// This allows users to define custom BMC Actions.
109+
CustombootConfig tinkv1.CustombootConfig `json:"custombootConfig,omitempty,omitzero"`
114110
}
115111

116112
// HardwareAffinity defines the required and preferred hardware affinities.

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_tinkerbellmachines.yaml

Lines changed: 169 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,177 @@ spec:
6666
description: BootOptions are options that control the booting of Hardware.
6767
properties:
6868
bootMode:
69-
description: |-
70-
BootMode is the type of booting that will be done.
71-
Must be one of "none", "netboot", "iso", or "isoboot".
69+
description: BootMode is the type of booting that will be done.
70+
One of "netboot", "isoboot", or "customboot".
7271
enum:
73-
- none
7472
- netboot
75-
- iso
7673
- isoboot
74+
- iso
75+
- customboot
7776
type: string
77+
custombootConfig:
78+
description: |-
79+
CustombootConfig is the configuration for the "customboot" boot mode.
80+
This allows users to define custom BMC Actions.
81+
properties:
82+
postActions:
83+
description: |-
84+
PostActions are the BMC Actions that will be run after all Workflow Actions have completed.
85+
In most cases these Actions should get a Machine into a state where it can be powered off or rebooted and remove any mounted virtual media.
86+
These Actions will be run only if the main Workflow Actions complete successfully.
87+
items:
88+
description: |-
89+
Action represents the action to be performed.
90+
A single task can only perform one type of action.
91+
For example either PowerAction or OneTimeBootDeviceAction.
92+
maxProperties: 1
93+
properties:
94+
bootDevice:
95+
description: BootDevice is the device to set as the
96+
first boot device on the Machine.
97+
properties:
98+
device:
99+
description: Device is the name of the device to
100+
set as the first boot device.
101+
type: string
102+
efiBoot:
103+
description: EFIBoot indicates whether the boot
104+
device should be set to efiboot mode.
105+
type: boolean
106+
persistent:
107+
description: Persistent indicates whether the boot
108+
device should be set persistently as the first
109+
boot device.
110+
type: boolean
111+
type: object
112+
oneTimeBootDeviceAction:
113+
description: OneTimeBootDeviceAction represents a baseboard
114+
management one time set boot device operation.
115+
properties:
116+
device:
117+
description: |-
118+
Devices represents the boot devices, in order for setting one time boot.
119+
Currently only the first device in the slice is used to set one time boot.
120+
items:
121+
description: BootDevice represents boot device
122+
of the Machine.
123+
type: string
124+
type: array
125+
efiBoot:
126+
description: EFIBoot instructs the machine to use
127+
EFI boot.
128+
type: boolean
129+
required:
130+
- device
131+
type: object
132+
powerAction:
133+
description: PowerAction represents a baseboard management
134+
power operation.
135+
enum:
136+
- "on"
137+
- "off"
138+
- soft
139+
- status
140+
- cycle
141+
- reset
142+
type: string
143+
virtualMediaAction:
144+
description: VirtualMediaAction represents a baseboard
145+
management virtual media insert/eject.
146+
properties:
147+
kind:
148+
description: Kind represents the kind of virtual
149+
media.
150+
type: string
151+
mediaURL:
152+
description: mediaURL represents the URL of the
153+
image to be inserted into the virtual media, or
154+
empty to eject media.
155+
type: string
156+
required:
157+
- kind
158+
type: object
159+
type: object
160+
type: array
161+
preparingActions:
162+
description: |-
163+
PreparingActions are the BMC Actions that will be run before any Workflow Actions.
164+
In most cases these Actions should get a Machine into a state where a Tink Agent is running.
165+
items:
166+
description: |-
167+
Action represents the action to be performed.
168+
A single task can only perform one type of action.
169+
For example either PowerAction or OneTimeBootDeviceAction.
170+
maxProperties: 1
171+
properties:
172+
bootDevice:
173+
description: BootDevice is the device to set as the
174+
first boot device on the Machine.
175+
properties:
176+
device:
177+
description: Device is the name of the device to
178+
set as the first boot device.
179+
type: string
180+
efiBoot:
181+
description: EFIBoot indicates whether the boot
182+
device should be set to efiboot mode.
183+
type: boolean
184+
persistent:
185+
description: Persistent indicates whether the boot
186+
device should be set persistently as the first
187+
boot device.
188+
type: boolean
189+
type: object
190+
oneTimeBootDeviceAction:
191+
description: OneTimeBootDeviceAction represents a baseboard
192+
management one time set boot device operation.
193+
properties:
194+
device:
195+
description: |-
196+
Devices represents the boot devices, in order for setting one time boot.
197+
Currently only the first device in the slice is used to set one time boot.
198+
items:
199+
description: BootDevice represents boot device
200+
of the Machine.
201+
type: string
202+
type: array
203+
efiBoot:
204+
description: EFIBoot instructs the machine to use
205+
EFI boot.
206+
type: boolean
207+
required:
208+
- device
209+
type: object
210+
powerAction:
211+
description: PowerAction represents a baseboard management
212+
power operation.
213+
enum:
214+
- "on"
215+
- "off"
216+
- soft
217+
- status
218+
- cycle
219+
- reset
220+
type: string
221+
virtualMediaAction:
222+
description: VirtualMediaAction represents a baseboard
223+
management virtual media insert/eject.
224+
properties:
225+
kind:
226+
description: Kind represents the kind of virtual
227+
media.
228+
type: string
229+
mediaURL:
230+
description: mediaURL represents the URL of the
231+
image to be inserted into the virtual media, or
232+
empty to eject media.
233+
type: string
234+
required:
235+
- kind
236+
type: object
237+
type: object
238+
type: array
239+
type: object
78240
isoURL:
79241
description: |-
80242
ISOURL is the URL of the ISO that will be one-time booted.
@@ -89,6 +251,8 @@ spec:
89251
MAC address is then used to retrieve hardware specific information such as
90252
IPAM info, custom kernel cmd line args and populate the worker ID for the tink worker/agent.
91253
For ex. the above format would be replaced to http://$IP:$Port/iso/<macAddress>/hook.iso
254+
255+
BootMode must be set to "isoboot".
92256
format: url
93257
type: string
94258
type: object

0 commit comments

Comments
 (0)