Documentation
¶
Index ¶
- func ShardFromContext(ctx context.Context) shard.Name
- func WithDefaultShardRoundTripper(cfg *rest.Config, shard clientshard.Name) *rest.Config
- func WithShardInContext(parent context.Context, shard shard.Name) context.Context
- func WithShardRoundTripper(cfg *rest.Config) *rest.Config
- type DefaultShardRoundTripper
- type ShardRoundTripper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShardFromContext ¶
ShardFromContext returns the value of the shard key on the ctx, or an empty Name if there is no shard key.
func WithDefaultShardRoundTripper ¶
WithDefaultShardRoundTripper wraps an existing config's with DefaultShardRoundTripper
Note: it is the caller responsibility to make a copy of the rest config
func WithShardInContext ¶
WithShardInContext returns a context with the given shard set
Types ¶
type DefaultShardRoundTripper ¶
type DefaultShardRoundTripper struct {
// contains filtered or unexported fields
}
DefaultShardRoundTripper is a http.RoundTripper that sets a default shard name if not specified in the context
func NewDefaultShardRoundTripper ¶
func NewDefaultShardRoundTripper(delegate http.RoundTripper, shard clientshard.Name) *DefaultShardRoundTripper
NewDefaultShardRoundTripper creates a new round tripper that sets a default shard name
type ShardRoundTripper ¶
type ShardRoundTripper struct {
// contains filtered or unexported fields
}
ShardRoundTripper is a shard aware wrapper around http.RoundTripper. It changes the URL path to target a shard from the context.
For example given "amber" shard name in the context it will change apis/apis.kcp.dev/v1alpha1/apiexports to /shards/amber/apis/apis.kcp.dev/v1alpha1/apiexports
func NewShardRoundTripper ¶
func NewShardRoundTripper(delegate http.RoundTripper) *ShardRoundTripper
NewShardRoundTripper creates a new shard aware round tripper