Documentation
¶
Index ¶
- type APIGroupFn
- type AddFlagsFn
- type Builder
- func (b *Builder) Execute() int
- func (b *Builder) With(rh ResourceHandler) *Builder
- func (b *Builder) WithAPIGroupFn(fn APIGroupFn) *Builder
- func (b *Builder) WithComponentName(n string) *Builder
- func (b *Builder) WithExtraAdmissionInitializers(f ExtraAdmissionInitializers) *Builder
- func (b *Builder) WithFlags(fns ...AddFlagsFn) *Builder
- func (b *Builder) WithGroupVersions(gvs ...schema.GroupVersion) *Builder
- func (b *Builder) WithOpenAPIDefinitions(name, version string, defs openapicommon.GetOpenAPIDefinitions) *Builder
- func (b *Builder) WithSharedInformerFactory(f SharedInformerFactory) *Builder
- type ExtraAdmissionInitializers
- type RecommendedConfigFn
- type ResourceHandler
- type SharedInformerFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIGroupFn ¶
type APIGroupFn func(scheme *runtime.Scheme, codecs serializer.CodecFactory, c *genericapiserver.CompletedConfig) genericapiserver.APIGroupInfo
APIGroupFn returns an APIGroupInfo for installing an API group into the server.
type AddFlagsFn ¶ added in v0.1.4
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 ¶
NewBuilder creates a new API server builder with the given runtime scheme.
func (*Builder) Execute ¶
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 ¶
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 ¶
type ExtraAdmissionInitializers func(*genericapiserver.RecommendedConfig) (SharedInformerFactory, []admission.PluginInitializer, error)
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 ¶
func Resource[E resource.Object, T resource.ObjectWithDeepCopy[E]](obj T, gvs ...schema.GroupVersion) ResourceHandler
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(stopCh <-chan struct{})
}
SharedInformerFactory is used to start informer watching for resource changes.