Skip to content

Commit

Permalink
Merge pull request #5270 from PanSpagetka/rosa-disc-size
Browse files Browse the repository at this point in the history
✨ Add VolumeSize parameter for RosaMachinePool
  • Loading branch information
k8s-ci-robot authored Jan 14, 2025
2 parents dac32b5 + 4eefcbd commit 07a93a5
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ spec:
description: The instance type to use, for example `r5.xlarge`.
Instance type ref; https://aws.amazon.com/ec2/instance-types/
type: string
volumeSize:
description: VolumeSize set the disk volume size for the default
workers machine pool in Gib. The default is 300 GiB.
maximum: 16384
minimum: 75
type: integer
type: object
domainPrefix:
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ spec:
Version specifies the OpenShift version of the nodes associated with this machinepool.
ROSAControlPlane version is used if not set.
type: string
volumeSize:
description: VolumeSize set the disk volume size for the machine pool,
in Gib. The default is 300 GiB.
maximum: 16384
minimum: 75
type: integer
required:
- instanceType
- nodePoolName
Expand Down
7 changes: 7 additions & 0 deletions controlplane/rosa/api/v1beta2/rosacontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ type DefaultMachinePoolSpec struct {
// must be equal or multiple of the availability zones count.
// +optional
Autoscaling *expinfrav1.RosaMachinePoolAutoScaling `json:"autoscaling,omitempty"`

// VolumeSize set the disk volume size for the default workers machine pool in Gib. The default is 300 GiB.
// +kubebuilder:validation:Minimum=75
// +kubebuilder:validation:Maximum=16384
// +immutable
// +optional
VolumeSize int `json:"volumeSize,omitempty"`
}

// AWSRolesRef contains references to various AWS IAM roles required for operators to make calls against the AWS API.
Expand Down
4 changes: 4 additions & 0 deletions controlplane/rosa/controllers/rosacontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,10 @@ func buildOCMClusterSpec(controlPlaneSpec rosacontrolplanev1.RosaControlPlaneSpe
ocmClusterSpec.NetworkType = networkSpec.NetworkType
}

if controlPlaneSpec.DefaultMachinePoolSpec.VolumeSize >= 75 {
ocmClusterSpec.MachinePoolRootDisk = &ocm.Volume{Size: controlPlaneSpec.DefaultMachinePoolSpec.VolumeSize}
}

// Set cluster compute autoscaling replicas
// In case autoscaling is not defined and multiple zones defined, set the compute nodes equal to the zones count.
if computeAutoscaling := controlPlaneSpec.DefaultMachinePoolSpec.Autoscaling; computeAutoscaling != nil {
Expand Down
7 changes: 7 additions & 0 deletions exp/api/v1beta2/rosamachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ type RosaMachinePoolSpec struct {
// +optional
AdditionalSecurityGroups []string `json:"additionalSecurityGroups,omitempty"`

// VolumeSize set the disk volume size for the machine pool, in Gib. The default is 300 GiB.
// +kubebuilder:validation:Minimum=75
// +kubebuilder:validation:Maximum=16384
// +immutable
// +optional
VolumeSize int `json:"volumeSize,omitempty"`

// ProviderIDList contain a ProviderID for each machine instance that's currently managed by this machine pool.
// +optional
ProviderIDList []string `json:"providerIDList,omitempty"`
Expand Down
4 changes: 4 additions & 0 deletions exp/controllers/rosamachinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ func nodePoolBuilder(rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec, machine
if rosaMachinePoolSpec.AdditionalTags != nil {
awsNodePool = awsNodePool.Tags(rosaMachinePoolSpec.AdditionalTags)
}
if rosaMachinePoolSpec.VolumeSize > 75 {
awsNodePool = awsNodePool.RootVolume(cmv1.NewAWSVolume().Size(rosaMachinePoolSpec.VolumeSize))
}
npBuilder.AWSNodePool(awsNodePool)

if rosaMachinePoolSpec.Version != "" {
Expand Down Expand Up @@ -514,6 +517,7 @@ func nodePoolToRosaMachinePoolSpec(nodePool *cmv1.NodePool) expinfrav1.RosaMachi
InstanceType: nodePool.AWSNodePool().InstanceType(),
TuningConfigs: nodePool.TuningConfigs(),
AdditionalSecurityGroups: nodePool.AWSNodePool().AdditionalSecurityGroupIds(),
VolumeSize: nodePool.AWSNodePool().RootVolume().Size(),
// nodePool.AWSNodePool().Tags() returns all tags including "system" tags if "fetchUserTagsOnly" parameter is not specified.
// TODO: enable when AdditionalTags day2 changes is supported.
// AdditionalTags: nodePool.AWSNodePool().Tags(),
Expand Down
1 change: 1 addition & 0 deletions exp/controllers/rosamachinepool_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func TestNodePoolToRosaMachinePoolSpec(t *testing.T) {
AutoRepair: true,
InstanceType: "m5.large",
TuningConfigs: []string{"config1"},
VolumeSize: 199,
NodeDrainGracePeriod: &metav1.Duration{
Duration: time.Minute * 10,
},
Expand Down

0 comments on commit 07a93a5

Please sign in to comment.