provision

package
Version: v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2015 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDetectionFailed  = errors.New("OS type not recognized")
	ErrSSHCommandFailed = errors.New("SSH command failure")
	ErrNotImplemented   = errors.New("Runtime not implemented")
)
View Source
var (
	ErrUnknownYumOsRelease = errors.New("unknown OS for Yum repository")
)

Functions

func ConfigureAuth

func ConfigureAuth(p Provisioner) error

func Register

func Register(name string, p *RegisteredProvisioner)

Types

type ArchProvisioner added in v0.5.0

type ArchProvisioner struct {
	GenericProvisioner
}

func (*ArchProvisioner) CompatibleWithHost added in v0.5.0

func (provisioner *ArchProvisioner) CompatibleWithHost() bool

func (*ArchProvisioner) GenerateDockerOptions added in v0.5.0

func (provisioner *ArchProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*ArchProvisioner) Package added in v0.5.0

func (provisioner *ArchProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*ArchProvisioner) Provision added in v0.5.0

func (provisioner *ArchProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error

func (*ArchProvisioner) Service added in v0.5.0

func (provisioner *ArchProvisioner) Service(name string, action serviceaction.ServiceAction) error

type Boot2DockerProvisioner

type Boot2DockerProvisioner struct {
	OsReleaseInfo *OsRelease
	Driver        drivers.Driver
	AuthOptions   auth.AuthOptions
	EngineOptions engine.EngineOptions
	SwarmOptions  swarm.SwarmOptions
}

func (*Boot2DockerProvisioner) AttemptIPContact added in v0.5.0

func (provisioner *Boot2DockerProvisioner) AttemptIPContact(dockerPort int)

func (*Boot2DockerProvisioner) CompatibleWithHost

func (provisioner *Boot2DockerProvisioner) CompatibleWithHost() bool

func (*Boot2DockerProvisioner) GenerateDockerOptions

func (provisioner *Boot2DockerProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*Boot2DockerProvisioner) GetAuthOptions added in v0.3.0

func (provisioner *Boot2DockerProvisioner) GetAuthOptions() auth.AuthOptions

func (*Boot2DockerProvisioner) GetDockerOptionsDir

func (provisioner *Boot2DockerProvisioner) GetDockerOptionsDir() string

func (*Boot2DockerProvisioner) GetDriver

func (provisioner *Boot2DockerProvisioner) GetDriver() drivers.Driver

func (*Boot2DockerProvisioner) GetOsReleaseInfo added in v0.4.0

func (provisioner *Boot2DockerProvisioner) GetOsReleaseInfo() (*OsRelease, error)

func (*Boot2DockerProvisioner) Hostname

func (provisioner *Boot2DockerProvisioner) Hostname() (string, error)

func (*Boot2DockerProvisioner) Package

func (provisioner *Boot2DockerProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*Boot2DockerProvisioner) Provision

func (provisioner *Boot2DockerProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error

func (*Boot2DockerProvisioner) SSHCommand

func (provisioner *Boot2DockerProvisioner) SSHCommand(args string) (string, error)

func (*Boot2DockerProvisioner) Service

func (provisioner *Boot2DockerProvisioner) Service(name string, action serviceaction.ServiceAction) error

func (*Boot2DockerProvisioner) SetHostname

func (provisioner *Boot2DockerProvisioner) SetHostname(hostname string) error

func (*Boot2DockerProvisioner) SetOsReleaseInfo

func (provisioner *Boot2DockerProvisioner) SetOsReleaseInfo(info *OsRelease)

type CentosProvisioner added in v0.3.0

type CentosProvisioner struct {
	RedHatProvisioner
}

type CoreOSProvisioner added in v0.5.0

type CoreOSProvisioner struct {
	GenericProvisioner
}

func (*CoreOSProvisioner) GenerateDockerOptions added in v0.5.0

func (provisioner *CoreOSProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*CoreOSProvisioner) Package added in v0.5.0

func (provisioner *CoreOSProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*CoreOSProvisioner) Provision added in v0.5.0

func (provisioner *CoreOSProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error

func (*CoreOSProvisioner) Service added in v0.5.0

func (provisioner *CoreOSProvisioner) Service(name string, action serviceaction.ServiceAction) error

func (*CoreOSProvisioner) SetHostname added in v0.5.0

func (provisioner *CoreOSProvisioner) SetHostname(hostname string) error

type DebianProvisioner added in v0.3.0

type DebianProvisioner struct {
	GenericProvisioner
}

func (*DebianProvisioner) GenerateDockerOptions added in v0.3.0

func (provisioner *DebianProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*DebianProvisioner) Package added in v0.3.0

func (provisioner *DebianProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*DebianProvisioner) Provision added in v0.3.0

func (provisioner *DebianProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error

func (*DebianProvisioner) Service added in v0.3.0

func (provisioner *DebianProvisioner) Service(name string, action serviceaction.ServiceAction) error

type DockerOptions

type DockerOptions struct {
	EngineOptions     string
	EngineOptionsPath string
}

type EngineConfigContext added in v0.3.0

type EngineConfigContext struct {
	DockerPort       int
	AuthOptions      auth.AuthOptions
	EngineOptions    engine.EngineOptions
	DockerOptionsDir string
}

type ErrDaemonAvailable added in v0.5.0

type ErrDaemonAvailable struct {
	// contains filtered or unexported fields
}

func NewErrDaemonAvailable added in v0.5.0

func NewErrDaemonAvailable(err error) ErrDaemonAvailable

func (ErrDaemonAvailable) Error added in v0.5.0

func (e ErrDaemonAvailable) Error() string

type FedoraProvisioner added in v0.3.0

type FedoraProvisioner struct {
	RedHatProvisioner
}

type GenericProvisioner added in v0.3.0

type GenericProvisioner struct {
	OsReleaseId       string
	DockerOptionsDir  string
	DaemonOptionsFile string
	Packages          []string
	OsReleaseInfo     *OsRelease
	Driver            drivers.Driver
	AuthOptions       auth.AuthOptions
	EngineOptions     engine.EngineOptions
	SwarmOptions      swarm.SwarmOptions
}

func (*GenericProvisioner) CompatibleWithHost added in v0.3.0

func (provisioner *GenericProvisioner) CompatibleWithHost() bool

func (*GenericProvisioner) GenerateDockerOptions added in v0.3.0

func (provisioner *GenericProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*GenericProvisioner) GetAuthOptions added in v0.3.0

func (provisioner *GenericProvisioner) GetAuthOptions() auth.AuthOptions

func (*GenericProvisioner) GetDockerOptionsDir added in v0.3.0

func (provisioner *GenericProvisioner) GetDockerOptionsDir() string

func (*GenericProvisioner) GetDriver added in v0.3.0

func (provisioner *GenericProvisioner) GetDriver() drivers.Driver

func (*GenericProvisioner) GetOsReleaseInfo added in v0.4.0

func (provisioner *GenericProvisioner) GetOsReleaseInfo() (*OsRelease, error)

func (*GenericProvisioner) Hostname added in v0.3.0

func (provisioner *GenericProvisioner) Hostname() (string, error)

func (*GenericProvisioner) SSHCommand added in v0.3.0

func (provisioner *GenericProvisioner) SSHCommand(args string) (string, error)

func (*GenericProvisioner) SetHostname added in v0.3.0

func (provisioner *GenericProvisioner) SetHostname(hostname string) error

func (*GenericProvisioner) SetOsReleaseInfo added in v0.3.0

func (provisioner *GenericProvisioner) SetOsReleaseInfo(info *OsRelease)

type OsRelease

type OsRelease struct {
	AnsiColor    string `osr:"ANSI_COLOR"`
	Name         string `osr:"NAME"`
	Version      string `osr:"VERSION"`
	Id           string `osr:"ID"`
	IdLike       string `osr:"ID_LIKE"`
	PrettyName   string `osr:"PRETTY_NAME"`
	VersionId    string `osr:"VERSION_ID"`
	HomeUrl      string `osr:"HOME_URL"`
	SupportUrl   string `osr:"SUPPORT_URL"`
	BugReportUrl string `osr:"BUG_REPORT_URL"`
}

Values in this struct must always be string or the reflection will not work properly.

func NewOsRelease

func NewOsRelease(contents []byte) (*OsRelease, error)

func (*OsRelease) ParseOsRelease

func (osr *OsRelease) ParseOsRelease(osReleaseContents []byte) error

type PackageListInfo added in v0.4.0

type PackageListInfo struct {
	OsRelease        string
	OsReleaseVersion string
}

type Provisioner

type Provisioner interface {
	// Create the files for the daemon to consume configuration settings (return struct of content and path)
	GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

	// Get the directory where the settings files for docker are to be found
	GetDockerOptionsDir() string

	// Return the auth options used to configure remote connection for the daemon.
	GetAuthOptions() auth.AuthOptions

	// Run a package action e.g. install
	Package(name string, action pkgaction.PackageAction) error

	// Get Hostname
	Hostname() (string, error)

	// Set hostname
	SetHostname(hostname string) error

	// Figure out if this is the right provisioner to use based on /etc/os-release info
	CompatibleWithHost() bool

	// Do the actual provisioning piece:
	//     1. Set the hostname on the instance.
	//     2. Install Docker if it is not present.
	//     3. Configure the daemon to accept connections over TLS.
	//     4. Copy the needed certificates to the server and local config dir.
	//     5. Configure / activate swarm if applicable.
	Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error

	// Perform action on a named service e.g. stop
	Service(name string, action serviceaction.ServiceAction) error

	// Get the driver which is contained in the provisioner.
	GetDriver() drivers.Driver

	// Short-hand for accessing an SSH command from the driver.
	SSHCommand(args string) (string, error)

	// Set the OS Release info depending on how it's represented
	// internally
	SetOsReleaseInfo(info *OsRelease)

	// Get the OS Release info for the current provisioner
	GetOsReleaseInfo() (*OsRelease, error)
}

Distribution specific actions

func DetectProvisioner

func DetectProvisioner(d drivers.Driver) (Provisioner, error)

func NewArchProvisioner added in v0.5.0

func NewArchProvisioner(d drivers.Driver) Provisioner

func NewBoot2DockerProvisioner

func NewBoot2DockerProvisioner(d drivers.Driver) Provisioner

func NewCentosProvisioner added in v0.3.0

func NewCentosProvisioner(d drivers.Driver) Provisioner

func NewCoreOSProvisioner added in v0.5.0

func NewCoreOSProvisioner(d drivers.Driver) Provisioner

func NewDebianProvisioner added in v0.3.0

func NewDebianProvisioner(d drivers.Driver) Provisioner

func NewFedoraProvisioner added in v0.3.0

func NewFedoraProvisioner(d drivers.Driver) Provisioner

func NewOpenSUSEProvisioner added in v0.5.0

func NewOpenSUSEProvisioner(d drivers.Driver) Provisioner

func NewRancherProvisioner added in v0.3.0

func NewRancherProvisioner(d drivers.Driver) Provisioner

func NewRedHatProvisioner added in v0.3.0

func NewRedHatProvisioner(d drivers.Driver) Provisioner

func NewSLEDProvisioner added in v0.5.0

func NewSLEDProvisioner(d drivers.Driver) Provisioner

func NewSLESProvisioner added in v0.5.0

func NewSLESProvisioner(d drivers.Driver) Provisioner

func NewUbuntuProvisioner

func NewUbuntuProvisioner(d drivers.Driver) Provisioner

type RancherProvisioner added in v0.3.0

type RancherProvisioner struct {
	GenericProvisioner
}

func (*RancherProvisioner) Package added in v0.3.0

func (provisioner *RancherProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*RancherProvisioner) Provision added in v0.3.0

func (provisioner *RancherProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error

func (*RancherProvisioner) Service added in v0.3.0

func (provisioner *RancherProvisioner) Service(name string, action serviceaction.ServiceAction) error

func (*RancherProvisioner) SetHostname added in v0.3.0

func (provisioner *RancherProvisioner) SetHostname(hostname string) error

type RedHatProvisioner added in v0.3.0

type RedHatProvisioner struct {
	GenericProvisioner
}

func (*RedHatProvisioner) ConfigurePackageList added in v0.4.0

func (provisioner *RedHatProvisioner) ConfigurePackageList() error

func (*RedHatProvisioner) GenerateDockerOptions added in v0.3.0

func (provisioner *RedHatProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*RedHatProvisioner) Package added in v0.3.0

func (provisioner *RedHatProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*RedHatProvisioner) Provision added in v0.3.0

func (provisioner *RedHatProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error

func (*RedHatProvisioner) SSHCommand added in v0.3.0

func (provisioner *RedHatProvisioner) SSHCommand(args string) (string, error)

func (*RedHatProvisioner) Service added in v0.3.0

func (provisioner *RedHatProvisioner) Service(name string, action serviceaction.ServiceAction) error

func (*RedHatProvisioner) SetHostname added in v0.3.0

func (provisioner *RedHatProvisioner) SetHostname(hostname string) error

type RegisteredProvisioner

type RegisteredProvisioner struct {
	New func(d drivers.Driver) Provisioner
}

Detection

type SUSEProvisioner added in v0.5.0

type SUSEProvisioner struct {
	GenericProvisioner
}

func (*SUSEProvisioner) GenerateDockerOptions added in v0.5.0

func (provisioner *SUSEProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*SUSEProvisioner) Package added in v0.5.0

func (provisioner *SUSEProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*SUSEProvisioner) Provision added in v0.5.0

func (provisioner *SUSEProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error

func (*SUSEProvisioner) Service added in v0.5.0

func (provisioner *SUSEProvisioner) Service(name string, action serviceaction.ServiceAction) error

type SwarmCommandContext added in v0.3.0

type SwarmCommandContext struct {
	ContainerName string
	DockerDir     string
	DockerPort    int
	Ip            string
	Port          string
	AuthOptions   auth.AuthOptions
	SwarmOptions  swarm.SwarmOptions
	SwarmImage    string
}

type UbuntuProvisioner

type UbuntuProvisioner struct {
	GenericProvisioner
}

func (*UbuntuProvisioner) Package

func (provisioner *UbuntuProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*UbuntuProvisioner) Provision

func (provisioner *UbuntuProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error

func (*UbuntuProvisioner) Service

func (provisioner *UbuntuProvisioner) Service(name string, action serviceaction.ServiceAction) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL