aggregated

package
v0.30.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 32 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DiscoveryEndpointRestrictions = discoveryEndpointRestrictions{}

DiscoveryEndpointRestrictions allows requests to /apis to provide a Content Negotiation GVK for aggregated discovery.

Functions

func IsAggregatedDiscoveryGVK

func IsAggregatedDiscoveryGVK(gvk *schema.GroupVersionKind) bool

IsAggregatedDiscoveryGVK checks if a provided GVK is the GVK for serving aggregated discovery.

func ServeHTTPWithETag

func ServeHTTPWithETag(
	object runtime.Object,
	hash string,
	targetGV schema.GroupVersion,
	serializer runtime.NegotiatedSerializer,
	w http.ResponseWriter,
	req *http.Request,
)

Attaches Cache-Busting functionality to an endpoint

  • Sets ETag header to provided hash
  • Replies with 304 Not Modified, if If-None-Match header matches hash

hash should be the value of calculateETag on object. If hash is empty, then the object is simply serialized without E-Tag functionality

Types

type FakeResourceManager

type FakeResourceManager interface {
	ResourceManager
	Expect() ResourceManager

	HasExpectedNumberActions() bool
	Validate() error
	WaitForActions(ctx context.Context, timeout time.Duration) error
}

func NewFakeResourceManager

func NewFakeResourceManager() FakeResourceManager

type ResourceManager

type ResourceManager interface {
	// Adds knowledge of the given groupversion to the discovery document
	// If it was already being tracked, updates the stored APIVersionDiscovery
	// Thread-safe
	AddGroupVersion(groupName string, value apidiscoveryv2.APIVersionDiscovery)

	// Sets a priority to be used while sorting a specific group and
	// group-version. If two versions report different priorities for
	// the group, the higher one will be used. If the group is not
	// known, the priority is ignored. The priority for this version
	// is forgotten once the group-version is forgotten
	SetGroupVersionPriority(gv metav1.GroupVersion, grouppriority, versionpriority int)

	// Removes all group versions for a given group
	// Thread-safe
	RemoveGroup(groupName string)

	// Removes a specific groupversion. If all versions of a group have been
	// removed, then the entire group is unlisted.
	// Thread-safe
	RemoveGroupVersion(gv metav1.GroupVersion)

	// Resets the manager's known list of group-versions and replaces them
	// with the given groups
	// Thread-Safe
	SetGroups([]apidiscoveryv2.APIGroupDiscovery)

	// Returns the same resource manager using a different source
	// The source is used to decide how to de-duplicate groups.
	// The group from the least-numbered source is used
	WithSource(source Source) ResourceManager

	http.Handler
}

This handler serves the /apis endpoint for an aggregated list of api resources indexed by their group version.

func NewResourceManager

func NewResourceManager(path string) ResourceManager

type Source added in v0.27.0

type Source uint
const (
	AggregatorSource Source = 0
	BuiltinSource    Source = 100
	CRDSource        Source = 200
)

The GroupVersion from the lowest Source takes precedence

type WrappedHandler

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

func WrapAggregatedDiscoveryToHandler

func WrapAggregatedDiscoveryToHandler(handler http.Handler, aggHandler http.Handler) *WrappedHandler

WrapAggregatedDiscoveryToHandler wraps a handler with an option to emit the aggregated discovery by passing in the aggregated discovery type in content negotiation headers: eg: (Accept: application/json;v=v2;g=apidiscovery.k8s.io;as=APIGroupDiscoveryList)

func (*WrappedHandler) GenerateWebService

func (wrapped *WrappedHandler) GenerateWebService(prefix string, returnType interface{}) *restful.WebService

func (*WrappedHandler) ServeHTTP

func (wrapped *WrappedHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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