Documentation
¶
Index ¶
- Constants
- type AccessConfig
- type Artifact
- type Builder
- type Client
- type Config
- type Driver
- type DriverMock
- func (d *DriverMock) CreateImageFromMachine(machineId string, config Config) (string, error)
- func (d *DriverMock) CreateMachine(config Config) (string, error)
- func (d *DriverMock) DeleteImage(imageId string) error
- func (d *DriverMock) DeleteMachine(machineId string) error
- func (d *DriverMock) GetImage(config Config) (string, error)
- func (d *DriverMock) GetMachineIP(machineId string) (string, error)
- func (d *DriverMock) StopMachine(machineId string) error
- func (d *DriverMock) WaitForImageCreation(machineId string, timeout time.Duration) error
- func (d *DriverMock) WaitForMachineDeletion(machineId string, timeout time.Duration) error
- func (d *DriverMock) WaitForMachineState(machineId string, state string, timeout time.Duration) error
- type MachineImageFilter
- type SourceMachineConfig
- type StepCreateImageFromMachine
- type StepCreateSourceMachine
- type StepDeleteMachine
- type StepStopMachine
- type StepWaitForStopNotToFail
- type TargetImageConfig
Constants ¶
const (
BuilderId = "joyent.triton"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessConfig ¶
type AccessConfig struct {
// The URL of the Triton cloud API to use. If omitted
// it will default to the us-sw-1 region of the Joyent Public cloud. If you
// are using your own private Triton installation you will have to supply the
// URL of the cloud API of your own Triton installation.
Endpoint string `mapstructure:"triton_url" required:"false"`
// The username of the Triton account to use when
// using the Triton Cloud API.
Account string `mapstructure:"triton_account" required:"true"`
// The username of a user who has access to your
// Triton account.
Username string `mapstructure:"triton_user" required:"false"`
// The fingerprint of the public key of the SSH key
// pair to use for authentication with the Triton Cloud API. If
// triton_key_material is not set, it is assumed that the SSH agent has the
// private key corresponding to this key ID loaded.
KeyID string `mapstructure:"triton_key_id" required:"true"`
// Path to the file in which the private key
// of triton_key_id is stored. For example /home/soandso/.ssh/id_rsa. If
// this is not specified, the SSH agent is used to sign requests with the
// triton_key_id specified.
KeyMaterial string `mapstructure:"triton_key_material" required:"false"`
//secure_skip_tls_verify - (bool) This allows skipping TLS verification
// of the Triton endpoint. It is useful when connecting to a temporary Triton
// installation such as Cloud-On-A-Laptop which does not generally use a
// certificate signed by a trusted root CA. The default is false.
InsecureSkipTLSVerify bool `mapstructure:"insecure_skip_tls_verify" required:"false"`
// contains filtered or unexported fields
}
AccessConfig is for common configuration related to Triton access
func (*AccessConfig) Comm ¶
func (c *AccessConfig) Comm() communicator.Config
func (*AccessConfig) CreateTritonClient ¶
func (c *AccessConfig) CreateTritonClient() (*Client, error)
func (*AccessConfig) Prepare ¶
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error
Prepare performs basic validation on the AccessConfig and ensures we can sign a request.
type Artifact ¶
type Artifact struct {
// ImageID is the image ID of the artifact
ImageID string
// BuilderIDValue is the unique ID for the builder that created this Image
BuilderIDValue string
// SDC connection for cleanup etc
Driver Driver
}
Artifact is an artifact implementation that contains built Triton images.
type Config ¶
type Config struct {
common.PackerConfig `mapstructure:",squash"`
AccessConfig `mapstructure:",squash"`
SourceMachineConfig `mapstructure:",squash"`
TargetImageConfig `mapstructure:",squash"`
Comm communicator.Config `mapstructure:",squash"`
// contains filtered or unexported fields
}
type Driver ¶
type Driver interface {
GetImage(config Config) (string, error)
CreateImageFromMachine(machineId string, config Config) (string, error)
CreateMachine(config Config) (string, error)
DeleteImage(imageId string) error
DeleteMachine(machineId string) error
GetMachineIP(machineId string) (string, error)
StopMachine(machineId string) error
WaitForImageCreation(imageId string, timeout time.Duration) error
WaitForMachineDeletion(machineId string, timeout time.Duration) error
WaitForMachineState(machineId string, state string, timeout time.Duration) error
}
type DriverMock ¶
type DriverMock struct {
CreateImageFromMachineId string
CreateImageFromMachineErr error
CreateMachineId string
CreateMachineErr error
DeleteImageId string
DeleteImageErr error
DeleteMachineId string
DeleteMachineErr error
GetImageId string
GetImageErr error
GetMachineErr error
StopMachineId string
StopMachineErr error
WaitForImageCreationErr error
WaitForMachineDeletionErr error
WaitForMachineStateErr error
}
func (*DriverMock) CreateImageFromMachine ¶
func (d *DriverMock) CreateImageFromMachine(machineId string, config Config) (string, error)
func (*DriverMock) CreateMachine ¶
func (d *DriverMock) CreateMachine(config Config) (string, error)
func (*DriverMock) DeleteImage ¶
func (d *DriverMock) DeleteImage(imageId string) error
func (*DriverMock) DeleteMachine ¶
func (d *DriverMock) DeleteMachine(machineId string) error
func (*DriverMock) GetImage ¶ added in v1.1.2
func (d *DriverMock) GetImage(config Config) (string, error)
func (*DriverMock) GetMachineIP ¶ added in v1.0.1
func (d *DriverMock) GetMachineIP(machineId string) (string, error)
func (*DriverMock) StopMachine ¶
func (d *DriverMock) StopMachine(machineId string) error
func (*DriverMock) WaitForImageCreation ¶
func (d *DriverMock) WaitForImageCreation(machineId string, timeout time.Duration) error
func (*DriverMock) WaitForMachineDeletion ¶
func (d *DriverMock) WaitForMachineDeletion(machineId string, timeout time.Duration) error
func (*DriverMock) WaitForMachineState ¶
type MachineImageFilter ¶ added in v1.1.2
type MachineImageFilter struct {
MostRecent bool `mapstructure:"most_recent"`
Name string
OS string
Version string
Public bool
State string
Owner string
Type string
}
func (*MachineImageFilter) Empty ¶ added in v1.1.2
func (m *MachineImageFilter) Empty() bool
type SourceMachineConfig ¶
type SourceMachineConfig struct {
// Name of the VM used for building the
// image. Does not affect (and does not have to be the same) as the name for a
// VM instance running this image. Maximum 512 characters but should in
// practice be much shorter (think between 5 and 20 characters). For example
// mysql-64-server-image-builder. When omitted defaults to
// packer-builder-[image_name].
MachineName string `mapstructure:"source_machine_name" required:"false"`
// The Triton package to use while
// building the image. Does not affect (and does not have to be the same) as
// the package which will be used for a VM instance running this image. On the
// Joyent public cloud this could for example be g3-standard-0.5-smartos.
MachinePackage string `mapstructure:"source_machine_package" required:"true"`
// The UUID of the image to base the new
// image on. Triton supports multiple types of images, called 'brands' in
// Triton / Joyent lingo, for contains and VM's. See the chapter Containers
// and virtual machines in
// the Joyent Triton documentation for detailed information. The following
// brands are currently supported by this builder:joyent andkvm. The
// choice of base image automatically decides the brand. On the Joyent public
// cloud a valid source_machine_image could for example be
// 70e3ae72-96b6-11e6-9056-9737fd4d0764 for version 16.3.1 of the 64bit
// SmartOS base image (a 'joyent' brand image). source_machine_image_filter
// can be used to populate this UUID.
MachineImage string `mapstructure:"source_machine_image" required:"true"`
// The UUID's of Triton
// networks added to the source machine used for creating the image. For
// example if any of the provisioners which are run need Internet access you
// will need to add the UUID's of the appropriate networks here. If this is
// not specified, instances will be placed into the default Triton public and
// internal networks.
MachineNetworks []string `mapstructure:"source_machine_networks" required:"false"`
// Triton metadata
// applied to the VM used to create the image. Metadata can be used to pass
// configuration information to the VM without the need for networking. See
// Using the metadata
// API in the
// Joyent documentation for more information. This can for example be used to
// set the user-script metadata key to have Triton start a user supplied
// script after the VM has booted.
MachineMetadata map[string]string `mapstructure:"source_machine_metadata" required:"false"`
// Tags applied to the
// VM used to create the image.
MachineTags map[string]string `mapstructure:"source_machine_tags" required:"false"`
// Whether or not the firewall
// of the VM used to create an image of is enabled. The Triton firewall only
// filters inbound traffic to the VM. All outbound traffic is always allowed.
// Currently this builder does not provide an interface to add specific
// firewall rules. Unless you have a global rule defined in Triton which
// allows SSH traffic enabling the firewall will interfere with the SSH
// provisioner. The default is false.
MachineFirewallEnabled bool `mapstructure:"source_machine_firewall_enabled" required:"false"`
// Filters used to populate the
// source_machine_image field. Example:
MachineImageFilters MachineImageFilter `mapstructure:"source_machine_image_filter" required:"false"`
}
SourceMachineConfig represents the configuration to run a machine using the SDC API in order for provisioning to take place.
func (*SourceMachineConfig) Prepare ¶
func (c *SourceMachineConfig) Prepare(ctx *interpolate.Context) []error
Prepare performs basic validation on a SourceMachineConfig struct.
type StepCreateImageFromMachine ¶
type StepCreateImageFromMachine struct{}
StepCreateImageFromMachine creates an image with the specified attributes from the machine with the given ID, and waits for the image to be created. The machine must be in the "stopped" state prior to this step being run.
func (*StepCreateImageFromMachine) Cleanup ¶
func (s *StepCreateImageFromMachine) Cleanup(state multistep.StateBag)
func (*StepCreateImageFromMachine) Run ¶
func (s *StepCreateImageFromMachine) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepCreateSourceMachine ¶
type StepCreateSourceMachine struct{}
StepCreateSourceMachine creates an machine with the specified attributes and waits for it to become available for provisioners.
func (*StepCreateSourceMachine) Cleanup ¶
func (s *StepCreateSourceMachine) Cleanup(state multistep.StateBag)
func (*StepCreateSourceMachine) Run ¶
func (s *StepCreateSourceMachine) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepDeleteMachine ¶
type StepDeleteMachine struct{}
StepDeleteMachine deletes the machine with the ID specified in state["machine"]
func (*StepDeleteMachine) Cleanup ¶
func (s *StepDeleteMachine) Cleanup(state multistep.StateBag)
func (*StepDeleteMachine) Run ¶
func (s *StepDeleteMachine) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepStopMachine ¶
type StepStopMachine struct{}
StepStopMachine stops the machine with the given Machine ID, and waits for it to reach the stopped state.
func (*StepStopMachine) Cleanup ¶
func (s *StepStopMachine) Cleanup(state multistep.StateBag)
func (*StepStopMachine) Run ¶
func (s *StepStopMachine) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepWaitForStopNotToFail ¶
type StepWaitForStopNotToFail struct{}
StepWaitForStopNotToFail waits for 10 seconds before returning with continue in order to prevent an observed issue where machines stopped immediately after they are started never actually stop.
func (*StepWaitForStopNotToFail) Cleanup ¶
func (s *StepWaitForStopNotToFail) Cleanup(state multistep.StateBag)
func (*StepWaitForStopNotToFail) Run ¶
func (s *StepWaitForStopNotToFail) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type TargetImageConfig ¶
type TargetImageConfig struct {
// The name the finished image in Triton will be
// assigned. Maximum 512 characters but should in practice be much shorter
// (think between 5 and 20 characters). For example postgresql-95-server for
// an image used as a PostgreSQL 9.5 server.
ImageName string `mapstructure:"image_name" required:"true"`
// The version string for this image. Maximum 128
// characters. Any string will do but a format of Major.Minor.Patch is
// strongly advised by Joyent. See Semantic Versioning
// for more information on the Major.Minor.Patch versioning format.
ImageVersion string `mapstructure:"image_version" required:"true"`
// Description of the image. Maximum 512
// characters.
ImageDescription string `mapstructure:"image_description" required:"false"`
// URL of the homepage where users can find
// information about the image. Maximum 128 characters.
ImageHomepage string `mapstructure:"image_homepage" required:"false"`
// URL of the End User License Agreement (EULA)
// for the image. Maximum 128 characters.
ImageEULA string `mapstructure:"image_eula_url" required:"false"`
// The UUID's of the users which will have
// access to this image. When omitted only the owner (the Triton user whose
// credentials are used) will have access to the image.
ImageACL []string `mapstructure:"image_acls" required:"false"`
// Tag applied to the image.
ImageTags map[string]string `mapstructure:"image_tags" required:"false"`
}
TargetImageConfig represents the configuration for the image to be created from the source machine.
func (*TargetImageConfig) Prepare ¶
func (c *TargetImageConfig) Prepare(ctx *interpolate.Context) []error
Prepare performs basic validation on a TargetImageConfig struct.