Help us shape the future of Go! Take the 2026 Go Developer Survey

target

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

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

View Source
const (
	Compose = "compose"
	Swarm   = "swarm"
)

Orchestrators of a target.

View Source
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.

View Source
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

func (installer Installer) DriverName() string

DriverName returns the driver, docker when none is set.

func (Installer) Validate

func (installer Installer) Validate() error

Validate checks the installer: the kubernetes settings go with the kubernetes driver, and only with it.

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.

func (Target) Validate

func (target Target) Validate() error

Validate checks the target. Its configuration is a field of its own, which ozzo would merge into the target's errors as an embedded struct.

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.

Jump to

Keyboard shortcuts

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