diff --git a/pkg/api/platformapi/allocatorapi/vacate.go b/pkg/api/platformapi/allocatorapi/vacate.go index ceacb394..df2686cb 100644 --- a/pkg/api/platformapi/allocatorapi/vacate.go +++ b/pkg/api/platformapi/allocatorapi/vacate.go @@ -127,6 +127,7 @@ func moveNodes(id string, params *VacateParams, p *pool.Pool) ([]pool.Validator, WithAllocatorID(id). WithMoveOnly(params.MoveOnly). WithContext(api.WithRegion(context.Background(), params.Region)). + //WithForceMove(params.ForceMove). WithValidateOnly(ec.Bool(true)), params.AuthWriter, ) @@ -282,6 +283,7 @@ func newVacateClusterParams(params addAllocatorMovesToPoolParams, id, kind strin Output: params.VacateParams.Output, OutputFormat: params.VacateParams.OutputFormat, MoveOnly: params.VacateParams.MoveOnly, + ForceMove: params.VacateParams.ForceMove, PlanOverrides: params.VacateParams.PlanOverrides, } @@ -391,6 +393,7 @@ func newMoveClusterParams(params *VacateClusterParams) (*platform_infrastructure platform_infrastructure.NewMoveClustersParams(). WithAllocatorDown(params.AllocatorDown). WithMoveOnly(params.MoveOnly). + WithForceMove(params.ForceMove). WithAllocatorID(params.ID). WithContext(api.WithRegion(context.Background(), params.Region)). WithValidateOnly(ec.Bool(true)). @@ -416,6 +419,7 @@ func newMoveClusterParams(params *VacateClusterParams) (*platform_infrastructure var moveParams = platform_infrastructure.NewMoveClustersByTypeParams(). WithAllocatorID(params.ID). WithAllocatorDown(params.AllocatorDown). + WithForceMove(params.ForceMove). WithContext(api.WithRegion(context.Background(), params.Region)). WithBody(req) @@ -655,6 +659,10 @@ func ComputeVacateRequest(pr *models.MoveClustersDetails, resources, to []string c.CalculatedPlan.PlanConfiguration.OverrideFailsafe = overrides.OverrideFailsafe } + if overrides.ForceMove != nil { + c.CalculatedPlan.PlanConfiguration.ForceMove = overrides.ForceMove + } + c.CalculatedPlan.PlanConfiguration.PreferredAllocators = to req.ElasticsearchClusters = append(req.ElasticsearchClusters, &models.MoveElasticsearchClusterConfiguration{ diff --git a/pkg/api/platformapi/allocatorapi/vacate_params.go b/pkg/api/platformapi/allocatorapi/vacate_params.go index 23f4168d..0df2a93a 100644 --- a/pkg/api/platformapi/allocatorapi/vacate_params.go +++ b/pkg/api/platformapi/allocatorapi/vacate_params.go @@ -51,7 +51,7 @@ var ( ) // VacateParams used to vacate N allocators or clusters. -//nolint +// nolint type VacateParams struct { *api.API @@ -98,6 +98,9 @@ type VacateParams struct { // bare minimum to move the requested instances across to another allocator. MoveOnly *bool + // Optional value to be set to force_move to true for primitive vacate or false for standard. + ForceMove *bool + // SkipTracking skips displaying and waiting for the individual vacates to complete. // Setting it to true will render the concurrency flag pretty much ineffective since // the vacate action is asynchronous and the only thing keeping the working items in @@ -166,6 +169,7 @@ type VacateClusterParams struct { TrackFrequency time.Duration AllocatorDown *bool MoveOnly *bool + ForceMove *bool Output *output.Device OutputFormat string MaxPollRetries uint8 @@ -222,4 +226,5 @@ type PlanOverrides struct { SkipSnapshot *bool SkipDataMigration *bool OverrideFailsafe *bool + ForceMove *bool } diff --git a/pkg/api/platformapi/allocatorapi/vacate_params_test.go b/pkg/api/platformapi/allocatorapi/vacate_params_test.go index 11dde5eb..5d06e921 100644 --- a/pkg/api/platformapi/allocatorapi/vacate_params_test.go +++ b/pkg/api/platformapi/allocatorapi/vacate_params_test.go @@ -211,6 +211,7 @@ func TestVacateClusterParamsValidate(t *testing.T) { TrackFrequency time.Duration AllocatorDown *bool MoveOnly *bool + ForceMove *bool Output *output.Device OutputFormat string MaxPollRetries uint8 diff --git a/pkg/models/elasticsearch_plan_control_configuration.go b/pkg/models/elasticsearch_plan_control_configuration.go index 2a25a031..3cea3d9a 100644 --- a/pkg/models/elasticsearch_plan_control_configuration.go +++ b/pkg/models/elasticsearch_plan_control_configuration.go @@ -84,6 +84,9 @@ type ElasticsearchPlanControlConfiguration struct { // If true (default: false), does not take (or require) a successful snapshot to be taken before performing any potentially destructive changes to this cluster SkipSnapshot *bool `json:"skip_snapshot,omitempty"` + // If false (default: true), will run standard vacate + ForceMove *bool `json:"force_move,omitempty"` + // If false (the default), the cluster will perform a snapshot after a major version upgrade takes place SkipSnapshotPostMajorUpgrade *bool `json:"skip_snapshot_post_major_upgrade,omitempty"`