Documentation ¶
Index ¶
- func ReadYAML(data []byte, configScheme *runtime.Scheme, versions ...schema.GroupVersion) (runtime.Object, error)
- func ReadYAMLFile(filename string, configScheme *runtime.Scheme, versions ...schema.GroupVersion) (runtime.Object, error)
- type ControllerBuilder
- func (b *ControllerBuilder) Run() error
- func (b *ControllerBuilder) WithInstanceIdentity(identity string) *ControllerBuilder
- func (b *ControllerBuilder) WithKubeConfigFile(kubeConfigFilename string, defaults *client.ClientConnectionOverrides) *ControllerBuilder
- func (b *ControllerBuilder) WithLeaderElection(leaderElection configv1.LeaderElection, defaultNamespace, defaultName string) *ControllerBuilder
- type ControllerCommandConfig
- type ControllerFlags
- func (f *ControllerFlags) AddFlags(cmd *cobra.Command)
- func (f *ControllerFlags) ToClientConfig(overrides *client.ClientConnectionOverrides) (*rest.Config, error)
- func (f *ControllerFlags) ToConfigObj(configScheme *runtime.Scheme, versions ...schema.GroupVersion) (runtime.Object, error)
- func (o *ControllerFlags) Validate() error
- type StartFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadYAML ¶
func ReadYAML(data []byte, configScheme *runtime.Scheme, versions ...schema.GroupVersion) (runtime.Object, error)
ReadYAML decodes a runtime.Object from the provided scheme TODO versions goes away with more complete scheme in 1.11
func ReadYAMLFile ¶
func ReadYAMLFile(filename string, configScheme *runtime.Scheme, versions ...schema.GroupVersion) (runtime.Object, error)
ReadYAMLFile read a file and decodes a runtime.Object from the provided scheme
Types ¶
type ControllerBuilder ¶
type ControllerBuilder struct {
// contains filtered or unexported fields
}
OperatorBuilder allows the construction of an controller in optional pieces.
func NewController ¶
func NewController(componentName string, startFunc StartFunc) *ControllerBuilder
NewController returns a builder struct for constructing the command you want to run
func (*ControllerBuilder) Run ¶
func (b *ControllerBuilder) Run() error
Run starts your controller for you. It uses leader election if you asked, otherwise it directly calls you
func (*ControllerBuilder) WithInstanceIdentity ¶
func (b *ControllerBuilder) WithInstanceIdentity(identity string) *ControllerBuilder
WithInstanceIdentity sets the instance identity to use if you need something special. The default is just a UID which is usually fine for a pod.
func (*ControllerBuilder) WithKubeConfigFile ¶
func (b *ControllerBuilder) WithKubeConfigFile(kubeConfigFilename string, defaults *client.ClientConnectionOverrides) *ControllerBuilder
WithKubeConfigFile sets an optional kubeconfig file. inclusterconfig will be used if filename is empty
func (*ControllerBuilder) WithLeaderElection ¶
func (b *ControllerBuilder) WithLeaderElection(leaderElection configv1.LeaderElection, defaultNamespace, defaultName string) *ControllerBuilder
WithLeaderElection adds leader election options
type ControllerCommandConfig ¶
type ControllerCommandConfig struct {
// contains filtered or unexported fields
}
ControllerCommandConfig holds values required to construct a command to run.
func NewControllerCommandConfig ¶
func NewControllerCommandConfig(componentName string, version version.Info, startFunc StartFunc) *ControllerCommandConfig
NewControllerConfig returns a new ControllerCommandConfig which can be used to wire up all the boiler plate of a controller TODO add more methods around wiring health checks and the like
func (*ControllerCommandConfig) NewCommand ¶
func (c *ControllerCommandConfig) NewCommand() *cobra.Command
NewCommand returns a new command that a caller must set the Use and Descriptions on. It wires default log, profiling, leader election and other "normal" behaviors.
func (*ControllerCommandConfig) StartController ¶
func (c *ControllerCommandConfig) StartController() error
StartController runs the controller
type ControllerFlags ¶
type ControllerFlags struct { // ConfigFile hold the configfile to load ConfigFile string // KubeConfigFile points to a kubeconfig file if you don't want to use the in cluster config KubeConfigFile string }
ControllerFlags provides the "normal" controller flags
func NewControllerFlags ¶
func NewControllerFlags() *ControllerFlags
NewControllerFlags returns flags with default values set
func (*ControllerFlags) AddFlags ¶
func (f *ControllerFlags) AddFlags(cmd *cobra.Command)
AddFlags register and binds the default flags
func (*ControllerFlags) ToClientConfig ¶
func (f *ControllerFlags) ToClientConfig(overrides *client.ClientConnectionOverrides) (*rest.Config, error)
ToClientConfig given completed flags, returns a rest.Config. overrides are optional
func (*ControllerFlags) ToConfigObj ¶
func (f *ControllerFlags) ToConfigObj(configScheme *runtime.Scheme, versions ...schema.GroupVersion) (runtime.Object, error)
ToConfigObj given completed flags, returns a config object for the flag that was specified. TODO versions goes away in 1.11
func (*ControllerFlags) Validate ¶
func (o *ControllerFlags) Validate() error
Validate makes sure the required flags are specified and no illegal combinations are found