Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1alpha5/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,7 @@ func Convert_v1alpha5_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(

return nil
}

func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s conversion.Scope) error {
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in, out, s)
}
16 changes: 6 additions & 10 deletions api/v1alpha5/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions api/v1alpha6/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ func restorev1alpha7MachineSpec(previous *infrav1.OpenStackMachineSpec, dst *inf
// PropagateUplinkStatus has been added in v1alpha7.
// We restore the whole Ports since they are anyway immutable.
dst.Ports = previous.Ports
dst.AdditionalBlockDevices = previous.AdditionalBlockDevices
}

func restorev1alpha7Bastion(previous **infrav1.Bastion, dst **infrav1.Bastion) {
// PropagateUplinkStatus has been added in v1alpha7.
// We restore the whole Ports since they are anyway immutable.
if *previous != nil && (*previous).Instance.Ports != nil && *dst != nil && (*dst).Instance.Ports != nil {
(*dst).Instance.Ports = (*previous).Instance.Ports
if *previous != nil && *dst != nil {
restorev1alpha7MachineSpec(&(*previous).Instance, &(*dst).Instance)
}
}

Expand Down Expand Up @@ -646,3 +645,7 @@ func Convert_v1alpha6_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(

return nil
}

func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s apiconversion.Scope) error {
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in, out, s)
}
16 changes: 6 additions & 10 deletions api/v1alpha6/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/v1alpha7/openstackmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ type OpenStackMachineSpec struct {
// The volume metadata to boot from
RootVolume *RootVolume `json:"rootVolume,omitempty"`

// additionalBlockDevices is a list of specifications for additional block devices to attach to the server instance
// +optional
// +listType=map
// +listMapKey=name
AdditionalBlockDevices []AdditionalBlockDevice `json:"additionalBlockDevices,omitempty"`

// The server group to assign the machine to
ServerGroupID string `json:"serverGroupID,omitempty"`

Expand Down
57 changes: 57 additions & 0 deletions api/v1alpha7/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ limitations under the License.

package v1alpha7

// BlockDeviceType defines the type of block device to create.
type BlockDeviceType string

const (
// LocalBlockDevice is an ephemeral block device attached to the server.
LocalBlockDevice BlockDeviceType = "Local"

// VolumeBlockDevice is a volume block device attached to the server.
VolumeBlockDevice BlockDeviceType = "Volume"
)

// OpenStackMachineTemplateResource describes the data needed to create a OpenStackMachine from a template.
type OpenStackMachineTemplateResource struct {
// Spec is the specification of the desired behavior of the machine.
Expand Down Expand Up @@ -163,6 +174,52 @@ type RootVolume struct {
AvailabilityZone string `json:"availabilityZone,omitempty"`
}

// blockDeviceStorage is the storage type of a block device to create and
// contains additional storage options.
type BlockDeviceStorage struct {
// type is the type of block device to create.
// This can be either "Volume" or "Local".
// +kubebuilder:validation:Enum="Volume";"Local"
// +kubebuilder:validation:Required
Type BlockDeviceType `json:"type"`

// volume contains additional storage options for a volume block device.
// +optional
Volume *BlockDeviceVolume `json:"volume,omitempty"`
}

// blockDeviceVolume contains additional storage options for a volume block device.
type BlockDeviceVolume struct {
// type is the volume type of the volume.
// If omitted, the default volume type will be used.
// +optional
Type string `json:"type,omitempty"`

// availabilityZone is the volume availability zone to create the volume in.
// If omitted, the availability zone of the server will be used.
// +optional
AvailabilityZone string `json:"availabilityZone,omitempty"`
}

// additionalBlockDevice is a block device to attach to the server.
type AdditionalBlockDevice struct {
// name of the block device in the context of a machine.
// If the block device is a volume, the Cinder volume will be named
// as a combination of the machine name and this name.
// Also, this name will be used for tagging the block device.
// +kubebuilder:validation:Required
Name string `json:"name"`

// size is the size in GiB of the block device.
// +kubebuilder:validation:Required
Size int `json:"size"`

// storage specifies the storage type of the block device and
// additional storage options.
// +kubebuilder:validation:Required
Storage BlockDeviceStorage `json:"storage"`
}

// NetworkStatus contains basic information about an existing neutron network.
type NetworkStatus struct {
Name string `json:"name"`
Expand Down
58 changes: 58 additions & 0 deletions api/v1alpha7/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3770,6 +3770,62 @@ spec:
instance:
description: Instance for the bastion itself
properties:
additionalBlockDevices:
description: additionalBlockDevices is a list of specifications
for additional block devices to attach to the server instance
items:
description: additionalBlockDevice is a block device to
attach to the server.
properties:
name:
description: name of the block device in the context
of a machine. If the block device is a volume, the
Cinder volume will be named as a combination of the
machine name and this name. Also, this name will be
used for tagging the block device.
type: string
size:
description: size is the size in GiB of the block device.
type: integer
storage:
description: storage specifies the storage type of the
block device and additional storage options.
properties:
type:
description: type is the type of block device to
create. This can be either "Volume" or "Local".
enum:
- Volume
- Local
type: string
volume:
description: volume contains additional storage
options for a volume block device.
properties:
availabilityZone:
description: availabilityZone is the volume
availability zone to create the volume in.
If omitted, the availability zone of the server
will be used.
type: string
type:
description: type is the volume type of the
volume. If omitted, the default volume type
will be used.
type: string
type: object
required:
- type
type: object
required:
- name
- size
- storage
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
cloudName:
description: The name of the cloud to use from the clouds
secret
Expand Down
Loading