@@ -60,6 +60,20 @@ type ServerPortSpec struct {
6060 PortRef * KubernetesNameRef `json:"portRef,omitempty"`
6161}
6262
63+ // ServerBootVolumeSpec defines the boot volume for boot-from-volume server creation.
64+ // When specified, the server boots from this volume instead of an image.
65+ type ServerBootVolumeSpec struct {
66+ // volumeRef is a reference to a Volume object. The volume must be
67+ // bootable (created from an image) and available before server creation.
68+ // +required
69+ VolumeRef KubernetesNameRef `json:"volumeRef,omitempty"`
70+
71+ // tag is the device tag applied to the volume.
72+ // +kubebuilder:validation:MaxLength:=255
73+ // +optional
74+ Tag * string `json:"tag,omitempty"`
75+ }
76+
6377// +kubebuilder:validation:MinProperties:=1
6478type ServerVolumeSpec struct {
6579 // volumeRef is a reference to a Volume object. Server creation will wait for
@@ -122,23 +136,32 @@ type ServerInterfaceStatus struct {
122136}
123137
124138// ServerResourceSpec contains the desired state of a server
139+ // +kubebuilder:validation:XValidation:rule="has(self.imageRef) || has(self.bootVolume)",message="either imageRef or bootVolume must be specified"
140+ // +kubebuilder:validation:XValidation:rule="!(has(self.imageRef) && has(self.bootVolume))",message="imageRef and bootVolume are mutually exclusive"
125141type ServerResourceSpec struct {
126142 // name will be the name of the created resource. If not specified, the
127143 // name of the ORC object will be used.
128144 // +optional
129145 Name * OpenStackName `json:"name,omitempty"`
130146
131147 // imageRef references the image to use for the server instance.
132- // NOTE: This is not required in case of boot from volume.
133- // +required
148+ // This field is required unless bootVolume is specified for boot-from- volume.
149+ // +optional
134150 // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="imageRef is immutable"
135- ImageRef KubernetesNameRef `json:"imageRef,omitempty"`
151+ ImageRef * KubernetesNameRef `json:"imageRef,omitempty"`
136152
137153 // flavorRef references the flavor to use for the server instance.
138154 // +required
139155 // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="flavorRef is immutable"
140156 FlavorRef KubernetesNameRef `json:"flavorRef,omitempty"`
141157
158+ // bootVolume specifies a volume to boot from instead of an image.
159+ // When specified, imageRef must be omitted. The volume must be
160+ // bootable (created from an image using imageRef in the Volume spec).
161+ // +optional
162+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="bootVolume is immutable"
163+ BootVolume * ServerBootVolumeSpec `json:"bootVolume,omitempty"`
164+
142165 // userData specifies data which will be made available to the server at
143166 // boot time, either via the metadata service or a config drive. It is
144167 // typically read by a configuration service such as cloud-init or ignition.
0 commit comments