elastic / cloud-sdk-go

Apache License 2.0
21 stars 46 forks source link

Add ForceMove option on vacate parameters #489

Open riccardomarinelli opened 3 weeks ago

riccardomarinelli commented 3 weeks ago

Description

Adds ForceMove parameter to vacate parametes, in order to choose primitive vacate or standard vacate

Related Issues

Rel: https://elasticco.atlassian.net/browse/INFRA-3057 Rel: https://elasticco.atlassian.net/browse/INFRA-2823

Motivation and Context

When a vacate plan fails due to Primitive vacate failure ( with error InfrastructureFailure:CopyDataFailure), we want to be able to retry with Standad vacate instead of Primitive vacate from automation tools like Fleetctl in order to try to reduce the number of SDH issues created.

How Has This Been Tested?

This has been tested locally from Fleetctl https://github.com/elastic/fleetctl/pull/195, testing the cloud-sdk-go changes with this line in go.mod replace github.com/elastic/cloud-sdk-go => ../cloud-sdk-go

image

Types of Changes

Readiness Checklist

riccardomarinelli commented 2 weeks ago

As a last attempt added ForceMove as a Plan Override in the last commit and tested but also was unsuccessful

riccardomarinelli commented 2 weeks ago

Also tested directly with curl, but the plans in adminconsole still had force_move: true

 ~ curl -X POST -H "Authorization: ApiKey $QA_API" -H "Content-type: application/json" -d @payload.json "https://admin.qa.cld.elstc.co/api/v1/regions/gcp-us-central1/platform/infrastructure/allocators/gi-4896651367850012401/clusters/elasticsearch/_move?allocator_down=false&force_move=false"
{
  "failures" : {
    "elasticsearch_clusters" : [
    ],
    "kibana_clusters" : [
    ],
    "apm_clusters" : [
    ],
    "appsearch_clusters" : [
    ],
    "enterprise_search_clusters" : [
    ]
  },
  "moves" : {
    "elasticsearch_clusters" : [
      {
        "cluster_id" : "44e610693f534648a7ccacedcb16c65b"
      }
    ],
    "kibana_clusters" : [
    ],
    "apm_clusters" : [
    ],
    "appsearch_clusters" : [
    ],
    "enterprise_search_clusters" : [
    ]
  }
}%
➜  ~ curl -X POST -H "Authorization: ApiKey $QA_API" -H "Content-type: application/json" -d @payload.json "https://admin.qa.cld.elstc.co/api/v1/regions/gcp-us-central1/platform/infrastructure/allocators/gi-4896651367850012401/clusters/elasticsearch/_move?allocator_down=false"
{
  "failures" : {
    "elasticsearch_clusters" : [
    ],
    "kibana_clusters" : [
    ],
    "apm_clusters" : [
    ],
    "appsearch_clusters" : [
    ],
    "enterprise_search_clusters" : [
    ]
  },
  "moves" : {
    "elasticsearch_clusters" : [
      {
        "cluster_id" : "44e610693f534648a7ccacedcb16c65b"
      }
    ],
    "kibana_clusters" : [
    ],
    "apm_clusters" : [
    ],
    "appsearch_clusters" : [
    ],
    "enterprise_search_clusters" : [
    ]
  }
}%
riccardomarinelli commented 2 weeks ago

Moving this back as a Draft and will create a Bug Jira as commented with Gheorge Phucea