kube-aggregatork8s.io/kube-aggregator/pkg/controllers/openapi/aggregator Index | Files

package aggregator

import "k8s.io/kube-aggregator/pkg/controllers/openapi/aggregator"

Index

Variables

var ErrAPIServiceNotFound = errors.New("resource not found")

Functions

func NewCacheableDownloader

func NewCacheableDownloader(downloader *Downloader, handler http.Handler) cached.Data[*spec.Swagger]

Creates a downloader that also returns the etag, making it useful to use as a cached dependency.

Types

type Downloader

type Downloader struct {
}

Downloader is the OpenAPI downloader type. It will try to download spec from /openapi/v2 or /swagger.json endpoint.

func NewDownloader

func NewDownloader() Downloader

NewDownloader creates a new OpenAPI Downloader.

func (*Downloader) Download

func (s *Downloader) Download(handler http.Handler, etag string) (returnSpec *spec.Swagger, newEtag string, httpStatus int, err error)

Download downloads openAPI spec from /openapi/v2 endpoint of the given handler. httpStatus is only valid if err == nil

type SpecAggregator

type SpecAggregator interface {
	AddUpdateAPIService(apiService *v1.APIService, handler http.Handler) error
	UpdateAPIServiceSpec(apiServiceName string) error
	RemoveAPIService(apiServiceName string) error
}

SpecAggregator calls out to http handlers of APIServices and merges specs. It keeps state of the last known specs including the http etag.

func BuildAndRegisterAggregator

func BuildAndRegisterAggregator(downloader *Downloader, delegationTarget server.DelegationTarget, webServices []*restful.WebService,
	config *common.Config, pathHandler common.PathHandler) (SpecAggregator, error)

BuildAndRegisterAggregator registered OpenAPI aggregator handler. This function is not thread safe as it only being called on startup.

Source Files

aggregator.go downloader.go metrics.go priority.go

Version
v0.28.0-rc.0
Published
Jul 27, 2023
Platform
linux/amd64
Imports
24 packages
Last checked
51 minutes ago

Tools for package owners.