server

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCacheShardLevelPaths added in v0.32.0

func WithCacheShardLevelPaths(handler http.Handler) http.Handler

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

func WithServiceScope(handler http.Handler) http.Handler

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

func WithShardScope(handler http.Handler) http.Handler

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.

func WithSyntheticDelay added in v0.11.0

func WithSyntheticDelay(handler http.Handler, delay time.Duration) http.Handler

WithSyntheticDelay injects a synthetic delay to calls, to exacerbate timing issues and expose inconsistent client behavior.

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
	ApiExtensionsSharedInformerFactory kcpapiextensionsinformers.SharedInformerFactory
	KcpSharedInformerFactory           kcpinformers.SharedInformerFactory
}

type Server

type Server struct {
	CompletedConfig
	// contains filtered or unexported fields
}

func NewServer

func NewServer(c CompletedConfig) (*Server, error)

func (*Server) PrepareRun added in v0.9.0

func (s *Server) PrepareRun(ctx context.Context) (preparedServer, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL