Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add VolumeSize parameter for RosaMachinePool #5270

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,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 @@ -219,6 +219,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
PanSpagetka marked this conversation as resolved.
Show resolved Hide resolved
// +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 @@ -957,6 +957,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 @@ -473,6 +473,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 @@ -513,6 +516,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
Loading