docker

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MPL-2.0 Imports: 58 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_waypoint_builtin_docker_plugin_proto protoreflect.FileDescriptor

Options are the SDK options to use for instantiation.

Functions

func CredentialsFromConfig added in v0.6.0

func CredentialsFromConfig(encodedAuth string) (string, string, error)

CredentialsFromConfig returns the username and password present in the encoded auth string. This encoded auth string is one that users can pass as authentication information to registry.

func HasImg added in v0.3.0

func HasImg() bool

HasImg returns true if "img" is available on the PATH.

This doesn't do any fancy checking that "img" is the "img" we expect. We can make the checking here more advanced later.

func TempDockerConfig added in v0.3.0

func TempDockerConfig(
	log hclog.Logger,
	target *Image,
	encodedAuth string,
) (string, error)

TempDockerConfig creates a new Docker configuration with the configured auth in it. It saves this Docker config to a temporary path and returns the path to that Docker file.

We have to do this because `img` doesn't support setting auth for a single operation. Therefore, we must set auth in the Docker config, but we don't want to pollute any concurrent runs or the main file. So we create a copy.

This can return ("", nil) if there is no custom Docker config necessary.

Callers should defer file deletion for this temporary file.

func TempDockerConfigWithPassword added in v0.6.0

func TempDockerConfigWithPassword(
	log hclog.Logger,
	target *Image,
	username string,
	password string,
) (string, error)

TempDockerConfigWithPassword creates a new Docker configuration with the configured auth in it. It saves this Docker config to a temporary path and returns the path to that Docker file.

We have to do this because `img` doesn't support setting auth for a single operation. Therefore, we must set auth in the Docker config, but we don't want to pollute any concurrent runs or the main file. So we create a copy.

This can return ("", nil) if there is no custom Docker config necessary.

Callers should defer file deletion for this temporary file.

Types

type AccessInfo added in v0.6.0

