Documentation
¶
Overview ¶
Package convert turns a compose project into the specs of Swarm objects, the way docker stack deploy does (docker/cli, cli/compose/convert). It only computes: creating the objects is the orchestrator's job.
Index ¶
- Constants
- func AddStackLabel(namespace Namespace, labels map[string]string) map[string]string
- func Config(key string, config types.ConfigObjConfig, base map[string]string) (*swarm.ConfigSpec, error)
- func Hash(spec *swarm.ServiceSpec) (string, error)
- func Mounts(service types.ServiceConfig, volumes types.Volumes, base map[string]string) ([]mount.Mount, error)
- func Network(network types.NetworkConfig, base map[string]string) (docker.NetworkSpec, error)
- func Secret(key string, secret types.SecretConfig, base map[string]string) (*swarm.SecretSpec, error)
- func Service(namespace Namespace, project *types.Project, service types.ServiceConfig, ...) (*swarm.ServiceSpec, error)
- func Volume(config types.VolumeConfig, base map[string]string) *volume.Volume
- type Namespace
Constants ¶
const LabelNamespace = "com.docker.stack.namespace"
LabelNamespace lets docker stack ps and docker stack rm see what nemo created.
Variables ¶
This section is empty.
Functions ¶
func AddStackLabel ¶
AddStackLabel returns a copy of the labels with the namespace label added
func Config ¶
func Config(key string, config types.ConfigObjConfig, base map[string]string) (*swarm.ConfigSpec, error)
Config converts a compose config into the spec of a Swarm config, named after its content. An external config, which is only referenced, has no data.
func Hash ¶
func Hash(spec *swarm.ServiceSpec) (string, error)
Hash identifies a service spec, whatever its hash and revision labels say: a service is only updated when its hash changed.
func Mounts ¶
func Mounts(service types.ServiceConfig, volumes types.Volumes, base map[string]string) ([]mount.Mount, error)
Mounts converts the volumes and tmpfs of a service. A volume of the project carries its labels and driver, so that Swarm creates it on every node.
func Network ¶
func Network(network types.NetworkConfig, base map[string]string) (docker.NetworkSpec, error)
Network converts a compose network into a Swarm network to create, as docker stack deploy does: an overlay network of swarm scope.
func Secret ¶
func Secret(key string, secret types.SecretConfig, base map[string]string) (*swarm.SecretSpec, error)
Secret converts a compose secret into the spec of a Swarm secret, named after its content. An external secret, which is only referenced, has no data.
func Service ¶
func Service(namespace Namespace, project *types.Project, service types.ServiceConfig, configs, secrets, base map[string]string) (*swarm.ServiceSpec, error)
Service converts a compose service into the spec of a Swarm service. configs and secrets map the compose keys to the names of the Swarm objects; base holds the labels of the installation.
As with docker stack deploy, deploy.labels go on the service and labels on its containers.
Types ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace mangles names by prepending the name
func NewNamespace ¶
NewNamespace returns a new Namespace for scoping of names