types

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 1 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeprecatedProperties = map[string]string{
	"container_name": "Setting the container name is not supported.",
	"expose":         "Exposing ports is unnecessary - services on the same network can access each other's containers on any port.",
}

DeprecatedProperties that were removed from the v3 format, but their use should not impact the behaviour of the application.

View Source
var ForbiddenProperties = map[string]string{
	"extends":       "Support for `extends` is not implemented yet.",
	"volume_driver": "Instead of setting the volume driver on the service, define a volume using the top-level `volumes` option and specify the driver there.",
	"volumes_from":  "To share a volume between services, define it using the top-level `volumes` option and reference it from each service that shares it using the service-level `volumes` option.",
	"cpu_quota":     "Set resource limits using deploy.resources",
	"cpu_shares":    "Set resource limits using deploy.resources",
	"cpuset":        "Set resource limits using deploy.resources",
	"mem_limit":     "Set resource limits using deploy.resources",
	"memswap_limit": "Set resource limits using deploy.resources",
}

ForbiddenProperties that are not supported in this implementation of the compose file.

View Source
var UnsupportedProperties = []string{
	"build",
	"cap_add",
	"cap_drop",
	"cgroup_parent",
	"devices",
	"domainname",
	"external_links",
	"ipc",
	"links",
	"mac_address",
	"network_mode",
	"privileged",
	"restart",
	"security_opt",
	"shm_size",
	"sysctls",
	"tmpfs",
	"ulimits",
	"userns_mode",
}

UnsupportedProperties not yet supported by this implementation of the compose file

Functions

This section is empty.

Types

type BuildConfig

type BuildConfig struct {
	Context    string
	Dockerfile string
	Args       MappingWithEquals
	Labels     Labels
	CacheFrom  StringList `mapstructure:"cache_from"`
	Network    string
	Target     string
}

BuildConfig is a type for build using the same format at libcompose: https://github.com/docker/libcompose/blob/master/yaml/build.go#L12

type Config

type Config struct {
	Services []ServiceConfig
	Networks map[string]NetworkConfig
	Volumes  map[string]VolumeConfig
	Secrets  map[string]SecretConfig
	Configs  map[string]ConfigObjConfig
}

Config is a full compose file configuration

type ConfigDetails

type ConfigDetails struct {
	WorkingDir  string
	ConfigFiles []ConfigFile
	Environment map[string]string
}

ConfigDetails are the details about a group of ConfigFiles

func (ConfigDetails) LookupEnv

func (cd ConfigDetails) LookupEnv(key string) (string, bool)

LookupEnv provides a lookup function for environment variables

type ConfigFile

type ConfigFile struct {
	Filename string
	Config   map[string]interface{}
}

ConfigFile is a filename and the contents of the file as a Dict

type ConfigObjConfig

type ConfigObjConfig fileObjectConfig

ConfigObjConfig is the config for the swarm "Config" object

type CredentialSpecConfig

type CredentialSpecConfig struct {
	File     string
	Registry string
}

CredentialSpecConfig for credential spec on Windows

type DeployConfig

type DeployConfig struct {
	Mode          string
	Replicas      *uint64
	Labels        Labels
	UpdateConfig  *UpdateConfig `mapstructure:"update_config"`
	Resources     Resources
	RestartPolicy *RestartPolicy `mapstructure:"restart_policy"`
	Placement     Placement
	EndpointMode  string `mapstructure:"endpoint_mode"`
}

DeployConfig the deployment configuration for a service

type External

type External struct {
	Name     string
	External bool
}

External identifies a Volume or Network as a reference to a resource that is not managed, and should already exist. External.name is deprecated and replaced by Volume.name

type HealthCheckConfig

type HealthCheckConfig struct {
	Test        HealthCheckTest
	Timeout     *time.Duration
	Interval    *time.Duration
	Retries     *uint64
	StartPeriod *time.Duration `mapstructure:"start_period"`
	Disable     bool
}

HealthCheckConfig the healthcheck configuration for a service

type HealthCheckTest

type HealthCheckTest []string

HealthCheckTest is the command run to test the health of a service

type IPAMConfig

type IPAMConfig struct {
	Driver string
	Config []*IPAMPool
}

IPAMConfig for a network

type IPAMPool

type IPAMPool struct {
	Subnet string
}

IPAMPool for a network

type Labels

type Labels map[string]string

Labels is a mapping type for labels

type LoggingConfig

type LoggingConfig struct {
	Driver  string
	Options map[string]string
}

LoggingConfig the logging configuration for a service

type MappingWithColon

type MappingWithColon map[string]string

MappingWithColon is a mapping type that can be converted from a list of 'key: value' strings

type MappingWithEquals

type MappingWithEquals map[string]*string

MappingWithEquals is a mapping type that can be converted from a list of key[=value] strings. For the key with an empty value (`key=`), the mapped value is set to a pointer to `""`. For the key without value (`key`), the mapped value is set to nil.

type NetworkConfig

type NetworkConfig struct {
	Driver     string
	DriverOpts map[string]string `mapstructure:"driver_opts"`
	Ipam       IPAMConfig
	External   External
	Internal   bool
	Attachable bool
	Labels     Labels
}

NetworkConfig for a network

type Placement

type Placement struct {
	Constraints []string
	Preferences []PlacementPreferences
}

Placement constraints for the service

type PlacementPreferences

type PlacementPreferences struct {
	Spread string
}

PlacementPreferences is the preferences for a service placement

type Resource

