provision

package
v0.0.0-...-a50f796 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 Register

func Register(name string, p *RegisteredProvisioner)

func SetDetector

func SetDetector(newDetector Detector)

func WaitForPodman

func WaitForPodman(p Provisioner) error

Types

type Boot2PodmanProvisioner

type Boot2PodmanProvisioner struct {
	OsReleaseInfo *OsRelease
	Driver        drivers.Driver
	AuthOptions   auth.Options
	EngineOptions engine.Options
}

func (*Boot2PodmanProvisioner) CompatibleWithHost

func (provisioner *Boot2PodmanProvisioner) CompatibleWithHost() bool

func (*Boot2PodmanProvisioner) GenerateEngineOptions

func (provisioner *Boot2PodmanProvisioner) GenerateEngineOptions() (*EngineOptions, error)

func (*Boot2PodmanProvisioner) GetAuthOptions

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

func (*Boot2PodmanProvisioner) GetDriver

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

func (*Boot2PodmanProvisioner) GetEngineOptionsDir

func (provisioner *Boot2PodmanProvisioner) GetEngineOptionsDir() string

func (*Boot2PodmanProvisioner) GetOsReleaseInfo

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

func (*Boot2PodmanProvisioner) Hostname

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

func (*Boot2PodmanProvisioner) Package

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

func (*Boot2PodmanProvisioner) Provision

func (provisioner *Boot2PodmanProvisioner) Provision(authOptions auth.Options, engineOptions engine.Options) error

func (*Boot2PodmanProvisioner) SSHCommand

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

func (*Boot2PodmanProvisioner) Service

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

func (*Boot2PodmanProvisioner) SetHostname

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

func (*Boot2PodmanProvisioner) SetOsReleaseInfo

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

func (*Boot2PodmanProvisioner) String

func (provisioner *Boot2PodmanProvisioner) String() string

type CentosProvisioner

type CentosProvisioner struct {
	*RedHatProvisioner
}

func (*CentosProvisioner) String

func (provisioner *CentosProvisioner) String() string

type Detector

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

type EngineConfigContext

type EngineConfigContext struct {
	AuthOptions      auth.Options
	EngineOptions    engine.Options
	EngineOptionsDir string
}

type EngineOptions

type EngineOptions struct {
	EngineOptionsString string
	EngineOptionsPath   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) GenerateEngineOptions

func (fp *FakeProvisioner) GenerateEngineOptions() (*EngineOptions, error)

func (*FakeProvisioner) GetAuthOptions

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

func (*FakeProvisioner) GetDriver

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

func (*FakeProvisioner) GetEngineOptionsDir

func (fp *FakeProvisioner) GetEngineOptionsDir() string

func (*FakeProvisioner) GetOsReleaseInfo

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

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(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
	EngineOptionsDir  string
	DaemonOptionsFile string
	Packages          []string
	OsReleaseInfo     *OsRelease
	Driver            drivers.Driver
	AuthOptions       auth.Options
	EngineOptions     engine.Options
}

func (*GenericProvisioner) CompatibleWithHost

func (provisioner *GenericProvisioner) CompatibleWithHost() bool

func (*GenericProvisioner) GenerateEngineOptions

func (provisioner *GenericProvisioner) GenerateEngineOptions() (*EngineOptions, error)

func (*GenericProvisioner) GetAuthOptions

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

func (*GenericProvisioner) GetDriver

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

func (*GenericProvisioner) GetEngineOptionsDir

func (provisioner *GenericProvisioner) GetEngineOptionsDir() string

func (*GenericProvisioner) GetOsReleaseInfo

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

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 NetstatProvisioner

type NetstatProvisioner struct {
	*FakeProvisioner
}

func (*NetstatProvisioner) SSHCommand

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

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)
	GenerateEngineOptions() (*EngineOptions, error)

	// Get the directory where the settings files for engine are to be found
	GetEngineOptionsDir() string

	// Return the auth options used to configure remote connection for the daemon.
	GetAuthOptions() auth.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 engine 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.
	Provision(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 NewBoot2PodmanProvisioner

func NewBoot2PodmanProvisioner(d drivers.Driver) Provisioner

func NewCentosProvisioner

func NewCentosProvisioner(d drivers.Driver) Provisioner

func NewFakeProvisioner

func NewFakeProvisioner(d drivers.Driver) Provisioner

func NewFedoraProvisioner

func NewFedoraProvisioner(d drivers.Driver) Provisioner

func NewNetstatProvisioner

func NewNetstatProvisioner() Provisioner

type RedHatProvisioner

type RedHatProvisioner struct {
	SystemdProvisioner
}

func NewRedHatProvisioner

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

func (*RedHatProvisioner) GenerateEngineOptions

func (provisioner *RedHatProvisioner) GenerateEngineOptions() (*EngineOptions, error)

func (*RedHatProvisioner) Package

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

func (*RedHatProvisioner) Provision

func (provisioner *RedHatProvisioner) Provision(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 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) GenerateEngineOptions

func (p *SystemdProvisioner) GenerateEngineOptions() (*EngineOptions, error)

func (*SystemdProvisioner) Service

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

func (*SystemdProvisioner) String

func (p *SystemdProvisioner) 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