type AccessInfo struct {

	// image is the OCI compatible descriptor for the location of the image. Typically it
	// is in the form `repo/name`, where repo is a host name (perhaps with a port), and
	// name may also contain / use to identify subdivision on the host.
	Image string `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	// tag is the OCI compatible tag that the resulting data will be stored at within
	// the repository defined by image.
	Tag string `protobuf:"bytes,2,opt,name=tag,proto3" json:"tag,omitempty"`
	// auth indicates how to authenticate with the repository defined by image.
	//
	// Types that are assignable to Auth:
	//	*AccessInfo_Header
	//	*AccessInfo_Encoded
	//	*AccessInfo_UserPass_
	Auth isAccessInfo_Auth `protobuf_oneof:"auth"`
	// insecure indicates if the repository defined by image should be access via http or https.
	Insecure bool `protobuf:"varint,5,opt,name=insecure,proto3" json:"insecure,omitempty"`
	// contains filtered or unexported fields
}

func (*AccessInfo) Descriptor deprecated added in v0.6.0

func (*AccessInfo) Descriptor() ([]byte, []int)

Deprecated: Use AccessInfo.ProtoReflect.Descriptor instead.

func (*AccessInfo) GetAuth added in v0.6.0

func (m *AccessInfo) GetAuth() isAccessInfo_Auth

func (*AccessInfo) GetEncoded added in v0.6.0

func (x *AccessInfo) GetEncoded() string

func (*AccessInfo) GetHeader added in v0.6.0

func (x *AccessInfo) GetHeader() string

func (*AccessInfo) GetImage added in v0.6.0

func (x *AccessInfo) GetImage() string

func (*AccessInfo) GetInsecure added in v0.6.0

func (x *AccessInfo) GetInsecure() bool

func (*AccessInfo) GetTag added in v0.6.0

func (x *AccessInfo) GetTag() string

func (*AccessInfo) GetUserPass added in v0.6.0

func (x *AccessInfo) GetUserPass() *AccessInfo_UserPass

func (*AccessInfo) ProtoMessage added in v0.6.0

func (*AccessInfo) ProtoMessage()

func (*AccessInfo) ProtoReflect added in v0.6.0

func (x *AccessInfo) ProtoReflect() protoreflect.Message

func (*AccessInfo) Reset added in v0.6.0

func (x *AccessInfo) Reset()

func (*AccessInfo) String added in v0.6.0

func (x *AccessInfo) String() string

type AccessInfo_Encoded added in v0.6.0

type AccessInfo_Encoded struct {
	// encoded is the docker standard encoded authentication data. This is base64 encoded
	// json that contains username and passwword fields that are used for authentication.
	Encoded string `protobuf:"bytes,4,opt,name=encoded,proto3,oneof"`
}

type AccessInfo_Header added in v0.6.0

type AccessInfo_Header struct {
	// header is the value of the Authentication header that is sent to the repository.
	// This allows for repositories that use bearer tokens or other sorts of authentication.
	Header string `protobuf:"bytes,3,opt,name=header,proto3,oneof"`
}

type AccessInfo_UserPass added in v0.6.0

type AccessInfo_UserPass struct {

	// The username to authenticate against the registry with
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	// The password assocated with the above username
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*AccessInfo_UserPass) Descriptor deprecated added in v0.6.0

func (*AccessInfo_UserPass) Descriptor() ([]byte, []int)

Deprecated: Use AccessInfo_UserPass.ProtoReflect.Descriptor instead.

func (*AccessInfo_UserPass) GetPassword added in v0.6.0

func (x *AccessInfo_UserPass) GetPassword() string

func (*AccessInfo_UserPass) GetUsername added in v0.6.0

func (x *AccessInfo_UserPass) GetUsername() string

func (*AccessInfo_UserPass) ProtoMessage added in v0.6.0

func (*AccessInfo_UserPass) ProtoMessage()

func (*AccessInfo_UserPass) ProtoReflect added in v0.6.0

func (x *AccessInfo_UserPass) ProtoReflect() protoreflect.Message

func (*AccessInfo_UserPass) Reset added in v0.6.0

func (x *AccessInfo_UserPass) Reset()

func (*AccessInfo_UserPass) String added in v0.6.0

func (x *AccessInfo_UserPass) String() string

type AccessInfo_UserPass_ added in v0.6.0

type AccessInfo_UserPass_ struct {
	// user_pass specifies a username and password to use to authenticate with the registry.
	// The registry plugin will transform this information to the proper format as needed.
	UserPass *AccessInfo_UserPass `protobuf:"bytes,6,opt,name=user_pass,json=userPass,proto3,oneof"`
}

type Builder

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

Builder uses `docker build` to build a Docker image.

func (*Builder) Build

func (b *Builder) Build(
	ctx context.Context,
	ui terminal.UI,
	src *component.Source,
	log hclog.Logger,
) (*Image, error)

Build

func (*Builder) BuildFunc

func (b *Builder) BuildFunc() interface{}

BuildFunc implements component.Builder

func (*Builder) BuildODR added in v0.6.0

func (b *Builder) BuildODR(
	ctx context.Context,
	ui terminal.UI,
	src *component.Source,
	log hclog.Logger,
	ai *AccessInfo,
) (*Image, error)

Build

func (*Builder) BuildODRFunc added in v0.6.0

func (b *Builder) BuildODRFunc() interface{}

BuildFunc implements component.BuilderODR

func (*Builder) Config

func (b *Builder) Config() (interface{}, error)

Config implements Configurable

func (*Builder) Documentation

func (b *Builder) Documentation() (*docs.Documentation, error)

type BuilderConfig

type BuilderConfig struct {
	// Control whether or not to inject the entrypoint binary into the resulting image
	DisableCEB bool `hcl:"disable_entrypoint,optional"`

	// Controls whether or not the image should be build with buildkit or docker v1
	UseBuildKit bool `hcl:"buildkit,optional"`

	// The name/path to the Dockerfile if it is not the root of the project
	Dockerfile string `hcl:"dockerfile,optional"`

	// Controls the passing of platform flag variables
	Platform string `hcl:"platform,optional"`

	// Controls the passing of build time variables
	BuildArgs map[string]*string `hcl:"build_args,optional"`

	// Controls the passing of build context
	Context string `hcl:"context,optional"`

	// Controls the passing of the target stage
	Target string `hcl:"target,optional"`
}

BuilderConfig is the configuration structure for the builder

type ClientConfig added in v0.1.3

type ClientConfig struct {
	// Host to use when connecting to Docker
	// This can be used to connect to remote Docker instances
	Host string `hcl:"host,optional"`

	// Path to load the certificates for the Docker Engine
	CertPath string `hcl:"cert_path,optional"`

	// Docker API version to use for connection
	APIVersion string `hcl:"api_version,optional"`
}

type Config

type Config struct {
	// Image is the name of the image plus tag that the image will be pushed as.
	Image string `hcl:"image,attr"`

	// Tag is the tag to apply to the image.
	Tag string `hcl:"tag,attr"`

	// Local if true will not push this image to a remote registry.
	Local bool `hcl:"local,optional"`

	// The docker specific encoded authentication string to use to talk to the registry.
	EncodedAuth string `hcl:"encoded_auth,optional"`

	// Insecure indicates if the registry should be accessed via http rather than https
	Insecure bool `hcl:"insecure,optional"`

	// Username is the username to use for authentication on the registry.
	Username string `hcl:"username,optional"`

	// Password is the authentication information assocated with username.
	Password string `hcl:"password,optional"`
}

Config is the configuration structure for the registry.

type Deployment

type Deployment struct {
	Id            string     `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name          string     `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Container     string     `protobuf:"bytes,3,opt,name=container,proto3" json:"container,omitempty"`
	ResourceState *anypb.Any `protobuf:"bytes,4,opt,name=resource_state,json=resourceState,proto3" json:"resource_state,omitempty"`
	// contains filtered or unexported fields
}

func (*Deployment) Descriptor deprecated

func (*Deployment) Descriptor() ([]byte, []int)

Deprecated: Use Deployment.ProtoReflect.Descriptor instead.

func (*Deployment) GetContainer

func (x *Deployment) GetContainer() string

func (*Deployment) GetId

func (x *Deployment) GetId() string

func (*Deployment) GetName

func (x *Deployment) GetName() string

func (*Deployment) GetResourceState added in v0.4.0

func (x *Deployment) GetResourceState() *anypb.Any

func (*Deployment) ProtoMessage

func (*Deployment) ProtoMessage()

func (*Deployment) ProtoReflect added in v0.3.0

func (x *Deployment) ProtoReflect() protoreflect.Message

func (*Deployment) Reset

func (x *Deployment) Reset()

func (*Deployment) String

func (x *Deployment) String() string

type Image

type Image struct {
	Image string `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	Tag   string `protobuf:"bytes,2,opt,name=tag,proto3" json:"tag,omitempty"`
	// location is where this image is currently. This can be used to
	// determine if the image is pulled or not based on this proto rather
	// than environment inspection.
	//
	// If this is not set, it will be assumed that the image is in a local
	// Docker daemon registry for backwards compatiblity reasons.
	//
	// Types that are assignable to Location:
	//	*Image_Registry
	//	*Image_Docker
	//	*Image_Img
	Location isImage_Location `protobuf_oneof:"location"`
	// contains filtered or unexported fields
}

