framework

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

Package framework provides a the required interfaces, structs and generic implementation that allow creating KCP virtual workspaces with a minimal amount of work.

To create virtual workspaces you have to:

- define the implementation of the VirtualWorkspaces you want to expose (for example with utilities found in the `fixedgvs` or `dynamic` packages)

- define the sub-command that will expose the related CLI arguments, Bootstrap and start those VirtualWorkspaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadyChecker added in v0.6.0

type ReadyChecker interface {
	IsReady() error
}

type ReadyFunc

type ReadyFunc func() error

ReadyFunc is the type of readiness check functions exposed by types implementing the VtualWorkspace interface.

func (ReadyFunc) IsReady added in v0.6.0

func (r ReadyFunc) IsReady() error

type RootPathResolver added in v0.6.0

type RootPathResolver interface {
	// ResolveRootPath returns whether the request should be accepted and served by a given VirtualWorkspace. If accepted,
	// the prefixToStrip is the prefix that is in-front of the kube-like API surface (including `/clusters/<something>`). E.g. for
	//
	//   /services/initializingworkspaces/<initializer>/clusters/<something>/apis/workload.kcp.io/v1alpha1/synctargets
	//
	// the prefixToStrip is `/services/initializingworkspaces/<initializer/clusters/<something>`.
	//
	// Depending on virtual workspace type, the returned context holds e.g. the APIDomainKey, the logical cluster or
	// other values like scope, if that is part of the URL path.
	ResolveRootPath(urlPath string, context context.Context) (accepted bool, prefixToStrip string, completedContext context.Context)
}

type RootPathResolverFunc

type RootPathResolverFunc func(urlPath string, context context.Context) (accepted bool, prefixToStrip string, completedContext context.Context)

RootPathResolverFunc is the type of a function that, based on the URL path of a request, returns whether the request should be accepted and served by a given VirtuaWorkspace. When it returns `true`, it will also set the VirtualWorkspace name in the request context, as well as the prefix that should be removed from the request URL Path before forwarding the request to the given VirtualWorkspace delegated APIServer.

func (RootPathResolverFunc) ResolveRootPath added in v0.6.0

func (r RootPathResolverFunc) ResolveRootPath(urlPath string, context context.Context) (accepted bool, prefixToStrip string, completedContext context.Context)

type VirtualWorkspace

type VirtualWorkspace interface {
	authorizer.Authorizer
	RootPathResolver
	ReadyChecker
	Register(name string, rootAPIServerConfig genericapiserver.CompletedConfig, delegateAPIServer genericapiserver.DelegationTarget) (genericapiserver.DelegationTarget, error)
}

VirtualWorkspace is the definition of a virtual workspace that will be registered and made available, at a given prefix, inside a Root API server as a delegated API Server.

It will be implemented by several types of virtual workspaces.

One example is the FixedGroupVersionsVirtualWorkspace located in the fixedgvs package, which allows adding well-defined APIs in a limited number of group/versions, implemented as Rest storages.

Directories

Path Synopsis
client
Package dynamic provides the types and underlying implementation required to build virtual workspaces which can dynamically serve resources, based on API definitions (including an OpenAPI v3 schema), and a Rest storage provider.
Package dynamic provides the types and underlying implementation required to build virtual workspaces which can dynamically serve resources, based on API definitions (including an OpenAPI v3 schema), and a Rest storage provider.
apiserver
Package apiserver provides an APIServer that can dynamically serve resources based on an API definition (CommonAPIResourceSpec) source and a Rest storage provider.
Package apiserver provides an APIServer that can dynamically serve resources based on an API definition (CommonAPIResourceSpec) source and a Rest storage provider.
Package fixedgvs provides the types (and underlying implementation) required to build virtual workspaces which allow adding well-defined APIs in a limited number of group/versions, implemented as Rest storages.
Package fixedgvs provides the types (and underlying implementation) required to build virtual workspaces which allow adding well-defined APIs in a limited number of group/versions, implemented as Rest storages.
Package forwardingregistry provides a CRD-like REST storage implementation that can dynamically serve resources based on a given OpenAPI schema, and forward the requests to a KCP workspace-aware delegate client.
Package forwardingregistry provides a CRD-like REST storage implementation that can dynamically serve resources based on a given OpenAPI schema, and forward the requests to a KCP workspace-aware delegate client.
Package handler provides a virtual workspace server that operates at the level of one http.Handler, allowing for low-level transformations of the incoming requests.
Package handler provides a virtual workspace server that operates at the level of one http.Handler, allowing for low-level transformations of the incoming requests.
wrappers

Jump to

Keyboard shortcuts

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