Documentation ¶
Index ¶
- func ShardFromContext(ctx context.Context) shard.Name
- func WithCacheServiceRoundTripper(cfg *rest.Config) *rest.Config
- func WithDefaultShardRoundTripper(cfg *rest.Config, shard clientshard.Name) *rest.Config
- func WithShardInContext(parent context.Context, shard shard.Name) context.Context
- func WithShardNameFromContextRoundTripper(cfg *rest.Config) *rest.Config
- func WithShardNameFromObjectRoundTripper(cfg *rest.Config, ...) *rest.Config
- type CacheServiceRoundTripper
- type DefaultShardRoundTripper
- type ShardNameFromObjectRoundTripper
- 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 WithCacheServiceRoundTripper ¶ added in v0.9.0
WithCacheServiceRoundTripper wraps an existing config's with CacheServiceRoundTripper.
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.
func WithShardNameFromContextRoundTripper ¶ added in v0.9.0
WithShardNameFromContextRoundTripper wraps an existing config's with ShardRoundTripper.
Note: it is the caller responsibility to make a copy of the rest config.
func WithShardNameFromObjectRoundTripper ¶ added in v0.9.0
func WithShardNameFromObjectRoundTripper(cfg *rest.Config, requestInfoResolver func(*http.Request) (string, string, error), supportedResources ...string) *rest.Config
WithShardNameFromObjectRoundTripper wraps an existing config with ShardNameFromObjectRoundTripper.
Note: it is the caller responsibility to make a copy of the rest config.
Types ¶
type CacheServiceRoundTripper ¶ added in v0.9.0
type CacheServiceRoundTripper struct {
// contains filtered or unexported fields
}
CacheServiceRoundTripper is a http.RoundTripper that appends "/services/cache" prefix to a request.
func NewCacheServiceRoundTripper ¶ added in v0.9.0
func NewCacheServiceRoundTripper(delegate http.RoundTripper) *CacheServiceRoundTripper
NewCacheServiceRoundTripper creates a new CacheServiceRoundTripper.
func (*CacheServiceRoundTripper) WrappedRoundTripper ¶ added in v0.24.0
func (c *CacheServiceRoundTripper) WrappedRoundTripper() http.RoundTripper
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.
func (*DefaultShardRoundTripper) WrappedRoundTripper ¶ added in v0.24.0
func (c *DefaultShardRoundTripper) WrappedRoundTripper() http.RoundTripper
type ShardNameFromObjectRoundTripper ¶ added in v0.9.0
type ShardNameFromObjectRoundTripper struct {
// contains filtered or unexported fields
}
ShardNameFromObjectRoundTripper knows how to read a shard name from an object and store it in the context. it should be only used by the internal kube-clients that are not aware of a shard name.
func NewShardNameFromObjectRoundTripper ¶ added in v0.9.0
func NewShardNameFromObjectRoundTripper(delegate http.RoundTripper, requestInfoResolver func(*http.Request) (string, string, error), supportedResources ...string) *ShardNameFromObjectRoundTripper
NewShardNameFromObjectRoundTripper creates a new ShardNameFromObjectRoundTripper for the given resources.
func (*ShardNameFromObjectRoundTripper) WrappedRoundTripper ¶ added in v0.24.0
func (c *ShardNameFromObjectRoundTripper) WrappedRoundTripper() http.RoundTripper
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.io/v1alpha1/apiexports to /shards/amber/apis/apis.kcp.io/v1alpha1/apiexports.
func NewShardRoundTripper ¶
func NewShardRoundTripper(delegate http.RoundTripper) *ShardRoundTripper
NewShardRoundTripper creates a new shard aware round tripper.
func (*ShardRoundTripper) WrappedRoundTripper ¶ added in v0.24.0
func (c *ShardRoundTripper) WrappedRoundTripper() http.RoundTripper