builder

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 24 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIServer = &Server{
	StorageProvider: map[schema.GroupResource]*SingletonProvider{},
}

APIServer builds an apiserver to server Kubernetes resources and sub resources.

Functions

This section is empty.

Types

type Command

type Command = cobra.Command

Command is an alias for cobra.Command and is used to start the apiserver.

type GenericAPIServer

type GenericAPIServer = server.GenericAPIServer

GenericAPIServer is an alias for pkgserver.GenericAPIServer

type OpenAPIDefinition

type OpenAPIDefinition = common.OpenAPIDefinition

OpenAPIDefinition is an alias for common.OpenAPIDefinition

type Server

type Server struct {
	ServerName string
	EtcdPath   string

	StorageProvider map[schema.GroupResource]*SingletonProvider

	Schemes []*runtime.Scheme
	// contains filtered or unexported fields
}

Server builds a new apiserver for a single API group

func NewAPIServer added in v0.0.4

func NewAPIServer() *Server

func (*Server) Build

func (r *Server) Build(ctx context.Context) (*Command, error)

Build returns a Command used to run the apiserver

func (*Server) Execute

func (r *Server) Execute(ctx context.Context) error

Execute builds and executes the apiserver Command.

func (*Server) WithConfigFns

func (r *Server) WithConfigFns(fns ...func(config *server.RecommendedConfig) *server.RecommendedConfig) *Server

WithConfigFns sets functions to customize the RecommendedConfig

func (*Server) WithEtcdPath

func (r *Server) WithEtcdPath(etcdPath string) *Server

func (*Server) WithFlagFns

func (r *Server) WithFlagFns(fns ...func(set *pflag.FlagSet) *pflag.FlagSet) *Server

WithFlagFns sets functions to customize the flags for the compiled binary.

func (*Server) WithLocalDebugExtension

func (a *Server) WithLocalDebugExtension() *Server

WithLocalDebugExtension adds an optional local-debug mode to the apiserver so that it can be tested locally without involving a complete kubernetes cluster. A flag named "--standalone-debug-mode" will also be added the binary which forcily requires "--bind-address" to be "127.0.0.1" in order to avoid security issues.

func (*Server) WithOpenAPIDefinitions

func (r *Server) WithOpenAPIDefinitions(
	name, version string,
	defs openapicommon.GetOpenAPIDefinitions) *Server

func (*Server) WithOptionsFns

func (r *Server) WithOptionsFns(fns ...func(*ServerOptions) *ServerOptions) *Server

WithOptionsFns sets functions to customize the ServerOptions used to create the apiserver

func (*Server) WithResourceAndHandler

func (r *Server) WithResourceAndHandler(obj resource.Object, sp *rest.StorageProvider) *Server

WithResourceAndHandler registers a request handler for the resource rather than the default etcd backend storage.

Note: WithResourceAndHandler should never be called after the GroupResource has already been registered with another version.

Note: WithResourceAndHandler will NOT register the "status" subresource for the resource object.

func (*Server) WithServerFns

func (r *Server) WithServerFns(fns ...func(server *GenericAPIServer) *GenericAPIServer) *Server

WithServerFns sets functions to customize the GenericAPIServer

func (*Server) WithServerName

func (r *Server) WithServerName(serverName string) *Server

func (*Server) WithoutEtcd

func (r *Server) WithoutEtcd() *Server

WithoutEtcd removes etcd related settings from apiserver.

type ServerOptions

type ServerOptions = options.ServerOptions

ServerOptions is an alias for apiserverbuilder.ServerOptions

type SingletonProvider added in v0.0.4

type SingletonProvider struct {
	sync.Once
	Provider *builderrest.StorageProvider
	Storage  registryrest.Storage
	// contains filtered or unexported fields
}

singletonProvider ensures different versions of the same resource share storage

func (*SingletonProvider) Get added in v0.0.4

type Storage

type Storage = rest.Storage

Storage is an alias for rest.Storage. Storage implements the interfaces defined in the rest package to expose new REST endpoints for a Kubernetes resource.

Directories

Path Synopsis
resourcerest
Package resourcerest defines interfaces for resource REST implementations.
Package resourcerest defines interfaces for resource REST implementations.
resourcestrategy
Package resourcestrategy defines interfaces for customizing how resources are converted and stored.
Package resourcestrategy defines interfaces for customizing how resources are converted and stored.

Jump to

Keyboard shortcuts

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