Documentation ¶
Index ¶
- Variables
- func IdentityFromContext(ctx context.Context) string
- func WithAcceptHeader(apiHandler http.Handler) http.Handler
- func WithClusterScope(apiHandler http.Handler) http.HandlerFunc
- func WithIdentity(ctx context.Context, identity string) context.Context
- func WithInClusterServiceAccountRequestRewrite(handler http.Handler, unsafeServiceAccountPreAuth authenticator.Request) http.Handler
- func WithWildcardIdentity(handler http.Handler) http.Handler
- func WithWildcardListWatchGuard(apiHandler http.Handler) http.HandlerFunc
- func WithWorkspaceProjection(apiHandler http.Handler) http.HandlerFunc
- type Server
Constants ¶
This section is empty.
Variables ¶
var SystemCRDLogicalCluster = logicalcluster.New("system:system-crds")
SystemCRDLogicalCluster is the logical cluster we install system CRDs into for now. These are needed to start wildcard informers until a "real" workspace gets them installed.
Functions ¶
func IdentityFromContext ¶ added in v0.6.0
IdentityFromContext retrieves the APIExport identity from the context, if any.
func WithAcceptHeader ¶ added in v0.6.0
WithAcceptHeader makes the Accept header available for code in the handler chain. It is needed for Wildcard requests, when finding the CRD with a common schema. For PartialObjectMeta requests we cand weaken the schema requirement and allow different schemas across workspaces.
func WithClusterScope ¶
func WithClusterScope(apiHandler http.Handler) http.HandlerFunc
func WithIdentity ¶ added in v0.6.0
WithIdentity adds an APIExport identity to the context.
func WithInClusterServiceAccountRequestRewrite ¶ added in v0.6.0
func WithInClusterServiceAccountRequestRewrite(handler http.Handler, unsafeServiceAccountPreAuth authenticator.Request) http.Handler
WithInClusterServiceAccountRequestRewrite adds the /clusters/<clusterName> prefix to the request path if the request comes from an InCluster service account requests (InCluster clients don't support prefixes).
func WithWildcardIdentity ¶ added in v0.6.0
WithWildcardIdentity checks wildcard list/watch requests for an APIExport identity for the resource in the path. If it finds one (e.g. /api/v1/services:identityabcd1234/default/my-service), it places the identity from the path to the context, updates the request to remove the identity from the path, and updates requestInfo.Resource to also remove the identity. Finally, it hands off to the passed in handler to handle the request.
func WithWildcardListWatchGuard ¶
func WithWildcardListWatchGuard(apiHandler http.Handler) http.HandlerFunc
func WithWorkspaceProjection ¶ added in v0.6.0
func WithWorkspaceProjection(apiHandler http.Handler) http.HandlerFunc
WithWorkspaceProjection maps the personal virtual workspace "workspaces" resource into the cluster workspace URL space. This means you can do `kubectl get workspaces` from an org workspace.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server manages the configuration and kcp api-server. It allows callers to easily use kcp as a library rather than as a single binary. Using its constructor function, you can easily setup a new api-server and start it:
srv := server.NewServer(server.DefaultConfig()) srv.Run(ctx)
You may optionally provide PostStartHookFunc and PreShutdownHookFunc hooks before starting the server that should be passed to the api-server itself. These hooks have access to a restclient.Config which allows you to easily create a client.
srv.AddPostStartHook("my-hook", func(context genericapiserver.PostStartHookContext) error { client := clientset.NewForConfigOrDie(context.LoopbackClientConfig) })
func NewServer ¶
func NewServer(o *kcpserveroptions.CompletedOptions) (*Server, error)
NewServer creates a new instance of Server which manages the KCP api-server.
func (*Server) AddPostStartHook ¶
func (s *Server) AddPostStartHook(name string, hook genericapiserver.PostStartHookFunc)
AddPostStartHook allows you to add a PostStartHook that gets passed to the underlying genericapiserver implementation.
func (*Server) AddPreShutdownHook ¶
func (s *Server) AddPreShutdownHook(name string, hook genericapiserver.PreShutdownHookFunc)
AddPreShutdownHook allows you to add a PreShutdownHookFunc that gets passed to the underlying genericapiserver implementation.