provision

package
v0.16.2-gitlab.13 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LastReleaseBeforeCEVersioning = "1.13.1"
)

Variables

View Source
var (
	ErrDetectionFailed = errors.New("OS type not recognized")
)
View Source
var (
	ErrUnknownYumOsRelease = errors.New("unknown OS for Yum repository")
)

Functions

func ConfigureAuth

func ConfigureAuth(p Provisioner) error

func DockerClientVersion

func DockerClientVersion(ssh SSHCommander) (string, error)

DockerClientVersion returns the version of the Docker client on the host that ssh is connected to, e.g. "1.12.1".

func Register

func Register(name string, p *RegisteredProvisioner)

func SetDetector

func SetDetector(newDetector Detector)

func WaitForDocker

func WaitForDocker(p Provisioner, dockerPort int) error

Types

type ArchProvisioner

type ArchProvisioner struct {
	SystemdProvisioner
}

func (*ArchProvisioner) CompatibleWithHost

func (provisioner *ArchProvisioner) CompatibleWithHost() bool

func (*ArchProvisioner) Package

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

func (*ArchProvisioner) Provision

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

func (*ArchProvisioner) String

func (provisioner *ArchProvisioner) String() string

type Boot2DockerProvisioner

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

func (*Boot2DockerProvisioner) AttemptIPContact

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

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

func (*Boot2DockerProvisioner) GetDockerOptionsDir

func (provisioner *Boot2DockerProvisioner) GetDockerOptionsDir() string

func (*Boot2DockerProvisioner) GetDriver

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

func (*Boot2DockerProvisioner) GetOsReleaseInfo

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

func (*Boot2DockerProvisioner) GetSwarmOptions

func (provisioner *Boot2DockerProvisioner) GetSwarmOptions() swarm.Options

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.Options, authOptions auth.Options, engineOptions engine.Options) 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)

func (*Boot2DockerProvisioner) String

func (provisioner *Boot2DockerProvisioner) String() string

type CentosProvisioner

type CentosProvisioner struct {
	*RedHatProvisioner
}

func (*CentosProvisioner) String

func (provisioner *CentosProvisioner) String() string

type CoreOSProvisioner

type CoreOSProvisioner struct {
	SystemdProvisioner
}

func (*CoreOSProvisioner) CompatibleWithHost

func (provisioner *CoreOSProvisioner) CompatibleWithHost() bool

func (*CoreOSProvisioner) GenerateDockerOptions

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

func (*CoreOSProvisioner) Package

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

func (*CoreOSProvisioner) Provision

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

func (*CoreOSProvisioner) SetHostname

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

func (*CoreOSProvisioner) String

func (provisioner *CoreOSProvisioner) String() string

type DebianProvisioner

type DebianProvisioner struct {
	SystemdProvisioner
}

func (*DebianProvisioner) Package

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

func (*DebianProvisioner) Provision

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

func (*DebianProvisioner) String

func (provisioner *DebianProvisioner) String() string

type Detector

type Detector interface {
	DetectProvisioner(d drivers.Driver) (Provisioner, error)
}

type DockerOptions

type DockerOptions struct {
	EngineOptions     string
	EngineOptionsPath string
}

type EngineConfigContext

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

type ErrDaemonAvailable

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

func NewErrDaemonAvailable

func NewErrDaemonAvailable(err error) ErrDaemonAvailable

func (ErrDaemonAvailable) Error

func (e ErrDaemonAvailable) Error() string

type FakeDetector

type FakeDetector struct {
	Provisioner
}

func (*FakeDetector) DetectProvisioner

func (fd *FakeDetector) DetectProvisioner(d drivers.Driver) (Provisioner, error)

type FakeProvisioner

type FakeProvisioner struct{}

func (*FakeProvisioner) CompatibleWithHost

func (fp *FakeProvisioner) CompatibleWithHost() bool

func (*FakeProvisioner) GenerateDockerOptions

func (fp *FakeProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*FakeProvisioner) GetAuthOptions

func (fp *FakeProvisioner) GetAuthOptions() auth.Options

func (*FakeProvisioner) GetDockerOptionsDir

func (fp *FakeProvisioner) GetDockerOptionsDir() string

func (*FakeProvisioner) GetDriver

func (fp *FakeProvisioner) GetDriver() drivers.Driver

func (*FakeProvisioner) GetOsReleaseInfo

func (fp *FakeProvisioner) GetOsReleaseInfo() (*OsRelease, error)

func (*FakeProvisioner) GetSwarmOptions

