Skip to content

Commit c9cff82

Browse files
Merge pull request #3241 from olucasfreitas/OCM-24858-machinepool-default-m7i
OCM-24858 | fix: update the default machinepool instance type
2 parents 1835c3f + 2ab4c96 commit c9cff82

5 files changed

Lines changed: 22 additions & 18 deletions

File tree

cmd/create/machinepool/options.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"github.com/openshift/rosa/pkg/reporter"
66
)
77

8-
const instanceType = "m5.xlarge"
9-
108
type CreateMachinepoolOptions struct {
119
reporter reporter.Logger
1210

@@ -15,7 +13,7 @@ type CreateMachinepoolOptions struct {
1513

1614
func NewCreateMachinepoolUserOptions() *mpOpts.CreateMachinepoolUserOptions {
1715
return &mpOpts.CreateMachinepoolUserOptions{
18-
InstanceType: instanceType,
16+
InstanceType: mpOpts.DefaultInstanceType,
1917
AutoscalingEnabled: false,
2018
MultiAvailabilityZone: true,
2119
Autorepair: true,

cmd/create/machinepool/options_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var _ = Describe("CreateMachinepoolOptions", func() {
2121

2222
Context("NewCreateMachinepoolUserOptions", func() {
2323
It("should create default user options", func() {
24-
Expect(userOptions.InstanceType).To(Equal(instanceType))
24+
Expect(userOptions.InstanceType).To(Equal(mpOpts.DefaultInstanceType))
2525
Expect(userOptions.AutoscalingEnabled).To(BeFalse())
2626
Expect(userOptions.MultiAvailabilityZone).To(BeTrue())
2727
Expect(userOptions.Autorepair).To(BeTrue())

pkg/options/machinepool/create.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,18 @@ type CreateMachinepoolUserOptions struct {
4040
}
4141

4242
const (
43-
use = "machinepool"
44-
short = "Add machine pool to cluster"
45-
long = "Add a machine pool to the cluster."
46-
example = ` # Interactively add a machine pool to a cluster named "mycluster"
43+
// DefaultInstanceType is the default AWS instance type for new machine pools.
44+
DefaultInstanceType = "m7i.xlarge"
45+
use = "machinepool"
46+
short = "Add machine pool to cluster"
47+
long = "Add a machine pool to the cluster."
48+
example = ` # Interactively add a machine pool to a cluster named "mycluster"
4749
rosa create machinepool --cluster=mycluster --interactive
48-
# Add a machine pool mp-1 with 3 replicas of m5.xlarge to a cluster
49-
rosa create machinepool --cluster=mycluster --name=mp-1 --replicas=3 --instance-type=m5.xlarge
50-
# Add a machine pool mp-1 with autoscaling enabled and 3 to 6 replicas of m5.xlarge to a cluster
50+
# Add a machine pool mp-1 with 3 replicas of m7i.xlarge to a cluster
51+
rosa create machinepool --cluster=mycluster --name=mp-1 --replicas=3 --instance-type=m7i.xlarge
52+
# Add a machine pool mp-1 with autoscaling enabled and 3 to 6 replicas of m7i.xlarge to a cluster
5153
rosa create machinepool --cluster=mycluster --name=mp-1 --enable-autoscaling \
52-
--min-replicas=3 --max-replicas=6 --instance-type=m5.xlarge
54+
--min-replicas=3 --max-replicas=6 --instance-type=m7i.xlarge
5355
# Add a machine pool with labels to a cluster
5456
rosa create machinepool -c mycluster --name=mp-1 --replicas=2 --instance-type=r5.2xlarge --labels=foo=bar,bar=baz,
5557
# Add a machine pool with spot instances to a cluster
@@ -64,7 +66,9 @@ type CreateMachinepoolOptions struct {
6466
}
6567

6668
func NewCreateMachinepoolUserOptions() *CreateMachinepoolUserOptions {
67-
return &CreateMachinepoolUserOptions{}
69+
return &CreateMachinepoolUserOptions{
70+
InstanceType: DefaultInstanceType,
71+
}
6872
}
6973

7074
func (m *CreateMachinepoolOptions) Machinepool() *CreateMachinepoolUserOptions {
@@ -130,7 +134,7 @@ func BuildMachinePoolCreateCommandWithOptions() (*cobra.Command, *CreateMachinep
130134
flags.StringVar(
131135
&options.InstanceType,
132136
"instance-type",
133-
"m5.xlarge",
137+
DefaultInstanceType,
134138
"Instance type that should be used.",
135139
)
136140

pkg/options/machinepool/create_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var _ = Describe("BuildMachinePoolCreateCommandWithOptions", func() {
3131
Expect(options.AutoscalingEnabled).To(Equal(false))
3232
Expect(options.MinReplicas).To(Equal(0))
3333
Expect(options.MaxReplicas).To(Equal(0))
34-
Expect(options.InstanceType).To(Equal("m5.xlarge"))
34+
Expect(options.InstanceType).To(Equal(DefaultInstanceType))
3535
Expect(options.Labels).To(Equal(""))
3636
Expect(options.Taints).To(Equal(""))
3737
Expect(options.UseSpotInstances).To(Equal(false))
@@ -70,7 +70,7 @@ var _ = Describe("BuildMachinePoolCreateCommandWithOptions", func() {
7070
Expect(maxReplicas).To(Equal(0))
7171

7272
instanceType, _ := flags.GetString("instance-type")
73-
Expect(instanceType).To(Equal("m5.xlarge"))
73+
Expect(instanceType).To(Equal(DefaultInstanceType))
7474

7575
labels, _ := flags.GetString("labels")
7676
Expect(labels).To(Equal(""))

tests/e2e/test_rosacli_machine_pool.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"github.com/openshift/rosa/tests/utils/log"
2121
)
2222

23+
const expectedDefaultMachinePoolInstanceType = "m7i.xlarge"
24+
2325
var _ = Describe("Create machinepool",
2426
labels.Feature.Machinepool,
2527
func() {
@@ -140,7 +142,7 @@ var _ = Describe("Create machinepool",
140142
Expect(err).ToNot(HaveOccurred())
141143
if key == "default" {
142144
Expect(out.Machinepool(mpID).Replicas).To(Equal("0"))
143-
Expect(out.Machinepool(mpID).InstanceType).To(Equal("m5.xlarge"))
145+
Expect(out.Machinepool(mpID).InstanceType).To(Equal(expectedDefaultMachinePoolInstanceType))
144146
}
145147

146148
if key == "advanced" {
@@ -158,7 +160,7 @@ var _ = Describe("Create machinepool",
158160
Expect(out.Machinepool(mpID).Replicas).
159161
To(
160162
Equal(fmt.Sprintf("%s-%s", minReplicas, maxReplicas)))
161-
Expect(out.Machinepool(mpID).InstanceType).To(Equal("m5.xlarge"))
163+
Expect(out.Machinepool(mpID).InstanceType).To(Equal(expectedDefaultMachinePoolInstanceType))
162164
Expect(out.Machinepool(mpID).Labels).To(
163165
Equal(strings.Join(helper.ParseCommaSeparatedStrings(labels_2), ", ")))
164166
}

0 commit comments

Comments
 (0)