Image is the artifact type for the registry.

func (*Image) Descriptor deprecated

func (*Image) Descriptor() ([]byte, []int)

Deprecated: Use Image.ProtoReflect.Descriptor instead.

func (*Image) GetDocker added in v0.3.0

func (x *Image) GetDocker() *emptypb.Empty

func (*Image) GetImage

func (x *Image) GetImage() string

func (*Image) GetImg added in v0.3.0

func (x *Image) GetImg() *emptypb.Empty

func (*Image) GetLocation added in v0.3.0

func (m *Image) GetLocation() isImage_Location

func (*Image) GetRegistry added in v0.3.0

func (x *Image) GetRegistry() *Image_RegistryLocation

func (*Image) GetTag

func (x *Image) GetTag() string

func (*Image) Name

func (i *Image) Name() string

Name is the full name including the tag.

func (*Image) ProtoMessage

func (*Image) ProtoMessage()

func (*Image) ProtoReflect added in v0.3.0

func (x *Image) ProtoReflect() protoreflect.Message

func (*Image) Reset

func (x *Image) Reset()

func (*Image) String

func (x *Image) String() string

type Image_Docker added in v0.3.0

type Image_Docker struct {
	// docker is set if the image is in a local Docker daemon registry.
	Docker *emptypb.Empty `protobuf:"bytes,4,opt,name=docker,proto3,oneof"`
}

type Image_Img added in v0.3.0

type Image_Img struct {
	// img is set if the image is in a local img content store directory.
	// img: https://github.com/genuinetools/img
	Img *emptypb.Empty `protobuf:"bytes,5,opt,name=img,proto3,oneof"`
}

type Image_Registry added in v0.3.0

type Image_Registry struct {
	// registry is set if the image is in a remote registry. This value
	// might mean the image is local, too, but we never formally "pulled"
	// it so we aren't sure. The image should be treated as remote.
	Registry *Image_RegistryLocation `protobuf:"bytes,3,opt,name=registry,proto3,oneof"`
}

type Image_RegistryLocation added in v0.6.0

type Image_RegistryLocation struct {

	// waypoint_generated indicates that the Image was generated by a process
	// that resulted in the fully built image being already stored in the
	// registry. This is commonly done in ODR for pack and docker-build.
	WaypointGenerated bool `protobuf:"varint,1,opt,name=waypoint_generated,json=waypointGenerated,proto3" json:"waypoint_generated,omitempty"`
	// contains filtered or unexported fields
}

func (*Image_RegistryLocation) Descriptor deprecated added in v0.6.0

func (*Image_RegistryLocation) Descriptor() ([]byte, []int)

Deprecated: Use Image_RegistryLocation.ProtoReflect.Descriptor instead.

func (*Image_RegistryLocation) GetWaypointGenerated added in v0.6.0

func (x *Image_RegistryLocation) GetWaypointGenerated() bool

func (*Image_RegistryLocation) ProtoMessage added in v0.6.0

func (*Image_RegistryLocation) ProtoMessage()

func (*Image_RegistryLocation) ProtoReflect added in v0.6.0

func (x *Image_RegistryLocation) ProtoReflect() protoreflect.Message

func (*Image_RegistryLocation) Reset added in v0.6.0

func (x *Image_RegistryLocation) Reset()

func (*Image_RegistryLocation) String added in v0.6.0

func (x *Image_RegistryLocation) String() string

type Platform

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

Platform is the Platform implementation for Docker.

func (*Platform) Auth

func (p *Platform) Auth() error

func (*Platform) AuthFunc

func (p *Platform) AuthFunc() interface{}

AuthFunc implements component.Authenticator

func (*Platform) Config

func (p *Platform) Config() (interface{}, error)

Config implements Configurable

func (*Platform) Deploy

func (p *Platform) Deploy(
	ctx context.Context,
	log hclog.Logger,
	src *component.Source,
	job *component.JobInfo,
	img *Image,
	deployConfig *component.DeploymentConfig,
	dcr *component.DeclaredResourcesResp,
	ui terminal.UI,
) (*Deployment, error)

Deploy deploys an image to Docker.

func (*Platform) DeployFunc

func (p *Platform) DeployFunc() interface{}

DeployFunc implements component.Platform

func (*Platform) Destroy

func (p *Platform) Destroy(
	ctx context.Context,
	log hclog.Logger,
	deployment *Deployment,
	ui terminal.UI,
) error

Destroy deletes a Docker deployment.

func (*Platform) DestroyFunc

func (p *Platform) DestroyFunc() interface{}

DestroyFunc implements component.Destroyer

func (*Platform) Documentation

func (p *Platform) Documentation() (*docs.Documentation, error)

func (*Platform) Status added in v0.4.0

func (p *Platform) Status(
	ctx context.Context,
	log hclog.Logger,
	deployment *Deployment,
	ui terminal.UI,
) (*sdk.StatusReport, error)

func (*Platform) StatusFunc added in v0.4.0

func (p *Platform) StatusFunc() interface{}

StatusFunc implements component.Status

func (*Platform) ValidateAuth

func (p *Platform) ValidateAuth() error

func (*Platform) ValidateAuthFunc

func (p *Platform) ValidateAuthFunc() interface{}

ValidateAuthFunc implements component.Authenticator

type PlatformConfig

type PlatformConfig struct {
	// A list of folders to mount to the container.
	Binds []string `hcl:"binds,optional"`

	// ClientConfig allow the user to specify the connection to the Docker
	// engine. By default we try to load this from env vars:
	// DOCKER_HOST to set the url to the docker server.
	// DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
	// DOCKER_CERT_PATH to load the TLS certificates from.
	// DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
	ClientConfig *ClientConfig `hcl:"client_config,block"`

	// The command to run in the container. This is an array of arguments
	// that are executed directly. These are not executed in the context of
	// a shell. If you want to use a shell, add that to this command manually.
	Command []string `hcl:"command,optional"`

	// Force pull the image from the remote repository
	ForcePull bool `hcl:"force_pull,optional"`

	// A map of key/value pairs, stored in docker as a string. Each key/value pair must
	// be unique. Validiation occurs at the docker layer, not in Waypoint. Label
	// keys are alphanumeric strings which may contain periods (.) and hyphens (-).
	// See the docker docs for more info: https://docs.docker.com/config/labels-custom-metadata/
	Labels map[string]string `hcl:"labels,optional"`

	// An array of strings with network names to connect the container to
	Networks []string `hcl:"networks,optional"`

	// A map of resources to configure the container with such as memory and cpu
	// limits.
	Resources map[string]string `hcl:"resources,optional"`

	// A path to a directory that will be created for the service to store
	// temporary data.
	ScratchSpace string `hcl:"scratch_path,optional"`

	// Environment variables that are meant to configure the application in a static
	// way. This might be control an image that has mulitple modes of operation,
	// selected via environment variable. Most configuration should use the waypoint
	// config commands.
	StaticEnvVars map[string]string `hcl:"static_environment,optional"`

	// Additional ports the application is listening on to expose on the container
	ExtraPorts []uint `hcl:"extra_ports,optional"`

	// Port that your service is running on within the actual container.
	// Defaults to port 3000.
	// TODO Evaluate if this should remain as a default 3000, should be a required field,
	// or default to another port.
	ServicePort uint `hcl:"service_port,optional"`
}

Config is the configuration structure for the Platform.

type Registry

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

Registry represents access to a Docker registry.

func (*Registry) AccessInfo added in v0.6.0

func (r *Registry) AccessInfo() (*AccessInfo, error)

Push pushes an image to the registry.

func (*Registry) AccessInfoFunc added in v0.6.0

func (r *Registry) AccessInfoFunc() interface{}

func (*Registry) Config

func (r *Registry) Config() (interface{}, error)

Config implements Configurable

func (*Registry) Documentation

func (r *Registry) Documentation() (*docs.Documentation, error)

func (*Registry) Push

func (r *Registry) Push(
	ctx context.Context,
	img *Image,
	ui terminal.UI,
	log hclog.Logger,
) (*Image, error)

Push pushes an image to the registry.

func (*Registry) PushFunc

func (r *Registry) PushFunc() interface{}

PushFunc implements component.Registry

type Release

type Release struct {
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

func (*Release) Descriptor deprecated

func (*Release) Descriptor() ([]byte, []int)

Deprecated: Use Release.ProtoReflect.Descriptor instead.

func (*Release) GetUrl

func (x *Release) GetUrl() string

func (*Release) ProtoMessage

func (*Release) ProtoMessage()

func (*Release) ProtoReflect added in v0.3.0

func (x *Release) ProtoReflect() protoreflect.Message

func (*Release) Reset

func (x *Release) Reset()

func (*Release) String

func (x *Release) String() string

type Resource added in v0.4.0

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

Resource contains the internal resource states.

func (*Resource) Descriptor deprecated added in v0.4.0

func (*Resource) Descriptor() ([]byte, []int)

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) ProtoMessage added in v0.4.0

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect added in v0.4.0

func (x *Resource) ProtoReflect() protoreflect.Message

func (*Resource) Reset added in v0.4.0

func (x *Resource) Reset()

func (*Resource) String added in v0.4.0

func (x *Resource) String() string

type Resource_Container added in v0.4.0

type Resource_Container struct {
	Id   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource_Container) Descriptor deprecated added in v0.4.0

func (*Resource_Container) Descriptor() ([]byte, []int)

Deprecated: Use Resource_Container.ProtoReflect.Descriptor instead.

func (*Resource_Container) GetId added in v0.4.0

func (x *Resource_Container) GetId() string

func (*Resource_Container) GetName added in v0.4.0

func (x *Resource_Container) GetName() string

func (*Resource_Container) ProtoMessage added in v0.4.0

func (*Resource_Container) ProtoMessage()

func (*Resource_Container) ProtoReflect added in v0.4.0

func (x *Resource_Container) ProtoReflect() protoreflect.Message

func (*Resource_Container) Reset added in v0.4.0

func (x *Resource_Container) Reset()

func (*Resource_Container) String added in v0.4.0

func (x *Resource_Container) String() string

type Resource_Network added in v0.4.0

type Resource_Network struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource_Network) Descriptor deprecated added in v0.4.0

func (*Resource_Network) Descriptor() ([]byte, []int)

Deprecated: Use Resource_Network.ProtoReflect.Descriptor instead.

func (*Resource_Network) GetName added in v0.4.0

func (x *Resource_Network) GetName() string

func (*Resource_Network) ProtoMessage added in v0.4.0

func (*Resource_Network) ProtoMessage()

func (*Resource_Network) ProtoReflect added in v0.4.0

func (x *Resource_Network) ProtoReflect() protoreflect.Message

func (*Resource_Network) Reset added in v0.4.0

func (x *Resource_Network) Reset()

func (*Resource_Network) String added in v0.4.0

func (x *Resource_Network) String() string

type TaskInfo added in v0.5.0

type TaskInfo struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*TaskInfo) Descriptor deprecated added in v0.5.0

func (*TaskInfo) Descriptor() ([]byte, []int)

Deprecated: Use TaskInfo.ProtoReflect.Descriptor instead.

func (*TaskInfo) GetId added in v0.5.0

func (x *TaskInfo) GetId() string

func (*TaskInfo) ProtoMessage added in v0.5.0

func (*TaskInfo) ProtoMessage()

func (*TaskInfo) ProtoReflect added in v0.5.0

func (x *TaskInfo) ProtoReflect() protoreflect.Message

func (*TaskInfo) Reset added in v0.5.0

func (x *TaskInfo) Reset()

func (*TaskInfo) String added in v0.5.0

func (x *TaskInfo) String() string

type TaskLauncher added in v0.5.0

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

TaskLauncher uses `docker build` to build a Docker iamge.

func (*TaskLauncher) Config added in v0.5.0

func (b *TaskLauncher) Config() (interface{}, error)

TaskLauncher implements Configurable

func (*TaskLauncher) Documentation added in v0.5.0

func (b *TaskLauncher) Documentation() (*docs.Documentation, error)

func (*TaskLauncher) StartTask added in v0.5.0

func (b *TaskLauncher) StartTask(
	ctx context.Context,
	log hclog.Logger,
	tli *component.TaskLaunchInfo,
) (*TaskInfo, error)

StartTask creates a docker container for the task.

func (*TaskLauncher) StartTaskFunc added in v0.5.0

func (b *TaskLauncher) StartTaskFunc() interface{}

BuildFunc implements component.TaskLauncher

func (*TaskLauncher) StopTask added in v0.5.0

func (b *TaskLauncher) StopTask(
	ctx context.Context,
	log hclog.Logger,
	ti *TaskInfo,
) error

StopTask signals to docker to stop the container created previously

func (*TaskLauncher) StopTaskFunc added in v0.5.0

func (b *TaskLauncher) StopTaskFunc() interface{}

BuildFunc implements component.TaskLauncher

type TaskLauncherConfig added in v0.5.0

type TaskLauncherConfig struct {
	// A list of folders to mount to the container.
	Binds []string `hcl:"binds,optional"`

	// ClientConfig allow the user to specify the connection to the Docker
	// engine. By default we try to load this from env vars:
	// DOCKER_HOST to set the url to the docker server.
	// DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
	// DOCKER_CERT_PATH to load the TLS certificates from.
	// DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
	ClientConfig *ClientConfig `hcl:"client_config,block"`

	// Force pull the image from the remote repository
	ForcePull bool `hcl:"force_pull,optional"`

	// A map of key/value pairs, stored in docker as a string. Each key/value pair must
	// be unique. Validiation occurs at the docker layer, not in Waypoint. Label
	// keys are alphanumeric strings which may contain periods (.) and hyphens (-).
	// See the docker docs for more info: https://docs.docker.com/config/labels-custom-metadata/
	Labels map[string]string `hcl:"labels,optional"`

	// An array of strings with network names to connect the container to
	Networks []string `hcl:"networks,optional"`

	// Resources configures the resource constraints such as cpu and memory for the
	// created containers.
	Resources TaskResources `hcl:"resources,block"`

	// Environment variables that are meant to configure the application in a static
	// way. This might be start an image in a specific mode,
	// selected via environment variable. Most configuration should use the waypoint
	// config commands.
	StaticEnvVars map[string]string `hcl:"static_environment,optional"`

	// Keep containers around after the task finishes. This allows the ability to debug
	// the containers and see their logs with the native docker tools.
	DebugContainers bool `hcl:"debug_containers,optional"`
}

TaskLauncherConfig is the configuration structure for the task plugin.

type TaskResources added in v0.5.0

type TaskResources struct {
	// How many CPU shares to allocate to each task
	CpuShares int64 `hcl:"cpu,optional"`

	// How much memory to allocate to each task
	MemoryLimit string `hcl:"memory,optional"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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