## What?

Currently, in order to upgrade a cluster to a newer version, a set of checks are run validating that it's safe to upgrade. [One of these checks validates](https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecks.java#L23) that there's enough room in the cluster to create new shards for (potential) intermediate indices. 

## How

The main idea it creates a new indicator into the new [Health API](https://www.elastic.co/guide/en/elasticsearch/reference/master/health-api.html), in such a way it'll be displayed on the `Deployment Management > Monitoring > Health page`. Later, the Cluster Upgrade Tool should use this indicator to validate that upgrading the cluster is safe. Also, the check should be removed from the Deprecation API.

## Tasks

- [x] Talk with the UI team to confirm that the new indicator, once exposed in the UI, will automatically appear in the UI or it must be developed involved
- [x] Create all the machinery in Elasticsearch repo to expose the new Health API indicator (ticket tracking this work #91119)
- [x] Start the conversations with the Cloud team about the needed changes on their side to use this indicator –or any other new indicator– to block upgrades in case the cluster is Unhealthy.
- [x] Removes the old check from the Deprecation API #95177

### Related

* PR introducing the check https://github.com/elastic/elasticsearch/pull/85967
x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecksTests.java
.put(
                        IndexMetadata.builder(randomAlphaOfLength(10))
                            .settings(settings(Version.CURRENT).put(DataTier.TIER_PREFERENCE_SETTING.getKey(), "  "))
                            .numberOfShards(1)
                            .numberOfReplicas(1)
                            .build(),
                        false
                    )
                    .build()
            )
            .nodes(
                DiscoveryNodes.builder()
                    .add(DiscoveryNodeUtils.create(UUID.randomUUID().toString()))
                    .add(DiscoveryNodeUtils.create(UUID.randomUUID().toString()))
            )
            .build();
        issues = DeprecationChecks.filterChecks(CLUSTER_SETTINGS_CHECKS, c -> c.apply(stateWithProblems));
        DeprecationIssue expected = new DeprecationIssue(
            DeprecationIssue.Level.WARNING,
            "The cluster has too many shards to be able to upgrade",
            "https://ela.st/es-deprecation-8-shard-limit",
            "Upgrading requires adding a small number of new shards. There is not enough room for 10 more shards. Increase the cluster"
                + ".max_shards_per_node setting, or remove indices to clear up resources.",
            false,
            null
        );
        assertEquals(singletonList(expected), issues);
    }
}