Documentation ¶
Index ¶
- func Containerize(r *Runtime, p *Package, f func())
- type ACIExecutor
- type ACIRuntimeConfig
- type Builder
- type DockerImpl
- func (d *DockerImpl) Build(dir string, image string, stdout io.Writer, stderr io.Writer) error
- func (d *DockerImpl) Cancel(name string) error
- func (d *DockerImpl) Logs(name string, stdout io.Writer, stderr io.Writer) error
- func (d *DockerImpl) Push(image string, stdout io.Writer, stderr io.Writer) error
- func (d *DockerImpl) Run(image string, name string, config *Runtime, stdout io.Writer, stderr io.Writer) error
- type Executor
- type MetaparticleExecutor
- type Package
- type Runtime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Containerize ¶
Containerize receives a description of the runtime and metadata needed to build a container image, and run it.
When called inside the container, it runs the function f. When called outside the container, it builds the container image and runs it in the specified runtime environment.
Types ¶
type ACIExecutor ¶
type ACIExecutor struct {
// contains filtered or unexported fields
}
ACIExecutor implements and executor on Azure Container Engine
func NewACIExecutor ¶
func NewACIExecutor() (*ACIExecutor, error)
NewACIExecutor returns a new instance of an ACI Executor
func (*ACIExecutor) Cancel ¶
func (a *ACIExecutor) Cancel(name string) error
Cancel deletes the container with the given name on the executor's resource group
type ACIRuntimeConfig ¶
type ACIRuntimeConfig struct { SubscriptionID string TenantID string ClientID string ClientSecret string ResourceGroupName string }
ACIRuntimeConfig - runtime config for ACI executor.
type Builder ¶
type Builder interface { Build(dir string, image string, stdout io.Writer, stderr io.Writer) error Push(image string, stdout io.Writer, stderr io.Writer) error }
Builder is the interface that wraps the container runtime's build and push methods
type DockerImpl ¶
type DockerImpl struct {
// contains filtered or unexported fields
}
DockerImpl is a docker implementation of the Builder and Executor interfaces
func NewDockerImpl ¶
func NewDockerImpl() (*DockerImpl, error)
NewDockerImpl returns a singleton struct that uses docker to implement metaparticle.Builder and metaparticle.Executor.
It uses the environment variables DOCKER_CERT_PATH, DOCKER_HOST, DOCKER_API_VERSION and DOCKER_TLS_VERIFY to instantiate instantiate a docker API client. When these variables are not specified, it defaults to the client running on the local machine.
func (*DockerImpl) Build ¶
Build creates a tarball with the directory's contents and sends it to docker to be build the image
func (*DockerImpl) Cancel ¶
func (d *DockerImpl) Cancel(name string) error
Cancel stops and removes the container with the given name
func (*DockerImpl) Logs ¶
Logs attaches to the container with the given name and prints the log to stdout
type Executor ¶
type Executor interface { Run(image string, name string, config *Runtime, stdout io.Writer, stderr io.Writer) error Logs(name string, stdout io.Writer, stderr io.Writer) error Cancel(name string) error }
Executor implementors are container platforms where the containers can be deployed (e.g. Azure, GCP)
type MetaparticleExecutor ¶
type MetaparticleExecutor struct {
SpecPath string
}
func (*MetaparticleExecutor) Cancel ¶
func (m *MetaparticleExecutor) Cancel(name string) error
type Package ¶
type Package struct { // Image name Name string // Image repository (e.g. quay.io/user) Repository string Verbose bool Quiet bool // Image builder (e.g. docker) Builder string // Whether to publish the built image to the remote repository Publish bool }
Package encapsulates the metadata needed to build the image
type Runtime ¶
type Runtime struct { // must return an integer >= 1 Replicas int32 // must return an integer >= 0 Shards int32 // TODO: find out what this does URLShardPattern string // The name of the executor (e.g.: docker) Executor string // Returns the ports that the service exposes Ports []int32 // Returns whether the service wants a public IP when deployed (usually involves the creation of a load balancer) PublicAddress bool // Pointer to extra configuration needed by specific executors (e.g. AciRuntimeConfig) ExtraConfig interface{} }
Runtime represents a place where to run the containers (Docker, rkt, etc)