Skip to content

Commit 07a93a5

Browse files
authored
Merge pull request #5270 from PanSpagetka/rosa-disc-size
✨ Add VolumeSize parameter for RosaMachinePool
2 parents dac32b5 + 4eefcbd commit 07a93a5

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
@@ -210,6 +210,12 @@ spec:
210210
description: The instance type to use, for example `r5.xlarge`.
211211
Instance type ref; https://aws.amazon.com/ec2/instance-types/
212212
type: string
213+
volumeSize:
214+
description: VolumeSize set the disk volume size for the default
215+
workers machine pool in Gib. The default is 300 GiB.
216+
maximum: 16384
217+
minimum: 75
218+
type: integer
213219
type: object
214220
domainPrefix:
215221
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
@@ -214,6 +214,12 @@ spec:
214214
Version specifies the OpenShift version of the nodes associated with this machinepool.
215215
ROSAControlPlane version is used if not set.
216216
type: string
217+
volumeSize:
218+
description: VolumeSize set the disk volume size for the machine pool,
219+
in Gib. The default is 300 GiB.
220+
maximum: 16384
221+
minimum: 75
222+
type: integer
217223
required:
218224
- instanceType
219225
- 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
@@ -963,6 +963,10 @@ func buildOCMClusterSpec(controlPlaneSpec rosacontrolplanev1.RosaControlPlaneSpe
963963
ocmClusterSpec.NetworkType = networkSpec.NetworkType
964964
}
965965

966+
if controlPlaneSpec.DefaultMachinePoolSpec.VolumeSize >= 75 {
967+
ocmClusterSpec.MachinePoolRootDisk = &ocm.Volume{Size: controlPlaneSpec.DefaultMachinePoolSpec.VolumeSize}
968+
}
969+
966970
// Set cluster compute autoscaling replicas
967971
// In case autoscaling is not defined and multiple zones defined, set the compute nodes equal to the zones count.
968972
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
@@ -474,6 +474,9 @@ func nodePoolBuilder(rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec, machine
474474
if rosaMachinePoolSpec.AdditionalTags != nil {
475475
awsNodePool = awsNodePool.Tags(rosaMachinePoolSpec.AdditionalTags)
476476
}
477+
if rosaMachinePoolSpec.VolumeSize > 75 {
478+
awsNodePool = awsNodePool.RootVolume(cmv1.NewAWSVolume().Size(rosaMachinePoolSpec.VolumeSize))
479+
}
477480
npBuilder.AWSNodePool(awsNodePool)
478481

479482
if rosaMachinePoolSpec.Version != "" {
@@ -514,6 +517,7 @@ func nodePoolToRosaMachinePoolSpec(nodePool *cmv1.NodePool) expinfrav1.RosaMachi
514517
InstanceType: nodePool.AWSNodePool().InstanceType(),
515518
TuningConfigs: nodePool.TuningConfigs(),
516519
AdditionalSecurityGroups: nodePool.AWSNodePool().AdditionalSecurityGroupIds(),
520+
VolumeSize: nodePool.AWSNodePool().RootVolume().Size(),
517521
// nodePool.AWSNodePool().Tags() returns all tags including "system" tags if "fetchUserTagsOnly" parameter is not specified.
518522
// TODO: enable when AdditionalTags day2 changes is supported.
519523
// 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)