Skip to content

Commit 5258aeb

Browse files
author
den-rgb
committed
OCM-10147 | feat: removing validation for no changes on np
1 parent d2e046d commit 5258aeb

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

pkg/machinepool/machinepool.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
ocmOutput "github.com/openshift/rosa/pkg/ocm/output"
3232
mpOpts "github.com/openshift/rosa/pkg/options/machinepool"
3333
"github.com/openshift/rosa/pkg/output"
34-
rprtr "github.com/openshift/rosa/pkg/reporter"
3534
"github.com/openshift/rosa/pkg/rosa"
3635
)
3736

@@ -1252,7 +1251,6 @@ func fillAutoScalingAndReplicas(npBuilder *cmv1.NodePoolBuilder, autoscaling boo
12521251
}
12531252

12541253
func getMachinePoolReplicas(cmd *cobra.Command,
1255-
reporter *rprtr.Object,
12561254
machinePoolID string,
12571255
existingReplicas int,
12581256
existingAutoscaling *cmv1.MachinePoolAutoscaling,
@@ -1458,7 +1456,7 @@ func editMachinePool(cmd *cobra.Command, machinePoolId string,
14581456
}
14591457

14601458
autoscaling, replicas, minReplicas, maxReplicas, err :=
1461-
getMachinePoolReplicas(cmd, r.Reporter, machinePoolId, machinePool.Replicas(), machinePool.Autoscaling(),
1459+
getMachinePoolReplicas(cmd, machinePoolId, machinePool.Replicas(), machinePool.Autoscaling(),
14621460
!isLabelsSet && !isTaintsSet, isMultiAZMachinePool(machinePool), cluster.OpenshiftVersion())
14631461

14641462
if err != nil {
@@ -1551,7 +1549,7 @@ func editNodePool(cmd *cobra.Command, nodePoolID string,
15511549
return fmt.Errorf("Machine pool '%s' does not exist for hosted cluster '%s'", nodePoolID, clusterKey)
15521550
}
15531551

1554-
autoscaling, replicas, minReplicas, maxReplicas, err := getNodePoolReplicas(cmd, r, nodePoolID,
1552+
autoscaling, replicas, minReplicas, maxReplicas, err := getNodePoolReplicas(cmd, nodePoolID,
15551553
nodePool.Replicas(), nodePool.Autoscaling(), isAnyAdditionalParameterSet, cluster.OpenshiftVersion())
15561554
if err != nil {
15571555
return fmt.Errorf("Failed to get autoscaling or replicas: '%s'", err)
@@ -1839,7 +1837,6 @@ func promptForNodePoolNodeRecreate(
18391837
}
18401838

18411839
func getNodePoolReplicas(cmd *cobra.Command,
1842-
r *rosa.Runtime,
18431840
nodePoolID string,
18441841
existingReplicas int,
18451842
existingAutoscaling *cmv1.NodePoolAutoscaling,
@@ -1990,10 +1987,8 @@ func editAutoscaling(nodePool *cmv1.NodePool, minReplicas int, maxReplicas int)
19901987
max = maxReplicas
19911988
}
19921989

1993-
if existingMinReplica != minReplicas || existingMaxReplica != maxReplicas {
1994-
if min >= 1 && max >= 1 {
1995-
return cmv1.NewNodePoolAutoscaling().MinReplica(min).MaxReplica(max)
1996-
}
1990+
if min >= 1 && max >= 1 {
1991+
return cmv1.NewNodePoolAutoscaling().MinReplica(min).MaxReplica(max)
19971992
}
19981993

19991994
return nil

pkg/machinepool/machinepool_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ var _ = Describe("Machinepool and nodepool", func() {
7474
testCommand.Flags().Lookup("min-replicas").Changed = true
7575
testCommand.Flags().Lookup("max-replicas").Changed = true
7676
})
77-
It("editAutoscaling should equal nil if nothing is changed", func() {
77+
It("editAutoscaling should not be nil if nothing is changed", func() {
7878
nodepool, err := cmv1.NewNodePool().
7979
Autoscaling(cmv1.NewNodePoolAutoscaling().MaxReplica(2).MinReplica(1)).
8080
Build()
8181
Expect(err).ToNot(HaveOccurred())
8282
builder := editAutoscaling(nodepool, 1, 2)
83-
Expect(builder).To(BeNil())
83+
Expect(builder).To(Not(BeNil()))
8484
})
8585
It("editAutoscaling should equal the expected output", func() {
8686
nodepool, err := cmv1.NewNodePool().

0 commit comments

Comments
 (0)