aggregated

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 27 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AggregatedDiscoveryGV = schema.GroupVersion{Group: "apidiscovery.k8s.io", Version: "v2beta1"}
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,
	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 apidiscoveryv2beta1.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([]apidiscoveryv2beta1.APIGroupDiscovery)

	http.Handler
}

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

func NewResourceManager

func NewResourceManager() ResourceManager

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=v2beta1;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