builders

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Codecs provides access to encoding and decoding for the scheme.

ParameterCodec is a codec for decoding parameters.

View Source
var ParameterScheme = runtime.NewScheme()

ParameterScheme is a scheme dedicated for registering parameters.

View Source
var Scheme = runtime.NewScheme()

Scheme is the default instance of runtime.Scheme to which types in the Kubernetes API are already registered.

View Source
var StatusStorageStrategySingleton = DefaultStatusStorageStrategy{StorageStrategySingleton}
View Source
var StorageStrategySingleton = DefaultStorageStrategy{
	Scheme,
	names.SimpleNameGenerator,
}

Functions

func NewApiResource

func NewApiResource(
	unversionedBuilder UnversionedResourceBuilder,
	new, newList func() runtime.Object,
	storeBuilder StorageBuilder,
) *versionedResourceBuilder

NewApiResource returns a new versionedResourceBuilder for registering endpoints for resources that are persisted to storage. strategy - unversionedBuilder from calling NewUnversionedXXX() new - function for creating new empty VERSIONED instances - e.g. func() runtime.Object { return &Deployment{} } newList - function for creating an empty list of VERSIONED instances - e.g. func() runtime.Object { return &DeploymentList{} } storeBuilder - builder for creating the store.

func NewApiResourceWithStorage

func NewApiResourceWithStorage(
	unversionedBuilder UnversionedResourceBuilder,
	new, newList func() runtime.Object,
	RESTFunc NewRESTFunc,
) *versionedResourceBuilder

NewApiResourceWithStorage returns a new versionedResourceBuilder for registering endpoints that does not require standard storage (e.g. subresources reuses the storage for the parent resource). strategy - unversionedBuilder from calling NewUnversionedXXX() new - function for creating new empty VERSIONED instances - e.g. func() runtime.Object { return &Deployment{} } storage - storage for manipulating the resource.

Types

type APIGroupBuilder

type APIGroupBuilder struct {
	UnVersioned     *UnVersionedApiBuilder
	Versions        []*VersionedApiBuilder
	Name            string
	ImportPrefix    string
	RootScopedKinds []string
}

func NewApiGroupBuilder

func NewApiGroupBuilder(name, prefix string) *APIGroupBuilder

func (*APIGroupBuilder) AddToScheme

func (g *APIGroupBuilder) AddToScheme(scheme *runtime.Scheme) error

func (*APIGroupBuilder) Build

Build returns a new NewDefaultAPIGroupInfo to install into a GenericApiServer.

func (*APIGroupBuilder) GetLegacyCodec

func (g *APIGroupBuilder) GetLegacyCodec() []schema.GroupVersion

func (*APIGroupBuilder) GetVersionPreferenceOrder

func (g *APIGroupBuilder) GetVersionPreferenceOrder() []string

GetVersionPreferenceOrder returns the preferred ordering of versions for this api group.

func (*APIGroupBuilder) WithRootScopedKinds

func (g *APIGroupBuilder) WithRootScopedKinds(kinds ...string) *APIGroupBuilder

func (*APIGroupBuilder) WithUnVersionedApi

func (g *APIGroupBuilder) WithUnVersionedApi(unversioned *UnVersionedApiBuilder) *APIGroupBuilder

func (*APIGroupBuilder) WithVersionedApis

func (g *APIGroupBuilder) WithVersionedApis(versions ...*VersionedApiBuilder) *APIGroupBuilder

type DefaultStatusStorageStrategy

type DefaultStatusStorageStrategy struct {
	DefaultStorageStrategy
}

func (DefaultStatusStorageStrategy) PrepareForUpdate

func (DefaultStatusStorageStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object)

type DefaultStorageStrategy

type DefaultStorageStrategy struct {
	runtime.ObjectTyper
	names.NameGenerator
}

func (DefaultStorageStrategy) AllowCreateOnUpdate

func (DefaultStorageStrategy) AllowCreateOnUpdate() bool

func (DefaultStorageStrategy) AllowUnconditionalUpdate

func (DefaultStorageStrategy) AllowUnconditionalUpdate() bool

func (DefaultStorageStrategy) BasicMatch

MatchResource is the filter used by the generic etcd backend to watch events from etcd to clients of the apiserver only interested in specific labels/fields.

func (DefaultStorageStrategy) Build

func (DefaultStorageStrategy) Build(
	builder StorageBuilder,
	store *StorageWrapper,
	options *generic.StoreOptions,
)

Build sets the strategy for the store.

func (DefaultStorageStrategy) Canonicalize

func (DefaultStorageStrategy) Canonicalize(obj runtime.Object)

func (DefaultStorageStrategy) GetAttrs

