func BuildClusterName(direction TrafficDirection, subsetName string, hostname string, port int) string {
	if direction == TrafficDirectionInbound {
		return istiomodel.BuildSubsetKey(istiomodel.TrafficDirection(direction), subsetName, "", port)
	}
	return istiomodel.BuildSubsetKey(istiomodel.TrafficDirection(direction), subsetName, host.Name(hostname), port)
}
BuildClusterName the cluster name referencing service instances for a given service name, a subset and a port, which is the same as the cluster name generated by Istio.
package model
import (
	"encoding/json"
	"strconv"
	istiomodel "istio.io/istio/pilot/pkg/model"
	"istio.io/istio/pkg/config/host"
)
type TrafficDirection string
const (
	TrafficDirectionInbound TrafficDirection = "inbound"
	TrafficDirectionOutbound TrafficDirection = "outbound"
)