openapiv3

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: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultServiceCacheSize is the default size of the OpenAPI service cache.
	// Equal API configurations in multiple workspaces are shared.
	DefaultServiceCacheSize = 100

	// TODO(sttts): move to central place in kube.
	BoundAnnotationKey = "apis.kcp.io/bound-crd"
)
View Source
const ControllerName = "kcp-openapiv3"

Variables

This section is empty.

Functions

func WithOpenAPIv3

func WithOpenAPIv3(handler http.Handler, c *ServiceCache) http.Handler

WithOpenAPIv3 returns a handler that serves OpenAPI v3 specs for CRDs, not forwarding /openapi/v3 requests to the delegate handler.

Types

type CRDSpecGetter

type CRDSpecGetter interface {
	GetCRDSpecs(clusterName logicalcluster.Name, name string) (specs map[string]cached.Data[*spec3.OpenAPI], err error)
}

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller watches CustomResourceDefinitions and publishes OpenAPI v3.

func NewController

NewController creates a new Controller with input CustomResourceDefinition informer.

func (*Controller) GetCRDSpecs

func (c *Controller) GetCRDSpecs(clusterName logicalcluster.Name, name string) (specs map[string]cached.Data[*spec3.OpenAPI], err error)

func (*Controller) Run

func (c *Controller) Run(ctx context.Context)

type ServiceCache

type ServiceCache struct {
	// contains filtered or unexported fields
}

ServiceCache implements a cluster-aware OpenAPI v3 handler, sharing the OpenAPI service for equal API surface configurations.

func NewServiceCache

func NewServiceCache(config *common.Config, crdLister kcp.ClusterAwareCRDClusterLister, specGetter CRDSpecGetter, serviceCacheSize int) *ServiceCache

func (*ServiceCache) RegisterStaticAPIs

func (c *ServiceCache) RegisterStaticAPIs(cont *restful.Container) error

func (*ServiceCache) ServeHTTP

func (c *ServiceCache) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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