Documentation ¶
Index ¶
Constants ¶
const (
// PlaybookCmd is a command for executing ansible playbooks.
PlaybookCmd = "ansible-playbook"
)
Variables ¶
This section is empty.
Functions ¶
func GetContrailVersion ¶
func GetContrailVersion(cluster *models.ContrailCluster, logger *logrus.Entry) string
GetContrailVersion returns Contrail version specified by user.
func ImageReference ¶
ImageReference returns image reference.
Types ¶
type CLIClient ¶
type CLIClient struct {
// contains filtered or unexported fields
}
CLIClient allows to play Ansible playbooks via ansible-playbook CLI.
func NewCLIClient ¶
func NewCLIClient( reporter *report.Reporter, logFilePath string, workingDirectory string, isTestInstance bool, ) *CLIClient
NewCLIClient returns CLIClient.
func (*CLIClient) IsTest ¶
IsTest returns true for testing instance. TODO: move test logic to separate Mock type and use dependency injection using ansible.Player interface.
func (*CLIClient) Play ¶
Play plays Ansible playbook via ansible-playbook CLI. It runs playbook from in give virtualenv directory if non-zero value virtualenvPath is given.
func (*CLIClient) WorkingDirectory ¶
WorkingDirectory returns working directory.
type ContainerParameters ¶
type ContainerParameters struct { // HostVolumes is the list of volumes that will be mounted from host to container. // If ForceContainerRecreate is disabled and Container exists it won't load current volumes! HostVolumes []Volume // Env is a list of environment variables. Single string value should be in form KEY=VALUE. Env []string // ImageRef is the name of image that will be pulled for certain action REGISTRY/IMAGE_NAME:TAG. ImageRef string // ImageRefUsername is a username for Docker registry. ImageRefUsername string // ImageRefPassword is a password for Docker registry. ImageRefPassword string // WorkingDirectory is the directory from which a command is started. WorkingDirectory string // ContainerPrefix is the prefix that will be used for container name. ContainerPrefix string // If true instead of starting base container entrypoint it will call command to keep it alive. OverwriteEntrypoint bool // ForceContainerRecreate determines whether if there was an existing container should it be used or removed // and created again to use current volumes. ForceContainerRecreate bool // RemoveContainer determines whether container should be removed after its work. RemoveContainer bool // HostNetwork determines whether new container should have access to host's network configuration. HostNetwork bool // Privileged gives all capabilities to the container. Privileged bool }
ContainerParameters holds all the necessary parameters for executing a command in container.
func (*ContainerParameters) String ¶
func (c *ContainerParameters) String() string
type ContainerPlayer ¶
type ContainerPlayer struct {
// contains filtered or unexported fields
}
ContainerPlayer plays Ansible playbooks via docker exec.
func NewContainerPlayer ¶
func NewContainerPlayer(reporter *report.Reporter, logFilePath string) (*ContainerPlayer, error)
NewContainerPlayer returns *ContainerPlayer.
func (*ContainerPlayer) StartExecuteAndRemove ¶
func (p *ContainerPlayer) StartExecuteAndRemove( ctx context.Context, cp *ContainerParameters, cmd []string, ) (err error)
StartExecuteAndRemove creates a container, executes certain command and after completion it removes that container. The first element of cmd is command and the rest are its parameters. Notice that imageRepo should already be added to docker daemon's insecure registry list by contrail-command-deployer, so private insecure registries don't need extra care when getting pulled.