openapiv3

package
v0.33.7 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 39 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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"
View Source
const CrdControllerName = "crd_openapi_v3_controller"

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.Value[*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) EvictCluster added in v0.31.5

func (c *Controller) EvictCluster(clusterName logicalcluster.Name)

EvictCluster removes all cached OpenAPI v3 specs for clusterName. Normally the entry is cleaned per-CRD via the CRD informer's delete event handler, but if the LogicalCluster delete races ahead of those CRD deletes (or any CRD delete event is missed), the bucket — which holds 100KB–1MB of built spec per CRD version — would leak for the lifetime of the process. Call this from a LogicalCluster delete handler to bound retention.

func (*Controller) GetCRDSpecs

func (c *Controller) GetCRDSpecs(clusterName logicalcluster.Name, name string) (specs map[string]cached.Value[*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.OpenAPIV3Config, 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