func (DefaultStorageStrategy) GetSelectableFields

func (DefaultStorageStrategy) GetSelectableFields(obj HasObjectMeta) fields.Set

GetSelectableFields returns a field set that represents the object.

func (DefaultStorageStrategy) GetTriggerFuncs

func (b DefaultStorageStrategy) GetTriggerFuncs() storage.IndexerFuncs

func (DefaultStorageStrategy) NamespaceScoped

func (DefaultStorageStrategy) NamespaceScoped() bool

func (DefaultStorageStrategy) ObjectNameFunc

func (DefaultStorageStrategy) ObjectNameFunc(obj runtime.Object) (string, error)

func (DefaultStorageStrategy) PrepareForCreate

func (DefaultStorageStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object)

func (DefaultStorageStrategy) PrepareForUpdate

func (DefaultStorageStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object)

func (DefaultStorageStrategy) Validate

func (DefaultStorageStrategy) ValidateUpdate

func (DefaultStorageStrategy) ValidateUpdate(
	ctx context.Context,
	obj, old runtime.Object,
) field.ErrorList

func (*DefaultStorageStrategy) WarningsOnCreate

func (*DefaultStorageStrategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string

func (*DefaultStorageStrategy) WarningsOnUpdate

func (*DefaultStorageStrategy) WarningsOnUpdate(
	ctx context.Context,
	obj, old runtime.Object,
) []string

type HasObjectMeta

type HasObjectMeta interface {
	GetObjectMeta() *metav1.ObjectMeta
}

type HasObjectMetaSpecStatus

type HasObjectMetaSpecStatus interface {
	HasObjectMeta
	HasSpec
	HasStatus
}

type HasSpec

type HasSpec interface {
	GetSpec() any
	SetSpec(spec any)
}

type HasStatus

type HasStatus interface {
	NewStatus() any
	GetStatus() any
	SetStatus(status any)
}

type NewRESTFunc

type NewRESTFunc func(getter generic.RESTOptionsGetter) rest.Storage

type SchemeFns

type SchemeFns interface {
	DefaultingFunction(obj any)
	GetConversionFunctions() []any
	Register(scheme *runtime.Scheme) error
	FieldSelectorConversion(label, value string) (string, string, error)
}

Deprecated.

type StandardStorageProvider

type StandardStorageProvider interface {
	GetStandardStorage() rest.StandardStorage
}

type StorageBuilder

type StorageBuilder interface {
	Build(builder StorageBuilder, store *StorageWrapper, options *generic.StoreOptions)

	names.NameGenerator
	runtime.ObjectTyper

	ObjectNameFunc(obj runtime.Object) (string, error)
	NamespaceScoped() bool
	AllowCreateOnUpdate() bool
	AllowUnconditionalUpdate() bool
	Canonicalize(obj runtime.Object)
	PrepareForCreate(ctx context.Context, obj runtime.Object)
	PrepareForUpdate(ctx context.Context, obj, old runtime.Object)
	Validate(ctx context.Context, obj runtime.Object) field.ErrorList
	ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList
	GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error)
	GetTriggerFuncs() storage.IndexerFuncs
	GetSelectableFields(obj HasObjectMeta) fields.Set
	BasicMatch(label labels.Selector, field fields.Selector) storage.SelectionPredicate
	WarningsOnCreate(ctx context.Context, obj runtime.Object) []string
	WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string
}

type StorageWrapper

type StorageWrapper struct {
	registry.Store
}

func (StorageWrapper) Create

func (s StorageWrapper) Create(
	ctx context.Context,
	obj runtime.Object,
	createValidation rest.ValidateObjectFunc,
	options *metav1.CreateOptions,
) (runtime.Object, error)

type StorageWrapperWithShortcuts

type StorageWrapperWithShortcuts struct {
	*StorageWrapper
	// contains filtered or unexported fields
}

func (*StorageWrapperWithShortcuts) Categories

func (b *StorageWrapperWithShortcuts) Categories() []string

func (*StorageWrapperWithShortcuts) ShortNames

func (b *StorageWrapperWithShortcuts) ShortNames() []string

type UnVersionedApiBuilder

type UnVersionedApiBuilder struct {
	Kinds         []UnversionedResourceBuilder
	GroupVersion  schema.GroupVersion
	SchemeBuilder runtime.SchemeBuilder
}

func NewApiGroup

func NewApiGroup(group string) *UnVersionedApiBuilder

func (*UnVersionedApiBuilder) WithKinds

type UnversionedResourceBuilder

type UnversionedResourceBuilder interface {
	WithList
	WithShortNames
	WithCategories
	New() runtime.Object

	GetPath() string
	GetName() string
	GetKind() string
	ShouldUseRegistryStore() bool
}

