common

package
v1.26.4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package common provides generic commands shared by many Operators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImagePullCommand

func ImagePullCommand(nodes []*cke.Node, img cke.Image) cke.Commander

ImagePullCommand returns a Commander to pull an image on nodes.

func KillContainersCommand

func KillContainersCommand(nodes []*cke.Node, name string) cke.Commander

KillContainersCommand returns a Commander to kill a container on nodes.

func MakeDirsCommand

func MakeDirsCommand(nodes []*cke.Node, dirs []string) cke.Commander

MakeDirsCommand returns a Commander to make directories on nodes.

func MakeDirsCommandWithMode added in v1.13.17

func MakeDirsCommandWithMode(nodes []*cke.Node, dirs []string, mode string) cke.Commander

MakeDirsCommandWithMode returns a Commander to make directories on nodes with given permission mode.

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

func StopContainerCommand(node *cke.Node, name string) cke.Commander

StopContainerCommand returns a Commander to stop a container on a node.

func StopContainersCommand added in v1.17.8

func StopContainersCommand(nodes []*cke.Node, name string) cke.Commander

StopContainersCommand returns a Commander to stop each container on nodes.

func VolumeCreateCommand

func VolumeCreateCommand(nodes []*cke.Node, name string) cke.Commander

VolumeCreateCommand returns a Commander to create a volume on nodes.

func VolumeRemoveCommand

func VolumeRemoveCommand(nodes []*cke.Node, name string) cke.Commander

VolumeRemoveCommand returns a Commander to remove 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

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 WithOpts

func WithOpts(opts []string) RunOption

WithOpts returns RunOption to set container engine options.

func WithOptsMap

func WithOptsMap(optsMap map[string][]string) RunOption

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.

Jump to

Keyboard shortcuts

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