ocisurrogate

package
v0.0.0-...-3dce1a9 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package oci contains a packer.Builder implementation that builds Oracle Bare Metal Cloud Services (OCI) images.

Index

Constants

View Source
const BuilderId = "dppeykov.ocisurrogate"

BuilderId uniquely identifies the builder

Variables

This section is empty.

Functions

func NewRawConfigurationProvider

func NewRawConfigurationProvider(tenancy, user, region, fingerprint, privateKey string, privateKeyPassphrase *string) common.ConfigurationProvider

NewRawConfigurationProvider will create a rawConfigurationProvider.

Types

type Artifact

type Artifact struct {
	Image  core.Image
	Region string
	// contains filtered or unexported fields
}

Artifact is an artifact implementation that contains a built Custom Image.

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

BuilderId uniquely identifies the builder.

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

Destroy deletes the custom image associated with the artifact.

func (*Artifact) Files

func (a *Artifact) Files() []string

Files lists the files associated with an artifact. We don't have any files as the custom image is stored server side.

func (*Artifact) Id

func (a *Artifact) Id() string

Id returns the OCID of the associated Image.

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

State ...

func (*Artifact) String

func (a *Artifact) String() string

type Builder

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

Builder is a builder implementation that creates Oracle OCI custom images.

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Cancel

func (b *Builder) Cancel()

Cancel terminates a running build.

func (*Builder) Prepare

func (b *Builder) Prepare(rawConfig ...interface{}) ([]string, error)

func (*Builder) Run

func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error)

type Config

type Config struct {
	common.PackerConfig `mapstructure:",squash"`
	Comm                communicator.Config `mapstructure:",squash"`

	ConfigProvider ocicommon.ConfigurationProvider

	AccessCfgFile        string `mapstructure:"access_cfg_file"`
	AccessCfgFileAccount string `mapstructure:"access_cfg_file_account"`

	// Access config overrides
	UserID       string `mapstructure:"user_ocid"`
	TenancyID    string `mapstructure:"tenancy_ocid"`
	Region       string `mapstructure:"region"`
	Fingerprint  string `mapstructure:"fingerprint"`
	KeyFile      string `mapstructure:"key_file"`
	PassPhrase   string `mapstructure:"pass_phrase"`
	UsePrivateIP bool   `mapstructure:"use_private_ip"`

	AvailabilityDomain string `mapstructure:"availability_domain"`
	CompartmentID      string `mapstructure:"compartment_ocid"`

	// Image
	BaseImageID         string `mapstructure:"base_image_ocid"`
	BaseImageName       string `mapstructure:"base_image_name"`
	Shape               string `mapstructure:"shape"`
	ImageName           string `mapstructure:"image_name"`
	BootVolumeSizeInGBs int    `mapstructure:"bootvolumesize"`
	// Instance
	InstanceName string `mapstructure:"instance_name"`

	// Metadata optionally contains custom metadata key/value pairs provided in the
	// configuration. While this can be used to set metadata["user_data"] the explicit
	// "user_data" and "user_data_file" values will have precedence.
	// An instance's metadata can be obtained from at http://169.254.169.254 on the
	// launched instance.
	Metadata map[string]string `mapstructure:"metadata"`

	// UserData and UserDataFile file are both optional and mutually exclusive.
	UserData     string `mapstructure:"user_data"`
	UserDataFile string `mapstructure:"user_data_file"`

	// Networking
	SubnetID string `mapstructure:"subnet_ocid"`

	// Tagging
	Tags map[string]string `mapstructure:"tags"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(raws ...interface{}) (*Config, error)

type Driver

type Driver interface {
	CreateInstance(ctx context.Context, publicKey string, surrogateVolumeId string) (string, error)
	CreateBootClone(ctx context.Context, InstanceId string) (string, error)
	AttachBootClone(ctx context.Context, InstanceId string, VolumeId string) (string, error)
	DetachBootClone(ctx context.Context, VolumeId string) (string, error)
	CreateImage(ctx context.Context, id string) (core.Image, error)
	DeleteImage(ctx context.Context, id string) error
	GetInstanceIP(ctx context.Context, id string) (string, error)
	TerminateInstance(ctx context.Context, id string) error
	DeleteBootVolume(ctx context.Context, id string) error
	WaitForImageCreation(ctx context.Context, id string) error
	WaitForInstanceState(ctx context.Context, id string, waitStates []string, terminalState string) error
	WaitForBootVolumeState(ctx context.Context, id string, waitStates []string, terminalState string) error
	WaitForVolumeAttachmentState(ctx context.Context, id string, waitStates []string, terminalState string) error
}

Driver interfaces between the builder steps and the OCI SDK.

func NewDriverOCI

func NewDriverOCI(cfg *Config) (Driver, error)

NewDriverOCI Creates a new driverOCI with a connected compute client and a connected vcn client.

Jump to

Keyboard shortcuts

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