func (fp *FakeProvisioner) GetSwarmOptions() swarm.Options

func (*FakeProvisioner) Hostname

func (fp *FakeProvisioner) Hostname() (string, error)

func (*FakeProvisioner) Package

func (fp *FakeProvisioner) Package(name string, action pkgaction.PackageAction) error

func (*FakeProvisioner) Provision

func (fp *FakeProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error

func (*FakeProvisioner) SSHCommand

func (fp *FakeProvisioner) SSHCommand(args string) (string, error)

func (*FakeProvisioner) Service

func (fp *FakeProvisioner) Service(name string, action serviceaction.ServiceAction) error

func (*FakeProvisioner) SetHostname

func (fp *FakeProvisioner) SetHostname(hostname string) error

func (*FakeProvisioner) SetOsReleaseInfo

func (fp *FakeProvisioner) SetOsReleaseInfo(info *OsRelease)

func (*FakeProvisioner) String

func (fp *FakeProvisioner) String() string

type FedoraProvisioner

type FedoraProvisioner struct {
	*RedHatProvisioner
}

func (*FedoraProvisioner) String

func (provisioner *FedoraProvisioner) String() string

type GenericProvisioner

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

func (*GenericProvisioner) CompatibleWithHost

func (provisioner *GenericProvisioner) CompatibleWithHost() bool

func (*GenericProvisioner) GenerateDockerOptions

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

func (*GenericProvisioner) GetAuthOptions

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

func (*GenericProvisioner) GetDockerOptionsDir

func (provisioner *GenericProvisioner) GetDockerOptionsDir() string

func (*GenericProvisioner) GetDriver

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

func (*GenericProvisioner) GetOsReleaseInfo

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

func (*GenericProvisioner) GetSwarmOptions

func (provisioner *GenericProvisioner) GetSwarmOptions() swarm.Options

func (*GenericProvisioner) Hostname

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

func (*GenericProvisioner) SetHostname

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

func (*GenericProvisioner) SetOsReleaseInfo

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

type GenericSSHCommander

type GenericSSHCommander struct {
	Driver drivers.Driver
}

func (GenericSSHCommander) SSHCommand

func (sshCmder GenericSSHCommander) SSHCommand(args string) (string, error)

type GoogleCOSProvisioner

type GoogleCOSProvisioner struct {
	SystemdProvisioner
}

func (*GoogleCOSProvisioner) GenerateDockerOptions

func (p *GoogleCOSProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*GoogleCOSProvisioner) Package

func (*GoogleCOSProvisioner) Provision

func (p *GoogleCOSProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error

func (*GoogleCOSProvisioner) String

func (p *GoogleCOSProvisioner) String() string

type NetstatProvisioner

type NetstatProvisioner struct {
	*FakeProvisioner
}

func (*NetstatProvisioner) SSHCommand

func (p *NetstatProvisioner) SSHCommand(args string) (string, error)

type OracleLinuxProvisioner

type OracleLinuxProvisioner struct {
	*RedHatProvisioner
}

func (*OracleLinuxProvisioner) String

func (provisioner *OracleLinuxProvisioner) String() string

type OsRelease

type OsRelease struct {
	AnsiColor    string `osr:"ANSI_COLOR"`
	Name         string `osr:"NAME"`
	Version      string `osr:"VERSION"`
	Variant      string `osr:"VARIANT"`
	VariantID    string `osr:"VARIANT_ID"`
	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"`
}

OsRelease reflects values in /etc/os-release 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

type PackageListInfo struct {
	OsRelease        string
	OsReleaseVersion string
}

type Provisioner

type Provisioner interface {
	fmt.Stringer
	SSHCommander

	// 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.Options

	// Get the swarm options associated with this host.
	GetSwarmOptions() swarm.Options

	// 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.Options, authOptions auth.Options, engineOptions engine.Options) 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

	// 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)
}

Provisioner defines distribution specific actions

func DetectProvisioner

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

func NewArchProvisioner

func NewArchProvisioner(d drivers.Driver) Provisioner

func NewBoot2DockerProvisioner

func NewBoot2DockerProvisioner(d drivers.Driver) Provisioner

func NewCentosProvisioner

func NewCentosProvisioner(d drivers.Driver) Provisioner

func NewCoreOSProvisioner

func NewCoreOSProvisioner(d drivers.Driver) Provisioner

func NewDebianProvisioner

func NewDebianProvisioner(d drivers.Driver) Provisioner

func NewFakeProvisioner

func NewFakeProvisioner(d drivers.Driver) Provisioner

func NewFedoraProvisioner

func NewFedoraProvisioner(d drivers.Driver) Provisioner

func NewGoogleCOSProvisioner

func NewGoogleCOSProvisioner(d drivers.Driver) Provisioner

func NewNetstatProvisioner

func NewNetstatProvisioner() Provisioner

func NewOracleLinuxProvisioner

func NewOracleLinuxProvisioner(d drivers.Driver) Provisioner

func NewRancherProvisioner

func NewRancherProvisioner(d drivers.Driver) Provisioner

func NewSUSEProvisioner

func NewSUSEProvisioner(d drivers.Driver) Provisioner

func NewUbuntuProvisioner

func NewUbuntuProvisioner(d drivers.Driver) Provisioner

func NewUbuntuSystemdProvisioner

func NewUbuntuSystemdProvisioner(d drivers.Driver) Provisioner

type RancherProvisioner

type RancherProvisioner struct {
	GenericProvisioner
}

func (*RancherProvisioner) Package

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

func (*RancherProvisioner) Provision

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

func (*RancherProvisioner) Service

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

func (*RancherProvisioner) SetHostname

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

func (*RancherProvisioner) String

func (provisioner *RancherProvisioner) String() string

type RedHatProvisioner

type RedHatProvisioner struct {
	SystemdProvisioner
}

func NewRedHatProvisioner

func NewRedHatProvisioner(osReleaseID string, d drivers.Driver) *RedHatProvisioner

func (*RedHatProvisioner) GenerateDockerOptions

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

func (*RedHatProvisioner) Package

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

func (*RedHatProvisioner) Provision

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

func (*RedHatProvisioner) SetHostname

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

func (*RedHatProvisioner) String

func (provisioner *RedHatProvisioner) String() string

type RedHatSSHCommander

type RedHatSSHCommander struct {
	Driver drivers.Driver
}

func (RedHatSSHCommander) SSHCommand

func (sshCmder RedHatSSHCommander) SSHCommand(args string) (string, error)

type RegisteredProvisioner

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

RegisteredProvisioner creates a new provisioner

type SSHCommander

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

type SUSEProvisioner

type SUSEProvisioner struct {
	SystemdProvisioner
}

func (*SUSEProvisioner) CompatibleWithHost

func (provisioner *SUSEProvisioner) CompatibleWithHost() bool

func (*SUSEProvisioner) Package

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

func (*SUSEProvisioner) Provision

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

func (*SUSEProvisioner) String

func (provisioner *SUSEProvisioner) String() string

type StandardDetector

type StandardDetector struct{}

func (StandardDetector) DetectProvisioner

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

type SystemdProvisioner

type SystemdProvisioner struct {
	GenericProvisioner
}

func NewSystemdProvisioner

func NewSystemdProvisioner(osReleaseID string, d drivers.Driver) SystemdProvisioner

func (*SystemdProvisioner) GenerateDockerOptions

func (p *SystemdProvisioner) GenerateDockerOptions(dockerPort int) (*DockerOptions, error)

func (*SystemdProvisioner) Service

func (p *SystemdProvisioner) Service(name string, action serviceaction.ServiceAction) error

func (*SystemdProvisioner) String

func (p *SystemdProvisioner) String() string

type UbuntuProvisioner

type UbuntuProvisioner struct {
	GenericProvisioner
}

func (*UbuntuProvisioner) CompatibleWithHost

func (provisioner *UbuntuProvisioner) CompatibleWithHost() bool

func (*UbuntuProvisioner) Package

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

func (*UbuntuProvisioner) Provision

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

func (*UbuntuProvisioner) Service

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

func (*UbuntuProvisioner) String

func (provisioner *UbuntuProvisioner) String() string

type UbuntuSystemdProvisioner

type UbuntuSystemdProvisioner struct {
	SystemdProvisioner
}

func (*UbuntuSystemdProvisioner) CompatibleWithHost

func (provisioner *UbuntuSystemdProvisioner) CompatibleWithHost() bool

func (*UbuntuSystemdProvisioner) Package

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

func (*UbuntuSystemdProvisioner) Provision

func (provisioner *UbuntuSystemdProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error

func (*UbuntuSystemdProvisioner) String

func (provisioner *UbuntuSystemdProvisioner) String() string

Directories

Path Synopsis
Package provisiontest provides utilities for testing provisioners
Package provisiontest provides utilities for testing provisioners

Jump to

Keyboard shortcuts

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