type Resource struct {
	// TODO: types to convert from units and ratios
	NanoCPUs    string    `mapstructure:"cpus"`
	MemoryBytes UnitBytes `mapstructure:"memory"`
}

Resource is a resource to be limited or reserved

type Resources

type Resources struct {
	Limits       *Resource
	Reservations *Resource
}

Resources the resource limits and reservations

type RestartPolicy

type RestartPolicy struct {
	Condition   string
	Delay       *time.Duration
	MaxAttempts *uint64 `mapstructure:"max_attempts"`
	Window      *time.Duration
}

RestartPolicy the service restart policy

type SecretConfig

type SecretConfig fileObjectConfig

SecretConfig for a secret

type ServiceConfig

type ServiceConfig struct {
	Name string

	Build           BuildConfig
	CapAdd          []string `mapstructure:"cap_add"`
	CapDrop         []string `mapstructure:"cap_drop"`
	CgroupParent    string   `mapstructure:"cgroup_parent"`
	Command         ShellCommand
	Configs         []ServiceConfigObjConfig
	ContainerName   string               `mapstructure:"container_name"`
	CredentialSpec  CredentialSpecConfig `mapstructure:"credential_spec"`
	DependsOn       []string             `mapstructure:"depends_on"`
	Deploy          DeployConfig
	Devices         []string
	DNS             StringList
	DNSSearch       StringList `mapstructure:"dns_search"`
	DomainName      string     `mapstructure:"domainname"`
	Entrypoint      ShellCommand
	Environment     MappingWithEquals
	EnvFile         StringList `mapstructure:"env_file"`
	Expose          StringOrNumberList
	ExternalLinks   []string         `mapstructure:"external_links"`
	ExtraHosts      MappingWithColon `mapstructure:"extra_hosts"`
	Hostname        string
	HealthCheck     *HealthCheckConfig
	Image           string
	Ipc             string
	Labels          Labels
	Links           []string
	Logging         *LoggingConfig
	MacAddress      string `mapstructure:"mac_address"`
	NetworkMode     string `mapstructure:"network_mode"`
	Networks        map[string]*ServiceNetworkConfig
	Pid             string
	Ports           []ServicePortConfig
	Privileged      bool
	ReadOnly        bool `mapstructure:"read_only"`
	Restart         string
	Secrets         []ServiceSecretConfig
	SecurityOpt     []string       `mapstructure:"security_opt"`
	StdinOpen       bool           `mapstructure:"stdin_open"`
	StopGracePeriod *time.Duration `mapstructure:"stop_grace_period"`
	StopSignal      string         `mapstructure:"stop_signal"`
	Tmpfs           StringList
	Tty             bool `mapstructure:"tty"`
	Ulimits         map[string]*UlimitsConfig
	User            string
	Volumes         []ServiceVolumeConfig
	WorkingDir      string `mapstructure:"working_dir"`
}

ServiceConfig is the configuration of one service

type ServiceConfigObjConfig

type ServiceConfigObjConfig fileReferenceConfig

ServiceConfigObjConfig is the config obj configuration for a service

type ServiceNetworkConfig

type ServiceNetworkConfig struct {
	Aliases     []string
	Ipv4Address string `mapstructure:"ipv4_address"`
	Ipv6Address string `mapstructure:"ipv6_address"`
}

ServiceNetworkConfig is the network configuration for a service

type ServicePortConfig

type ServicePortConfig struct {
	Mode      string
	Target    uint32
	Published uint32
	Protocol  string
}

ServicePortConfig is the port configuration for a service

type ServiceSecretConfig

type ServiceSecretConfig fileReferenceConfig

ServiceSecretConfig is the secret configuration for a service

type ServiceVolumeBind

type ServiceVolumeBind struct {
	Propagation string
}

ServiceVolumeBind are options for a service volume of type bind

type ServiceVolumeConfig

type ServiceVolumeConfig struct {
	Type        string
	Source      string
	Target      string
	ReadOnly    bool `mapstructure:"read_only"`
	Consistency string
	Bind        *ServiceVolumeBind
	Volume      *ServiceVolumeVolume
}

ServiceVolumeConfig are references to a volume used by a service

type ServiceVolumeVolume

type ServiceVolumeVolume struct {
	NoCopy bool `mapstructure:"nocopy"`
}

ServiceVolumeVolume are options for a service volume of type volume

type ShellCommand

type ShellCommand []string

ShellCommand is a string or list of string args

type StringList

type StringList []string

StringList is a type for fields that can be a string or list of strings

type StringOrNumberList

type StringOrNumberList []string

StringOrNumberList is a type for fields that can be a list of strings or numbers

type UlimitsConfig

type UlimitsConfig struct {
	Single int
	Soft   int
	Hard   int
}

UlimitsConfig the ulimit configuration

type UnitBytes

type UnitBytes int64

UnitBytes is the bytes type

type UpdateConfig

type UpdateConfig struct {
	Parallelism     *uint64
	Delay           time.Duration
	FailureAction   string `mapstructure:"failure_action"`
	Monitor         time.Duration
	MaxFailureRatio float32 `mapstructure:"max_failure_ratio"`
	Order           string
}

UpdateConfig the service update configuration

type VolumeConfig

type VolumeConfig struct {
	Name       string
	Driver     string
	DriverOpts map[string]string `mapstructure:"driver_opts"`
	External   External
	Labels     Labels
}

VolumeConfig for a volume

Jump to

Keyboard shortcuts

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