func NewBuilder

func NewBuilder(
	name, kind, path string,
	new, newList func() runtime.Object,
	useRegistryStore bool,
) UnversionedResourceBuilder

func NewBuilderWithShortcuts

func NewBuilderWithShortcuts(
	name, kind, path string,
	new, newList func() runtime.Object,
	useRegistryStore bool,
	shortnames, categories []string,
) UnversionedResourceBuilder

func NewInternalResource

func NewInternalResource(
	name, kind string,
	new, newList func() runtime.Object,
) UnversionedResourceBuilder

NewInternalResource creates a new strategy for a resource name - name of the resource - e.g. "deployments" new - function for creating new empty UNVERSIONED instances - e.g. func() runtime.Object { return &Deployment{} } newList - function for creating an empty list of UNVERSIONED instances - e.g. func() runtime.Object { return &DeploymentList{} }.

func NewInternalResourceStatus

func NewInternalResourceStatus(
	name, kind string,
	new, newList func() runtime.Object,
) UnversionedResourceBuilder

NewInternalResourceStatus returns a new strategy for the status subresource of an object name - name of the resource - e.g. "deployments" new - function for creating new empty UNVERSIONED instances - e.g. func() runtime.Object { return &Deployment{} } newList - function for creating an empty list of UNVERSIONED instances - e.g. func() runtime.Object { return &DeploymentList{} }.

func NewInternalResourceWithShortcuts

func NewInternalResourceWithShortcuts(
	name, kind string,
	new, newList func() runtime.Object,
	shortnames, categories []string,
) UnversionedResourceBuilder

NewInternalResourceWithShortcuts creates a new strategy for a resource with shortnames and categories name - name of the resource - e.g. "deployments" new - function for creating new empty UNVERSIONED instances - e.g. func() runtime.Object { return &Deployment{} } newList - function for creating an empty list of UNVERSIONED instances - e.g. func() runtime.Object { return &DeploymentList{} } shortnames - shortnames of the resource - e.g. "deploy" categories - categories of the resource - e.g. "aggregation".

func NewInternalSubresource

func NewInternalSubresource(
	name, kind, path string,
	new func() runtime.Object,
) UnversionedResourceBuilder

NewInternalSubresource returns a new strategy for a subresource name - name of the resource - e.g. "deployments" path - path to the subresource - e.g. "scale" new - function for creating new empty UNVERSIONED instances - e.g. func() runtime.Object { return &Deployment{} }.

type UnversionedResourceBuilderImpl

type UnversionedResourceBuilderImpl struct {
	Path             string
	Name             string
	Kind             string
	NewFunc          func() runtime.Object
	NewListFunc      func() runtime.Object
	UseRegistryStore bool

	ShortNames []string
	Categories []string
}

func (*UnversionedResourceBuilderImpl) GetCategories

func (b *UnversionedResourceBuilderImpl) GetCategories() []string

func (*UnversionedResourceBuilderImpl) GetKind

func (*UnversionedResourceBuilderImpl) GetName

func (*UnversionedResourceBuilderImpl) GetPath

func (*UnversionedResourceBuilderImpl) GetShortNames

func (b *UnversionedResourceBuilderImpl) GetShortNames() []string

func (*UnversionedResourceBuilderImpl) New

func (*UnversionedResourceBuilderImpl) NewList

func (*UnversionedResourceBuilderImpl) ShouldUseRegistryStore

func (b *UnversionedResourceBuilderImpl) ShouldUseRegistryStore() bool

type VersionedApiBuilder

type VersionedApiBuilder struct {
	Kinds         []*versionedResourceBuilder
	GroupVersion  schema.GroupVersion
	SchemeBuilder runtime.SchemeBuilder

	// Deprecated: Only for compiliation backward-compatibility w/ 1.12+ version generators
	// removing in the future
	SchemaBuilder runtime.SchemeBuilder
}

func NewApiVersion

func NewApiVersion(group, version string) *VersionedApiBuilder

func (*VersionedApiBuilder) WithResources

func (s *VersionedApiBuilder) WithResources(
	resourceBuilders ...*versionedResourceBuilder,
) *VersionedApiBuilder

WithResources adds new resource types and subresources to the API versions resourceBuilders is a list of *versionedResourceBuilder.

type WithCategories

type WithCategories interface {
	// AddCategory(category string)
	GetCategories() []string
}

type WithList

type WithList interface {
	NewList() runtime.Object
}

type WithShortNames

type WithShortNames interface {
	// AddShortName(shortName string)
	GetShortNames() []string
}

Jump to

Keyboard shortcuts

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