Documentation
¶
Index ¶
- Constants
- Variables
- func AddClusterGatewayClientFlags(set *pflag.FlagSet)
- func AddFlags(set *pflag.FlagSet)
- func AddRemoteClusterClientFlags(set *pflag.FlagSet)
- func ClusterFrom(ctx context.Context) (string, bool)
- func IsLocal(cluster string) bool
- func NewClient(config *rest.Config, options ClientOptions) (client.Client, error)
- func NewDefaultClient(config *rest.Config, options client.Options) (client.Client, error)
- func NewNoConversionParamCodec() runtime.ParameterCodec
- func NewRemoteClusterClient(cfg *rest.Config, options client.Options) (client.Client, error)
- func NewTransportWrapper(options ...TransportOption) transport.WrapperFunc
- func WithCluster(parent context.Context, cluster string) context.Context
- type ClientOptions
- type ClusterGatewayClientOptions
- type ForCluster
- type Transport
- type TransportOption
Constants ¶
const ( // Local is the name of the local cluster in KubeVela Local string = "local" )
Variables ¶
var DefaultClusterGatewayClientOptions = ClusterGatewayClientOptions{}
DefaultClusterGatewayClientOptions the default ClusterGatewayClientOptions
var DefaultDisableRemoteClusterClient = false
DefaultDisableRemoteClusterClient whether to disable RemoteClusterClient for default multicluster client
var RemoteClusterClientCachePruneProbability = 0.01
RemoteClusterClientCachePruneProbability the cache prune probability of remote clusters' RESTMapper
var RemoteClusterClientCacheTimeout = 30 * time.Minute
RemoteClusterClientCacheTimeout the timeout of remote cluster's RESTMapper cache
Functions ¶
func AddClusterGatewayClientFlags ¶
AddClusterGatewayClientFlags add flags for default cluster-gateway client
func AddRemoteClusterClientFlags ¶ added in v1.9.0
AddRemoteClusterClientFlags add flags for remote cluster client
func ClusterFrom ¶
ClusterFrom returns the value of the cluster key on the ctx
func NewClient ¶
NewClient create a multi-cluster client for handling multi-cluster requests If ClusterGatewayURL is not set, the client will use the Kubernetes aggregated api directly. All multi-cluster requests will be directed to the hub Kubernetes APIServer. The managed cluster requests will be redirected from the Kubernetes APIServer to cluster-gateway. If ClusterGatewayURL is set, the client will directly call cluster-gateway for managed cluster requests, instead of calling the hub Kubernetes APIServer.
func NewDefaultClient ¶
NewDefaultClient create default client with default DefaultClusterGatewayClientOptions
func NewNoConversionParamCodec ¶ added in v1.9.0
func NewNoConversionParamCodec() runtime.ParameterCodec
NewNoConversionParamCodec create a empty ParameterCodec
func NewRemoteClusterClient ¶ added in v1.9.0
NewRemoteClusterClient create a client that will use separate RESTMappers for remote cluster requests.
func NewTransportWrapper ¶
func NewTransportWrapper(options ...TransportOption) transport.WrapperFunc
NewTransportWrapper create a WrapperFunc for wrapping RoundTripper with multi-cluster transport
Types ¶
type ClientOptions ¶
type ClientOptions struct { client.Options ClusterGateway ClusterGatewayClientOptions DisableRemoteClusterClient bool }
ClientOptions the options for creating multi-cluster gatedClient
type ClusterGatewayClientOptions ¶
type ClusterGatewayClientOptions struct { // URL the url for cluster-gateway. If empty, multi-cluster request will use // the Kubernetes aggregated api. URL string // CAFile the CA file for cluster-gateway. If neither ClusterGatewayURL nor // ClusterGatewayCAFile is empty, the CA file will be used when accessing // cluster-gateway. CAFile string }
ClusterGatewayClientOptions the options for creating the gateway client
type ForCluster ¶
type ForCluster string
ForCluster create transport for specified cluster
func (ForCluster) ApplyToTransport ¶
func (op ForCluster) ApplyToTransport(t *Transport)
ApplyToTransport .
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport the transport for multi-cluster request
func NewTransport ¶
func NewTransport(rt http.RoundTripper) *Transport
NewTransport create a transport instance for handling multi-cluster request
func (*Transport) CancelRequest ¶
CancelRequest will try cancel request with the inner round tripper
func (*Transport) WrappedRoundTripper ¶
func (t *Transport) WrappedRoundTripper() http.RoundTripper
WrappedRoundTripper can get the wrapped RoundTripper
type TransportOption ¶
type TransportOption interface {
ApplyToTransport(*Transport)
}
TransportOption option for creating transport