Similar to https://github.com/elastic/elasticsearch/issues/82807 Kibana upgrades can never succeed if a cluster already exceeded the maximum open shards.

It would reduce the downtime and help our users safely upgrade if we emitted a critical warning from the deprecations info API for this condition. At the moment it will only help users upgrading from 7.x to 8.x but we hope to enable the upgrade assistant during minor upgrades too https://github.com/elastic/kibana/issues/117220
server/src/main/java/org/elasticsearch/indices/ShardLimitValidator.java
* @param newFrozenShards   The number of frozen shards to be added by this operation
     * @param state             The current cluster state
     * @return If present, an error message to be given as the reason for failing
     * an operation. If empty, a sign that the operation is valid.
     */
    private Optional<String> checkShardLimit(int newShards, int newFrozenShards, ClusterState state) {
        
        
        
        int frozenNodeCount = nodeCount(state, ShardLimitValidator::hasFrozen);
        int normalNodeCount = nodeCount(state, ShardLimitValidator::hasNonFrozen);
        return checkShardLimit(newShards, state, getShardLimitPerNode(), normalNodeCount, "normal").or(
            () -> checkShardLimit(newFrozenShards, state, shardLimitPerNodeFrozen.get(), frozenNodeCount, "frozen")
        );
    }
    
    static Optional<String> checkShardLimit(int newShards, ClusterState state, int maxShardsPerNode, int nodeCount, String group) {
        
        
        if (nodeCount == 0 || newShards <= 0) {
            return Optional.empty();
        }
        int maxShardsInCluster = maxShardsPerNode * nodeCount;
        int currentOpenShards = state.getMetadata().getTotalOpenIndexShards();
        if ((currentOpenShards + newShards) > maxShardsInCluster) {
            Predicate<IndexMetadata> indexMetadataPredicate = imd -> imd.getState().equals(IndexMetadata.State.OPEN)
                && group.equals(INDEX_SETTING_SHARD_LIMIT_GROUP.get(imd.getSettings()));
            long currentFilteredShards = state.metadata()
                .indices()
                .values()