Skip to content

Commit ade1ed0

Browse files
authored
Merge pull request #1668 from stackhpc/feature/data-volumes
✨ Additional data volumes for machines
2 parents c73d55d + 94d9690 commit ade1ed0

19 files changed

+668
-194
lines changed

api/v1alpha5/conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,7 @@ func Convert_v1alpha5_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(
433433

434434
return nil
435435
}
436+
437+
func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s conversion.Scope) error {
438+
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in, out, s)
439+
}

api/v1alpha5/zz_generated.conversion.go

Lines changed: 6 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha6/conversion.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,12 @@ func restorev1alpha7MachineSpec(previous *infrav1.OpenStackMachineSpec, dst *inf
6060
// PropagateUplinkStatus has been added in v1alpha7.
6161
// We restore the whole Ports since they are anyway immutable.
6262
dst.Ports = previous.Ports
63+
dst.AdditionalBlockDevices = previous.AdditionalBlockDevices
6364
}
6465

6566
func restorev1alpha7Bastion(previous **infrav1.Bastion, dst **infrav1.Bastion) {
66-
// PropagateUplinkStatus has been added in v1alpha7.
67-
// We restore the whole Ports since they are anyway immutable.
68-
if *previous != nil && (*previous).Instance.Ports != nil && *dst != nil && (*dst).Instance.Ports != nil {
69-
(*dst).Instance.Ports = (*previous).Instance.Ports
67+
if *previous != nil && *dst != nil {
68+
restorev1alpha7MachineSpec(&(*previous).Instance, &(*dst).Instance)
7069
}
7170
}
7271

@@ -646,3 +645,7 @@ func Convert_v1alpha6_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(
646645

647646
return nil
648647
}
648+
649+
func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s apiconversion.Scope) error {
650+
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in, out, s)
651+
}

api/v1alpha6/zz_generated.conversion.go

Lines changed: 6 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha7/openstackmachine_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ type OpenStackMachineSpec struct {
8484
// The volume metadata to boot from
8585
RootVolume *RootVolume `json:"rootVolume,omitempty"`
8686

87+
// AdditionalBlockDevices is a list of specifications for additional block devices to attach to the server instance
88+
// +listType=map
89+
// +listMapKey=name
90+
AdditionalBlockDevices []AdditionalBlockDevice `json:"additionalBlockDevices,omitempty"`
91+
8792
// The server group to assign the machine to
8893
ServerGroupID string `json:"serverGroupID,omitempty"`
8994

api/v1alpha7/types.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,20 @@ type RootVolume struct {
163163
AvailabilityZone string `json:"availabilityZone,omitempty"`
164164
}
165165

166+
type AdditionalBlockDevice struct {
167+
// Name of the Cinder volume in the context of a machine.
168+
// It will be combined with the machine name to make the actual volume name.
169+
Name string `json:"name"`
170+
// Size is the size in GB of the volume.
171+
Size int `json:"diskSize"`
172+
// VolumeType is the volume type of the volume.
173+
// If omitted, the default type will be used.
174+
VolumeType string `json:"volumeType,omitempty"`
175+
// AvailabilityZone is the volume availability zone to create the volume in.
176+
// If omitted, the availability zone of the server will be used.
177+
AvailabilityZone string `json:"availabilityZone,omitempty"`
178+
}
179+
166180
// NetworkStatus contains basic information about an existing neutron network.
167181
type NetworkStatus struct {
168182
Name string `json:"name"`

api/v1alpha7/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
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_openstackclusters.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3770,6 +3770,36 @@ spec:
37703770
instance:
37713771
description: Instance for the bastion itself
37723772
properties:
3773+
additionalBlockDevices:
3774+
description: AdditionalBlockDevices is a list of specifications
3775+
for additional block devices to attach to the server instance
3776+
items:
3777+
properties:
3778+
availabilityZone:
3779+
description: AvailabilityZone is the volume availability
3780+
zone to create the volume in. If omitted, the availability
3781+
zone of the server will be used.
3782+
type: string
3783+
diskSize:
3784+
description: Size is the size in GB of the volume.
3785+
type: integer
3786+
name:
3787+
description: Name of the Cinder volume in the context
3788+
of a machine. It will be combined with the machine
3789+
name to make the actual volume name.
3790+
type: string
3791+
volumeType:
3792+
description: VolumeType is the volume type of the volume.
3793+
If omitted, the default type will be used.
3794+
type: string
3795+
required:
3796+
- diskSize
3797+
- name
3798+
type: object
3799+
type: array
3800+
x-kubernetes-list-map-keys:
3801+
- name
3802+
x-kubernetes-list-type: map
37733803
cloudName:
37743804
description: The name of the cloud to use from the clouds
37753805
secret

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,40 @@ spec:
16101610
instance:
16111611
description: Instance for the bastion itself
16121612
properties:
1613+
additionalBlockDevices:
1614+
description: AdditionalBlockDevices is a list of specifications
1615+
for additional block devices to attach to the server
1616+
instance
1617+
items:
1618+
properties:
1619+
availabilityZone:
1620+
description: AvailabilityZone is the volume
1621+
availability zone to create the volume in.
1622+
If omitted, the availability zone of the server
1623+
will be used.
1624+
type: string
1625+
diskSize:
1626+
description: Size is the size in GB of the volume.
1627+
type: integer
1628+
name:
1629+
description: Name of the Cinder volume in the
1630+
context of a machine. It will be combined
1631+
with the machine name to make the actual volume
1632+
name.
1633+
type: string
1634+
volumeType:
1635+
description: VolumeType is the volume type of
1636+
the volume. If omitted, the default type will
1637+
be used.
1638+
type: string
1639+
required:
1640+
- diskSize
1641+
- name
1642+
type: object
1643+
type: array
1644+
x-kubernetes-list-map-keys:
1645+
- name
1646+
x-kubernetes-list-type: map
16131647
cloudName:
16141648
description: The name of the cloud to use from the
16151649
clouds secret

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,36 @@ spec:
11591159
spec:
11601160
description: OpenStackMachineSpec defines the desired state of OpenStackMachine.
11611161
properties:
1162+
additionalBlockDevices:
1163+
description: AdditionalBlockDevices is a list of specifications for
1164+
additional block devices to attach to the server instance
1165+
items:
1166+
properties:
1167+
availabilityZone:
1168+
description: AvailabilityZone is the volume availability zone
1169+
to create the volume in. If omitted, the availability zone
1170+
of the server will be used.
1171+
type: string
1172+
diskSize:
1173+
description: Size is the size in GB of the volume.
1174+
type: integer
1175+
name:
1176+
description: Name of the Cinder volume in the context of a machine.
1177+
It will be combined with the machine name to make the actual
1178+
volume name.
1179+
type: string
1180+
volumeType:
1181+
description: VolumeType is the volume type of the volume. If
1182+
omitted, the default type will be used.
1183+
type: string
1184+
required:
1185+
- diskSize
1186+
- name
1187+
type: object
1188+
type: array
1189+
x-kubernetes-list-map-keys:
1190+
- name
1191+
x-kubernetes-list-type: map
11621192
cloudName:
11631193
description: The name of the cloud to use from the clouds secret
11641194
type: string

0 commit comments

Comments
 (0)