apiserver

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIGroupFn

APIGroupFn returns an APIGroupInfo for installing an API group into the server.

type AddFlagsFn added in v0.1.4

type AddFlagsFn func(*pflag.FlagSet)

type Builder

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

Builder constructs and runs a Kubernetes API server with custom resource groups. It handles schema registration, storage configuration, admission, and lifecycle hooks.

func NewBuilder

func NewBuilder(scheme *runtime.Scheme) *Builder

NewBuilder creates a new API server builder with the given runtime scheme.

func (*Builder) Execute

func (b *Builder) Execute() int

Execute builds and runs the API server, returning an exit code suitable for os.Exit(). It configures storage, admission, informers, and launches the server with all registered resources.

func (*Builder) With

func (b *Builder) With(rh ResourceHandler) *Builder

With registers a ResourceHandler's API group and group versions.

func (*Builder) WithAPIGroupFn

func (b *Builder) WithAPIGroupFn(fn APIGroupFn) *Builder

WithAPIGroupFn registers an APIGroupFn to install an API group into the server.

func (*Builder) WithComponentName

func (b *Builder) WithComponentName(n string) *Builder

WithComponentName sets the component name used for server identification and logging.

func (*Builder) WithExtraAdmissionInitializers

func (b *Builder) WithExtraAdmissionInitializers(f ExtraAdmissionInitializers) *Builder

WithExtraAdmissionInitializers sets custom admission plugin initialization logic.

func (*Builder) WithFlags added in v0.1.4

func (b *Builder) WithFlags(fns ...AddFlagsFn) *Builder

WithFlags registers AddFlagsFn functions to be called when creating the command.

func (*Builder) WithGroupVersions

func (b *Builder) WithGroupVersions(gvs ...schema.GroupVersion) *Builder

WithGroupVersions appends the group versions to configure storage encoding/decoding for the API server. This must be provided by callers so that the storage codec matches the registered types in the scheme.

func (*Builder) WithOpenAPIDefinitions

func (b *Builder) WithOpenAPIDefinitions(name, version string, defs openapicommon.GetOpenAPIDefinitions) *Builder

WithOpenAPIDefinitions configures OpenAPI (Swagger) documentation for the API server.

func (*Builder) WithSharedInformerFactory

func (b *Builder) WithSharedInformerFactory(f SharedInformerFactory) *Builder

WithSharedInformerFactory registers a SharedInformerFactory to be started when the server starts.

type ExtraAdmissionInitializers

ExtraAdmissionInitializers is a callback that returns a SharedInformerFactory and admission plugin initializers.

type RecommendedConfigFn

type RecommendedConfigFn func(*genericapiserver.RecommendedConfig)

RecommendedConfigFn is a callback that modifies the RecommendedConfig before the server starts.

type ResourceHandler

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

ResourceHandler holds the configuration for registering a resource with the API server.

func Resource

Resource registers a Kubernetes resource with the API server.

The type parameters are:

  • E: the internal resource type implementing resource.Object
  • T: the typed resource (e.g., *Bar) that also implements resource.ObjectWithDeepCopy[E]

The gvs parameter specifies which group versions to register.

To customize the resource's short names or singular name in kubectl, implement ShortNamesProvider or SingularNameProvider on the resource type T:

func (b *Bar) ShortNames() []string {
    return []string{"br"}
}

func (b *Bar) GetSingularName() string {
    return "bar"
}

type SharedInformerFactory

type SharedInformerFactory interface {
	// Start begins watching resources and blocks until stopCh is closed.
	Start(stopCh <-chan struct{})
}

SharedInformerFactory is used to start informer watching for resource changes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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