1package swarm
2
3import (
4	"time"
5
6	"github.com/docker/docker/api/types/container"
7	"github.com/docker/docker/api/types/mount"
8)
9
10// DNSConfig specifies DNS related configurations in resolver configuration file (resolv.conf)
11// Detailed documentation is available in:
12// http://man7.org/linux/man-pages/man5/resolv.conf.5.html
13// `nameserver`, `search`, `options` have been supported.
14// TODO: `domain` is not supported yet.
15type DNSConfig struct {
16	// Nameservers specifies the IP addresses of the name servers
17	Nameservers []string `json:",omitempty"`
18	// Search specifies the search list for host-name lookup
19	Search []string `json:",omitempty"`
20	// Options allows certain internal resolver variables to be modified
21	Options []string `json:",omitempty"`
22}
23
24// SELinuxContext contains the SELinux labels of the container.
25type SELinuxContext struct {
26	Disable bool
27
28	User  string
29	Role  string
30	Type  string
31	Level string
32}
33
34// CredentialSpec for managed service account (Windows only)
35type CredentialSpec struct {
36	File     string
37	Registry string
38}
39
40// Privileges defines the security options for the container.
41type Privileges struct {
42	CredentialSpec *CredentialSpec
43	SELinuxContext *SELinuxContext
44}
45
46// ContainerSpec represents the spec of a container.
47type ContainerSpec struct {
48	Image           string                  `json:",omitempty"`
49	Labels          map[string]string       `json:",omitempty"`
50	Command         []string                `json:",omitempty"`
51	Args            []string                `json:",omitempty"`
52	Hostname        string                  `json:",omitempty"`
53	Env             []string                `json:",omitempty"`
54	Dir             string                  `json:",omitempty"`
55	User            string                  `json:",omitempty"`
56	Groups          []string                `json:",omitempty"`
57	Privileges      *Privileges             `json:",omitempty"`
58	StopSignal      string                  `json:",omitempty"`
59	TTY             bool                    `json:",omitempty"`
60	OpenStdin       bool                    `json:",omitempty"`
61	ReadOnly        bool                    `json:",omitempty"`
62	Mounts          []mount.Mount           `json:",omitempty"`
63	StopGracePeriod *time.Duration          `json:",omitempty"`
64	Healthcheck     *container.HealthConfig `json:",omitempty"`
65	// The format of extra hosts on swarmkit is specified in:
66	// http://man7.org/linux/man-pages/man5/hosts.5.html
67	//    IP_address canonical_hostname [aliases...]
68	Hosts     []string           `json:",omitempty"`
69	DNSConfig *DNSConfig         `json:",omitempty"`
70	Secrets   []*SecretReference `json:",omitempty"`
71	Configs   []*ConfigReference `json:",omitempty"`
72}
73