Documentation
¶
Index ¶
- func WithCacheShardLevelPaths(handler http.Handler) http.Handler
- func WithServiceScope(handler http.Handler) http.Handler
- func WithShardScope(handler http.Handler) http.Handler
- func WithSyntheticDelay(handler http.Handler, delay time.Duration) http.Handler
- type CompletedConfig
- type Config
- type ExtraConfig
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCacheShardLevelPaths ¶ added in v0.32.0
WithCacheShardLevelPaths enforces that shard-level URLs (see pkg/authorization/shardpaths) are not reachable via a shard- or workspace-scoped cache server URL such as /services/cache/shards/<sh>/clusters/<ws>/metrics. The data exposed at these paths is process-wide and has no per-shard or per-workspace meaning.
Must run AFTER WithClusterScope and WithShardScope so the request context reflects whether either prefix was present in the original URL.
func WithServiceScope ¶ added in v0.9.0
WithServiceScope an HTTP filter that trims "/services/cache" prefix from the URL.
for example: /services/cache/shards/amber/clusters/*/apis/apis.kcp.io/v1alpha1/apiexports is truncated to /shards/amber/clusters/*/apis/apis.kcp.io/v1alpha1/apiexports.
func WithShardScope ¶
WithShardScope reads a shard name from the URL path and puts it into the context. It also trims "/shards/" prefix from the URL. If the path doesn't contain the shard name then a 404 error is returned.
For example:
/shards/*/clusters/*/apis/apis.kcp.io/v1alpha1/apiexports
/shards/amber/clusters/*/apis/apis.kcp.io/v1alpha1/apiexports
/shards/sapphire/clusters/system:sapphire/apis/apis.kcp.io/v1alpha1/apiexports
/shards/amber/clusters/system:amber/apis/apis.kcp.io/v1alpha1/apiexports
Note: not all paths require to have a valid shard name, as of today the following paths pass through: "/livez", "/readyz", "/healthz", and any path declared shard-level in pkg/authorization/shardpaths (e.g. /metrics) so that prometheus-style scrapers can hit the cache server directly without constructing a /shards/<sh>/ prefix.
Types ¶
type CompletedConfig ¶
type CompletedConfig struct {
// contains filtered or unexported fields
}
type Config ¶
type Config struct {
Options *cacheserveroptions.CompletedOptions
ApiExtensions *apiextensionsapiserver.Config
EmbeddedEtcd *embeddedetcd.Config
ExtraConfig
}
func NewConfig ¶
func NewConfig(opts *cacheserveroptions.CompletedOptions, optionalLocalShardRestConfig *rest.Config) (*Config, error)
NewConfig returns a new Config for the given options and optional rest.Config that point to the local server. Pass it only when you combine this server with a different one.
func (*Config) Complete ¶
func (c *Config) Complete() (CompletedConfig, error)
Complete fills in any fields not set that are required to have valid data. It's mutating the receiver.
type ExtraConfig ¶
type ExtraConfig struct {
ApiExtensionsClusterClient kcpapiextensionsclientset.ClusterInterface
}
type Server ¶
type Server struct {
CompletedConfig
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(c CompletedConfig) (*Server, error)