Documentation ¶
Index ¶
- Constants
- func AddStackLabel(namespace Namespace, labels map[string]string) map[string]string
- func Configs(namespace Namespace, configs map[string]composetypes.ConfigObjConfig) ([]swarm.ConfigSpec, error)
- func ConvertKVStringsToMapWithNil(values []string) map[string]*string
- func ConvertPortToPortConfig(port nat.Port, portBindings map[nat.Port][]nat.PortBinding) ([]swarm.PortConfig, error)
- func GetDeprecatedProperties(configDicts ...map[string]interface{}) map[string]string
- func GetServicesDeclaredNetworks(serviceConfigs []composetypes.ServiceConfig) map[string]struct{}
- func GetUnsupportedProperties(configDicts ...map[string]interface{}) []string
- func Load(configDetails composetypes.ConfigDetails, options ...func(*Options)) (*composetypes.Config, error)
- func LoadConfigObjs(source map[string]interface{}, details composetypes.ConfigDetails) (map[string]composetypes.ConfigObjConfig, error)
- func LoadNetworks(source map[string]interface{}, version string) (map[string]composetypes.NetworkConfig, error)
- func LoadSecrets(source map[string]interface{}, details composetypes.ConfigDetails) (map[string]composetypes.SecretConfig, error)
- func LoadService(name string, serviceDict map[string]interface{}, workingDir string, ...) (*composetypes.ServiceConfig, error)
- func LoadServices(servicesDict map[string]interface{}, workingDir string, ...) ([]composetypes.ServiceConfig, error)
- func LoadVolumes(source map[string]interface{}, version string) (map[string]composetypes.VolumeConfig, error)
- func Networks(namespace Namespace, networks networkMap, servicesNetworks map[string]struct{}) (map[string]types.NetworkCreate, []string)
- func Parse(name, content string) (*composetypes.Config, error)
- func ParseCPUs(value string) (int64, error)
- func ParseConfigs(client client.ConfigAPIClient, requestedConfigs []*swarm.ConfigReference) ([]*swarm.ConfigReference, error)
- func ParseEnvFile(filename string) ([]string, error)
- func ParseRestartPolicy(policy string) (container.RestartPolicy, error)
- func ParseSecrets(client *client.Client, requestedSecrets []*swarm.SecretReference) ([]*swarm.SecretReference, error)
- func ParseVolume(spec string) (types.ServiceVolumeConfig, error)
- func ParseYAML(source []byte) (map[string]interface{}, error)
- func Secrets(namespace Namespace, secrets map[string]composetypes.SecretConfig) ([]swarm.SecretSpec, error)
- func Service(apiVersion string, namespace Namespace, service composetypes.ServiceConfig, ...) (swarm.ServiceSpec, error)
- func Services(namespace Namespace, config *composetypes.Config, client *client.Client) (map[string]swarm.ServiceSpec, error)
- func Transform(source interface{}, target interface{}, additionalTransformers ...Transformer) error
- func Volumes(serviceVolumes []composetypes.ServiceVolumeConfig, stackVolumes volumes, ...) ([]mount.Mount, error)
- type ErrBadEnvVariable
- type ForbiddenPropertiesError
- type Namespace
- type Options
- type PortOpt
- type Transformer
Constants ¶
const (
// LabelImage is the label used to store image name provided in the compose file
LabelImage = "com.docker.stack.image"
)
const (
// LabelNamespace is the label used to track stack resources
LabelNamespace = "com.docker.stack.namespace"
)
Variables ¶
This section is empty.
Functions ¶
func AddStackLabel ¶
AddStackLabel returns labels with the namespace label added
func Configs ¶
func Configs(namespace Namespace, configs map[string]composetypes.ConfigObjConfig) ([]swarm.ConfigSpec, error)
Configs converts config objects from the Compose type to the engine API type
func ConvertKVStringsToMapWithNil ¶
ConvertKVStringsToMapWithNil converts ["key=value"] to {"key":"value"} but set unset keys to nil - meaning the ones with no "=" in them. We use this in cases where we need to distinguish between
FOO= and FOO
where the latter case just means FOO was mentioned but not given a value
func ConvertPortToPortConfig ¶
func ConvertPortToPortConfig( port nat.Port, portBindings map[nat.Port][]nat.PortBinding, ) ([]swarm.PortConfig, error)
ConvertPortToPortConfig converts ports to the swarm type
func GetDeprecatedProperties ¶
GetDeprecatedProperties returns the list of any deprecated properties that are used in the compose files.
func GetServicesDeclaredNetworks ¶
func GetServicesDeclaredNetworks(serviceConfigs []composetypes.ServiceConfig) map[string]struct{}
func GetUnsupportedProperties ¶
GetUnsupportedProperties returns the list of any unsupported properties that are used in the Compose files.
func Load ¶
func Load(configDetails composetypes.ConfigDetails, options ...func(*Options)) (*composetypes.Config, error)
Load reads a ConfigDetails and returns a fully loaded configuration
func LoadConfigObjs ¶
func LoadConfigObjs(source map[string]interface{}, details composetypes.ConfigDetails) (map[string]composetypes.ConfigObjConfig, error)
LoadConfigObjs produces a ConfigObjConfig map from a compose file Dict the source Dict is not validated if directly used. Use Load() to enable validation
func LoadNetworks ¶
func LoadNetworks(source map[string]interface{}, version string) (map[string]composetypes.NetworkConfig, error)
LoadNetworks produces a NetworkConfig map from a compose file Dict the source Dict is not validated if directly used. Use Load() to enable validation
func LoadSecrets ¶
func LoadSecrets(source map[string]interface{}, details composetypes.ConfigDetails) (map[string]composetypes.SecretConfig, error)
LoadSecrets produces a SecretConfig map from a compose file Dict the source Dict is not validated if directly used. Use Load() to enable validation
func LoadService ¶
func LoadService(name string, serviceDict map[string]interface{}, workingDir string, lookupEnv template.Mapping) (*composetypes.ServiceConfig, error)
LoadService produces a single ServiceConfig from a compose file Dict the serviceDict is not validated if directly used. Use Load() to enable validation
func LoadServices ¶
func LoadServices(servicesDict map[string]interface{}, workingDir string, lookupEnv template.Mapping) ([]composetypes.ServiceConfig, error)
LoadServices produces a ServiceConfig map from a compose file Dict the servicesDict is not validated if directly used. Use Load() to enable validation
func LoadVolumes ¶
func LoadVolumes(source map[string]interface{}, version string) (map[string]composetypes.VolumeConfig, error)
LoadVolumes produces a VolumeConfig map from a compose file Dict the source Dict is not validated if directly used. Use Load() to enable validation
func Networks ¶
func Networks(namespace Namespace, networks networkMap, servicesNetworks map[string]struct{}) (map[string]types.NetworkCreate, []string)
Networks from the compose-file type to the engine API type
func ParseConfigs ¶
func ParseConfigs(client client.ConfigAPIClient, requestedConfigs []*swarm.ConfigReference) ([]*swarm.ConfigReference, error)
ParseConfigs retrieves the configs from the requested names and converts them to config references to use with the spec
func ParseEnvFile ¶
ParseEnvFile reads a file with environment variables enumerated by lines
“Environment variable names used by the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore) from the characters defined in Portable Character Set and do not begin with a digit. *But*, other characters may be permitted by an implementation; applications shall tolerate the presence of such names.” -- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
As of #16585, it's up to application inside docker to validate or not environment variables, that's why we just strip leading whitespace and nothing more.
func ParseRestartPolicy ¶
func ParseRestartPolicy(policy string) (container.RestartPolicy, error)
ParseRestartPolicy returns the parsed policy or an error indicating what is incorrect
func ParseSecrets ¶
func ParseSecrets(client *client.Client, requestedSecrets []*swarm.SecretReference) ([]*swarm.SecretReference, error)
ParseSecrets retrieves the secrets with the requested names and fills secret IDs into the secret references.
func ParseVolume ¶
func ParseVolume(spec string) (types.ServiceVolumeConfig, error)
ParseVolume parses a volume spec without any knowledge of the target platform
func ParseYAML ¶
ParseYAML reads the bytes from a file, parses the bytes into a mapping structure, and returns it.
func Secrets ¶
func Secrets(namespace Namespace, secrets map[string]composetypes.SecretConfig) ([]swarm.SecretSpec, error)
Secrets converts secrets from the Compose type to the engine API type
func Service ¶
func Service( apiVersion string, namespace Namespace, service composetypes.ServiceConfig, networkConfigs map[string]composetypes.NetworkConfig, volumes map[string]composetypes.VolumeConfig, secrets []*swarm.SecretReference, configs []*swarm.ConfigReference, ) (swarm.ServiceSpec, error)
Service converts a ServiceConfig into a swarm ServiceSpec
func Services ¶
func Services( namespace Namespace, config *composetypes.Config, client *client.Client, ) (map[string]swarm.ServiceSpec, error)
Services from compose-file types to engine API types
func Transform ¶ added in v0.8.6
func Transform(source interface{}, target interface{}, additionalTransformers ...Transformer) error
Transform converts the source into the target struct with compose types transformer and the specified transformers if any.
func Volumes ¶
func Volumes(serviceVolumes []composetypes.ServiceVolumeConfig, stackVolumes volumes, namespace Namespace) ([]mount.Mount, error)
Volumes from compose-file types to engine api types
Types ¶
type ErrBadEnvVariable ¶
type ErrBadEnvVariable struct {
// contains filtered or unexported fields
}
ErrBadEnvVariable typed error for bad environment variable
func (ErrBadEnvVariable) Error ¶
func (e ErrBadEnvVariable) Error() string
type ForbiddenPropertiesError ¶
ForbiddenPropertiesError is returned when there are properties in the Compose file that are forbidden.
func (*ForbiddenPropertiesError) Error ¶
func (e *ForbiddenPropertiesError) Error() string
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
type Options ¶ added in v0.8.6
type Options struct { // Skip schema validation SkipValidation bool // Skip interpolation SkipInterpolation bool // Interpolation options Interpolate *interp.Options }
Options supported by Load
type PortOpt ¶
type PortOpt struct {
// contains filtered or unexported fields
}
PortOpt represents a port config in swarm mode.
type Transformer ¶ added in v0.8.6
Transformer defines a map to type transformer