Skip to content

Commit 4eefcbd

Browse files
committed
Add VolumeSize for rosa machine pool
1 parent 85759ce commit 4eefcbd

File tree

7 files changed

+35
-0
lines changed

7 files changed

+35
-0
lines changed

config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ spec:
213213
description: The instance type to use, for example `r5.xlarge`.
214214
Instance type ref; https://aws.amazon.com/ec2/instance-types/
215215
type: string
216+
volumeSize:
217+
description: VolumeSize set the disk volume size for the default
218+
workers machine pool in Gib. The default is 300 GiB.
219+
maximum: 16384
220+
minimum: 75
221+
type: integer
216222
type: object
217223
domainPrefix:
218224
description: |-

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ spec:
219219
Version specifies the OpenShift version of the nodes associated with this machinepool.
220220
ROSAControlPlane version is used if not set.
221221
type: string
222+
volumeSize:
223+
description: VolumeSize set the disk volume size for the machine pool,
224+
in Gib. The default is 300 GiB.
225+
maximum: 16384
226+
minimum: 75
227+
type: integer
222228
required:
223229
- instanceType
224230
- nodePoolName

controlplane/rosa/api/v1beta2/rosacontrolplane_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,13 @@ type DefaultMachinePoolSpec struct {
308308
// must be equal or multiple of the availability zones count.
309309
// +optional
310310
Autoscaling *expinfrav1.RosaMachinePoolAutoScaling `json:"autoscaling,omitempty"`
311+
312+
// VolumeSize set the disk volume size for the default workers machine pool in Gib. The default is 300 GiB.
313+
// +kubebuilder:validation:Minimum=75
314+
// +kubebuilder:validation:Maximum=16384
315+
// +immutable
316+
// +optional
317+
VolumeSize int `json:"volumeSize,omitempty"`
311318
}
312319

313320
// AWSRolesRef contains references to various AWS IAM roles required for operators to make calls against the AWS API.

controlplane/rosa/controllers/rosacontrolplane_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,10 @@ func buildOCMClusterSpec(controlPlaneSpec rosacontrolplanev1.RosaControlPlaneSpe
957957
ocmClusterSpec.NetworkType = networkSpec.NetworkType
958958
}
959959

960+
if controlPlaneSpec.DefaultMachinePoolSpec.VolumeSize >= 75 {
961+
ocmClusterSpec.MachinePoolRootDisk = &ocm.Volume{Size: controlPlaneSpec.DefaultMachinePoolSpec.VolumeSize}
962+
}
963+
960964
// Set cluster compute autoscaling replicas
961965
// In case autoscaling is not defined and multiple zones defined, set the compute nodes equal to the zones count.
962966
if computeAutoscaling := controlPlaneSpec.DefaultMachinePoolSpec.Autoscaling; computeAutoscaling != nil {

exp/api/v1beta2/rosamachinepool_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ type RosaMachinePoolSpec struct {
9393
// +optional
9494
AdditionalSecurityGroups []string `json:"additionalSecurityGroups,omitempty"`
9595

96+
// VolumeSize set the disk volume size for the machine pool, in Gib. The default is 300 GiB.
97+
// +kubebuilder:validation:Minimum=75
98+
// +kubebuilder:validation:Maximum=16384
99+
// +immutable
100+
// +optional
101+
VolumeSize int `json:"volumeSize,omitempty"`
102+
96103
// ProviderIDList contain a ProviderID for each machine instance that's currently managed by this machine pool.
97104
// +optional
98105
ProviderIDList []string `json:"providerIDList,omitempty"`

exp/controllers/rosamachinepool_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,9 @@ func nodePoolBuilder(rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec, machine
473473
if rosaMachinePoolSpec.AdditionalTags != nil {
474474
awsNodePool = awsNodePool.Tags(rosaMachinePoolSpec.AdditionalTags)
475475
}
476+
if rosaMachinePoolSpec.VolumeSize > 75 {
477+
awsNodePool = awsNodePool.RootVolume(cmv1.NewAWSVolume().Size(rosaMachinePoolSpec.VolumeSize))
478+
}
476479
npBuilder.AWSNodePool(awsNodePool)
477480

478481
if rosaMachinePoolSpec.Version != "" {
@@ -513,6 +516,7 @@ func nodePoolToRosaMachinePoolSpec(nodePool *cmv1.NodePool) expinfrav1.RosaMachi
513516
InstanceType: nodePool.AWSNodePool().InstanceType(),
514517
TuningConfigs: nodePool.TuningConfigs(),
515518
AdditionalSecurityGroups: nodePool.AWSNodePool().AdditionalSecurityGroupIds(),
519+
VolumeSize: nodePool.AWSNodePool().RootVolume().Size(),
516520
// nodePool.AWSNodePool().Tags() returns all tags including "system" tags if "fetchUserTagsOnly" parameter is not specified.
517521
// TODO: enable when AdditionalTags day2 changes is supported.
518522
// AdditionalTags: nodePool.AWSNodePool().Tags(),

exp/controllers/rosamachinepool_controller_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func TestNodePoolToRosaMachinePoolSpec(t *testing.T) {
2424
AutoRepair: true,
2525
InstanceType: "m5.large",
2626
TuningConfigs: []string{"config1"},
27+
VolumeSize: 199,
2728
NodeDrainGracePeriod: &metav1.Duration{
2829
Duration: time.Minute * 10,
2930
},

0 commit comments

Comments
 (0)