Documentation ¶
Overview ¶
Package common provides generic commands shared by many Operators.
Index ¶
- func ImagePullCommand(nodes []*cke.Node, img cke.Image) cke.Commander
- func KillContainersCommand(nodes []*cke.Node, name string) cke.Commander
- func MakeDirsCommand(nodes []*cke.Node, dirs []string) cke.Commander
- func RunContainerCommand(nodes []*cke.Node, name string, img cke.Image, opts ...RunOption) cke.Commander
- func StopContainerCommand(node *cke.Node, name string) cke.Commander
- func VolumeCreateCommand(nodes []*cke.Node, name string) cke.Commander
- func VolumeRemoveCommand(nodes []*cke.Node, name string) cke.Commander
- type FilesBuilder
- type RunOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImagePullCommand ¶
ImagePullCommand returns a Commander to pull an image on nodes.
func KillContainersCommand ¶
KillContainersCommand returns a Commander to kill a container on nodes.
func MakeDirsCommand ¶
MakeDirsCommand returns a Commander to make directories on nodes.
func RunContainerCommand ¶
func RunContainerCommand(nodes []*cke.Node, name string, img cke.Image, opts ...RunOption) cke.Commander
RunContainerCommand returns a Commander to run or restart a system container.
func StopContainerCommand ¶
StopContainerCommand returns a Commander to stop a container on a node.
func VolumeCreateCommand ¶
VolumeCreateCommand returns a Commander to create a volume on nodes.
Types ¶
type FilesBuilder ¶
type FilesBuilder struct {
// contains filtered or unexported fields
}
FilesBuilder is a database of files to be created in nodes. It also implements cke.Commander.
func NewFilesBuilder ¶
func NewFilesBuilder(nodes []*cke.Node) *FilesBuilder
NewFilesBuilder creates a new FilesBuilder.
func (*FilesBuilder) AddFile ¶
func (c *FilesBuilder) AddFile(ctx context.Context, name string, f func(context.Context, *cke.Node) ([]byte, error)) error
AddFile adds a file to the builder. The contents of the file will be generated by f.
func (*FilesBuilder) AddKeyPair ¶
func (c *FilesBuilder) AddKeyPair(ctx context.Context, name string, f func(context.Context, *cke.Node) (cert, key []byte, err error)) error
AddKeyPair adds a certificate and private key pair to the builder. The certificate data and private key data will be generated by f.
func (*FilesBuilder) Command ¶
func (c *FilesBuilder) Command() cke.Command
Command implements cke.Commander
func (*FilesBuilder) Run ¶
func (c *FilesBuilder) Run(ctx context.Context, inf cke.Infrastructure) error
Run implements cke.Commander.
type RunOption ¶
type RunOption func(c *runContainerCommand)
RunOption is a functional option for RunContainerCommand
func WithExtra ¶
func WithExtra(params cke.ServiceParams) RunOption
WithExtra returns RunOption to set extra ServiceParams.
func WithOptsMap ¶
WithOptsMap returns RunOption to set container engine options for each node.
func WithParams ¶
func WithParams(params cke.ServiceParams) RunOption
WithParams returns RunOption to set ServiceParams.
func WithParamsMap ¶
func WithParamsMap(paramsMap map[string]cke.ServiceParams) RunOption
WithParamsMap returns RunOption to set ServiceParams for each node.
func WithRestart ¶
func WithRestart() RunOption
WithRestart returns RunOption to restart a container.