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
18 changes: 18 additions & 0 deletions api/v1alpha5/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,21 @@ func Convert_v1alpha5_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(
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)
}

func Convert_v1alpha7_RootVolume_To_v1alpha5_RootVolume(in *infrav1.RootVolume, out *RootVolume, s conversion.Scope) error {
// UseMachineAZ = false cannot be represented in v1alpha5
return autoConvert_v1alpha7_RootVolume_To_v1alpha5_RootVolume(in, out, s)
}

func Convert_v1alpha5_RootVolume_To_v1alpha7_RootVolume(in *RootVolume, out *infrav1.RootVolume, s conversion.Scope) error {
if err := autoConvert_v1alpha5_RootVolume_To_v1alpha7_RootVolume(in, out, s); err != nil {
return err
}

// UseMachineAZ was the default behaviour in v1alpha5 when AvailabilityZone was not specified, but in v1alpha7 the default is to use no AZ.
if in.AvailabilityZone == "" {
out.UseMachineAZ = true
}

return nil
}
51 changes: 29 additions & 22 deletions api/v1alpha5/zz_generated.conversion.go

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

23 changes: 23 additions & 0 deletions api/v1alpha6/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ func restorev1alpha7MachineSpec(previous *infrav1.OpenStackMachineSpec, dst *inf
// We restore the whole Ports since they are anyway immutable.
dst.Ports = previous.Ports
dst.AdditionalBlockDevices = previous.AdditionalBlockDevices

if previous.RootVolume != nil && dst.RootVolume != nil {
// UseMachineAZ = false cannot be represented in v1alpha6
dst.RootVolume.UseMachineAZ = previous.RootVolume.UseMachineAZ
}
}

func restorev1alpha7Bastion(previous **infrav1.Bastion, dst **infrav1.Bastion) {
Expand Down Expand Up @@ -659,3 +664,21 @@ func Convert_v1alpha6_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(
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)
}

func Convert_v1alpha7_RootVolume_To_v1alpha6_RootVolume(in *infrav1.RootVolume, out *RootVolume, s apiconversion.Scope) error {
// UseMachineAZ = false cannot be represented in v1alpha6
return autoConvert_v1alpha7_RootVolume_To_v1alpha6_RootVolume(in, out, s)
}

func Convert_v1alpha6_RootVolume_To_v1alpha7_RootVolume(in *RootVolume, out *infrav1.RootVolume, s apiconversion.Scope) error {
if err := autoConvert_v1alpha6_RootVolume_To_v1alpha7_RootVolume(in, out, s); err != nil {
return err
}

// UseMachineAZ was the default behaviour in v1alpha6 when AvailabilityZone was not specified, but in v1alpha7 the default is to use no AZ.
if in.AvailabilityZone == "" {
out.UseMachineAZ = true
}

return nil
}
51 changes: 29 additions & 22 deletions api/v1alpha6/zz_generated.conversion.go

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

24 changes: 22 additions & 2 deletions api/v1alpha7/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,22 @@ type BastionStatus struct {
}

type RootVolume struct {
Size int `json:"diskSize,omitempty"`
VolumeType string `json:"volumeType,omitempty"`
// Size specifies the root volume size in GB.
// +required
Size int `json:"diskSize,omitempty"`

// VolumeType specifies the Cinder Volume Type to use for the root volume
VolumeType string `json:"volumeType,omitempty"`

// AvailabilityZone specifies the Cinder Availability Zone to use for the root volume.
// Leave empty to allow Cinder to schedule the volume without an availability zone.
AvailabilityZone string `json:"availabilityZone,omitempty"`

// UseMachineAZ specifies that the root volume should be created in a cinder
// availability zone with the same name as the nova availability zone of the server,
// if any.
// It is an error to specify both AvailabilityZone and UseMachineAZ.
UseMachineAZ bool `json:"useMachineAZ,omitempty"`
}

// BlockDeviceStorage is the storage type of a block device to create and
Expand Down Expand Up @@ -195,6 +208,13 @@ type BlockDeviceVolume struct {
// further information.
// +optional
AvailabilityZone string `json:"availabilityZone,omitempty"`

// UseMachineAZ specifies that the root volume should be created in a cinder
// availability zone with the same name as the nova availability zone of the server,
// if any.
// It is an error to specify both AvailabilityZone and UseMachineAZ.
// +optional
UseMachineAZ bool `json:"useMachineAZ,omitempty"`
}

// AdditionalBlockDevice is a block device to attach to the server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3818,6 +3818,14 @@ spec:
volume type that is configured in the OpenStack
cloud will be used.
type: string
useMachineAZ:
description: UseMachineAZ specifies that the
root volume should be created in a cinder
availability zone with the same name as the
nova availability zone of the server, if any.
It is an error to specify both AvailabilityZone
and UseMachineAZ.
type: boolean
type: object
required:
- type
Expand Down Expand Up @@ -4084,10 +4092,24 @@ spec:
description: The volume metadata to boot from
properties:
availabilityZone:
description: AvailabilityZone specifies the Cinder Availability
Zone to use for the root volume. Leave empty to allow
Cinder to schedule the volume without an availability
zone.
type: string
diskSize:
description: Size specifies the root volume size in GB.
type: integer
useMachineAZ:
description: UseMachineAZ specifies that the root volume
should be created in a cinder availability zone with
the same name as the nova availability zone of the server,
if any. It is an error to specify both AvailabilityZone
and UseMachineAZ.
type: boolean
volumeType:
description: VolumeType specifies the Cinder Volume Type
to use for the root volume
type: string
type: object
securityGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,15 @@ spec:
configured in the OpenStack cloud
will be used.
type: string
useMachineAZ:
description: UseMachineAZ specifies
that the root volume should be created
in a cinder availability zone with
the same name as the nova availability
zone of the server, if any. It is
an error to specify both AvailabilityZone
and UseMachineAZ.
type: boolean
type: object
required:
- type
Expand Down Expand Up @@ -1940,10 +1949,25 @@ spec:
description: The volume metadata to boot from
properties:
availabilityZone:
description: AvailabilityZone specifies the Cinder
Availability Zone to use for the root volume.
Leave empty to allow Cinder to schedule the
volume without an availability zone.
type: string
diskSize:
description: Size specifies the root volume size
in GB.
type: integer
useMachineAZ:
description: UseMachineAZ specifies that the root
volume should be created in a cinder availability
zone with the same name as the nova availability
zone of the server, if any. It is an error to
specify both AvailabilityZone and UseMachineAZ.
type: boolean
volumeType:
description: VolumeType specifies the Cinder Volume
Type to use for the root volume
type: string
type: object
securityGroups:
Expand Down
Loading