@@ -35,9 +35,7 @@ func createScaleUPMemberPlan(ctx context.Context,
3535 log zerolog.Logger , apiObject k8sutil.APIObject ,
3636 spec api.DeploymentSpec , status api.DeploymentStatus ,
3737 cachedStatus inspectorInterface.Inspector , context PlanBuilderContext ) api.Plan {
38- return createScaleMemberPlan (ctx , log , apiObject , spec , status , cachedStatus , context ).Filter (func (a api.Action ) bool {
39- return a .Type == api .ActionTypeAddMember
40- })
38+ return createScaleMemberPlan (ctx , log , apiObject , spec , status , cachedStatus , context ).Filter (filterScaleUP )
4139}
4240
4341func createScaleMemberPlan (ctx context.Context ,
@@ -50,16 +48,17 @@ func createScaleMemberPlan(ctx context.Context,
5048 switch spec .GetMode () {
5149 case api .DeploymentModeSingle :
5250 // Never scale down
51+ plan = append (plan , createScalePlan (log , status , status .Members .Single , api .ServerGroupSingle , 1 ).Filter (filterScaleUP )... )
5352 case api .DeploymentModeActiveFailover :
5453 // Only scale agents & singles
5554 if a := status .Agency ; a != nil && a .Size != nil {
56- plan = append (plan , createScalePlan (log , status , status .Members .Agents , api .ServerGroupAgents , int (* a .Size ))... )
55+ plan = append (plan , createScalePlan (log , status , status .Members .Agents , api .ServerGroupAgents , int (* a .Size )).Filter ( filterScaleUP ) . .. )
5756 }
5857 plan = append (plan , createScalePlan (log , status , status .Members .Single , api .ServerGroupSingle , spec .Single .GetCount ())... )
5958 case api .DeploymentModeCluster :
6059 // Scale agents, dbservers, coordinators
6160 if a := status .Agency ; a != nil && a .Size != nil {
62- plan = append (plan , createScalePlan (log , status , status .Members .Agents , api .ServerGroupAgents , int (* a .Size ))... )
61+ plan = append (plan , createScalePlan (log , status , status .Members .Agents , api .ServerGroupAgents , int (* a .Size )).Filter ( filterScaleUP ) . .. )
6362 }
6463 plan = append (plan , createScalePlan (log , status , status .Members .DBServers , api .ServerGroupDBServers , spec .DBServers .GetCount ())... )
6564 plan = append (plan , createScalePlan (log , status , status .Members .Coordinators , api .ServerGroupCoordinators , spec .Coordinators .GetCount ())... )
@@ -157,3 +156,7 @@ func createReplaceMemberPlan(ctx context.Context,
157156
158157 return plan
159158}
159+
160+ func filterScaleUP (a api.Action ) bool {
161+ return a .Type == api .ActionTypeAddMember
162+ }
0 commit comments