Documentation
¶
Overview ¶
Package target describes where a bundle is deployed, and where its installer runs. The CLI, the stack file and the Terraform provider fill these same types.
Index ¶
Constants ¶
const ( Compose = "compose" Swarm = "swarm" )
Orchestrators of a target.
const ( // ImagesRegistry lets the target pull them from their registry. It is the default. ImagesRegistry = "registry" // ImagesLoad loads them into the target's daemon, with no registry: for // Compose, or a swarm of one node, which alone has them. ImagesLoad = "load" )
How the images reach the target.
const ( // DriverDocker runs the invocation image on the target itself, next to // what it deploys, with the target's socket mounted. It is the default. DriverDocker = "docker" // DriverKubernetes runs the invocation image as a Job in a cluster, // which reaches the target at its address. DriverKubernetes = "kubernetes" )
Drivers of the installer.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct {
// Host is the address of the target's Docker: unix://, tcp:// or
// ssh://user@host. With neither Host nor Context, it is the
// environment's: DOCKER_HOST, the current docker context, or the local
// socket.
Host string `json:"host,omitempty"`
// Context names a docker context to reach the target with, instead of Host.
Context string `json:"context,omitempty"`
// Volumes are the volume types of the target, by name: what a volume of
// a bundle with that x-nemo-volume type is made of here.
Volumes map[string]VolumeType `json:"volumes,omitempty"`
// Images says how the images reach the target: registry, the default,
// or load.
Images string `json:"images,omitempty"`
}
Configuration is what both orchestrators deploy with: one Docker, whose address is the only Docker address nemo knows, as whatever must reach the target goes through it; its volume types; and how images reach it.
func (Configuration) Validate ¶
func (configuration Configuration) Validate() error
Validate checks the configuration, and each of its volume types.
type Installer ¶
type Installer struct {
// Driver is docker, the default, or kubernetes.
Driver string `json:"driver,omitempty"`
// Kubernetes configures the kubernetes driver.
Kubernetes *Kubernetes `json:"kubernetes,omitempty"`
}
Installer is where the invocation image runs.
func (Installer) DriverName ¶
DriverName returns the driver, docker when none is set.
type Kubernetes ¶
type Kubernetes struct {
// Namespace is the namespace of the Job.
Namespace string `json:"namespace"`
// Kubeconfig is the path of the kubeconfig. Empty, it is the default
// one (KUBECONFIG, ~/.kube/config), else the cluster nemo runs in.
Kubeconfig string `json:"kubeconfig,omitempty"`
}
Kubernetes is where the kubernetes driver runs the Job. It concerns the cluster only: the Job reaches the target at the target's address.
func (Kubernetes) Validate ¶
func (kubernetes Kubernetes) Validate() error
Validate checks that the Job has a namespace.
type Target ¶
type Target struct {
// Orchestrator deploys the bundle on the target: compose or swarm.
Orchestrator string `json:"orchestrator"`
Configuration `json:"configuration,omitzero"`
}
Target is what receives the deployment: the orchestrator that deploys there, and its configuration, the same for both orchestrators.
type VolumeDriver ¶
type VolumeDriver struct {
Driver string `json:"driver,omitempty"`
Options map[string]string `json:"options,omitempty"`
}
VolumeDriver is a volume driver and its options.
type VolumeProvision ¶
type VolumeProvision struct {
Directory string `json:"directory"`
Volume VolumeDriver `json:"volume"`
}
VolumeProvision creates Directory in the storage that Volume mounts.
func (VolumeProvision) Validate ¶
func (provision VolumeProvision) Validate() error
Validate checks that the provision names its directory.
type VolumeType ¶
type VolumeType struct {
VolumeDriver
// Provision creates a directory for each volume before the volume, for
// drivers that mount a directory of a storage and need it to exist.
Provision *VolumeProvision `json:"provision,omitempty"`
}
VolumeType is what the volumes of a type are made of on a target. Its driver, options and provisioned directory are templates of the volume: {{.Stack}}, {{.Name}}, the volume's name in its bundle, and {{.Options}}, the options its x-nemo-volume gives, with {{AppendJoin .Options ","}} to append them to a list.
func (VolumeType) Validate ¶
func (volumeType VolumeType) Validate() error
Validate checks the volume type's provision, when it has one.