apiserverk8s.io/apiserver/pkg/endpoints/discovery Index | Files | Directories

package discovery

import "k8s.io/apiserver/pkg/endpoints/discovery"

Index

Constants

const APIGroupPrefix = "/apis"

Functions

func NewLegacyRootAPIHandler

func NewLegacyRootAPIHandler(addresses Addresses, serializer runtime.NegotiatedSerializer, apiPrefix string) *legacyRootAPIHandler

func NewRootAPIsHandler

func NewRootAPIsHandler(addresses Addresses, serializer runtime.NegotiatedSerializer) *rootAPIsHandler

func StorageVersionHash

func StorageVersionHash(group, version, kind string) string

StorageVersionHash calculates the storage version hash for a <group/version/kind> tuple. WARNING: this function is subject to change. Clients shouldn't depend on this function.

Types

type APIGroupHandler

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

APIGroupHandler creates a webservice serving the supported versions, preferred version, and name of a group. E.g., such a web service will be registered at /apis/extensions.

func NewAPIGroupHandler

func NewAPIGroupHandler(serializer runtime.NegotiatedSerializer, group metav1.APIGroup) *APIGroupHandler

func (*APIGroupHandler) ServeHTTP

func (s *APIGroupHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*APIGroupHandler) WebService

func (s *APIGroupHandler) WebService() *restful.WebService

type APIResourceLister

type APIResourceLister interface {
	ListAPIResources() []metav1.APIResource
}

type APIResourceListerFunc

type APIResourceListerFunc func() []metav1.APIResource

func (APIResourceListerFunc) ListAPIResources

func (f APIResourceListerFunc) ListAPIResources() []metav1.APIResource

type APIVersionHandler

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

APIVersionHandler creates a webservice serving the supported resources for the version E.g., such a web service will be registered at /apis/extensions/v1beta1.

func NewAPIVersionHandler

func NewAPIVersionHandler(serializer runtime.NegotiatedSerializer, groupVersion schema.GroupVersion, apiResourceLister APIResourceLister) *APIVersionHandler

func (*APIVersionHandler) AddToWebService

func (s *APIVersionHandler) AddToWebService(ws *restful.WebService)

func (*APIVersionHandler) ServeHTTP

func (s *APIVersionHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type Addresses

type Addresses interface {
	ServerAddressByClientCIDRs(net.IP) []metav1.ServerAddressByClientCIDR
}

type CIDRRule

type CIDRRule struct {
	IPRange net.IPNet

	// Address is the address (hostname or IP and port) that should be used in
	// if this CIDR matches
	Address string
}

CIDRRule is a rule for adding an alternate path to the master based on matching CIDR

func (CIDRRule) ServerAddressByClientCIDRs

func (d CIDRRule) ServerAddressByClientCIDRs(clientIP net.IP) []metav1.ServerAddressByClientCIDR

type DefaultAddresses

type DefaultAddresses struct {
	// CIDRRules is a list of CIDRs and Addresses to use if a client is in the range
	CIDRRules []CIDRRule

	// DefaultAddress is the address (hostname or IP and port) that should be used in
	// if no CIDR matches more specifically.
	DefaultAddress string
}

DefaultAddresses is a default implementation of Addresses that will work in most cases

func (DefaultAddresses) ServerAddressByClientCIDRs

func (d DefaultAddresses) ServerAddressByClientCIDRs(clientIP net.IP) []metav1.ServerAddressByClientCIDR

type GroupLister

type GroupLister interface {
	// Groups returns APIGroups for discovery, filling in ServerAddressByClientCIDRs
	// based on data in req.
	Groups(ctx context.Context, req *http.Request) ([]metav1.APIGroup, error)
}

GroupLister knows how to list APIGroups for discovery.

type GroupManager

type GroupManager interface {
	GroupLister

	AddGroup(apiGroup metav1.APIGroup)
	RemoveGroup(groupName string)
	ServeHTTP(resp http.ResponseWriter, req *http.Request)
	WebService() *restful.WebService
}

GroupManager is an interface that allows dynamic mutation of the existing webservice to handle API groups being added or removed.

Source Files

addresses.go group.go legacy.go root.go storageversionhash.go util.go version.go

Directories

PathSynopsis
pkg/endpoints/discovery/aggregated
Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
18 packages
Last checked
8 hours ago

Tools for package owners.