mirror of https://github.com/docker/cli.git
Add more example to the full-example tests
Configs and Secrets were note present, some labels on volumes and networks too. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
31d99ba630
commit
55426d9396
|
@ -29,6 +29,14 @@ services:
|
||||||
command: bundle exec thin -p 3000
|
command: bundle exec thin -p 3000
|
||||||
# command: ["bundle", "exec", "thin", "-p", "3000"]
|
# command: ["bundle", "exec", "thin", "-p", "3000"]
|
||||||
|
|
||||||
|
configs:
|
||||||
|
- config1
|
||||||
|
- source: config2
|
||||||
|
target: /my_config
|
||||||
|
uid: '103'
|
||||||
|
gid: '103'
|
||||||
|
mode: 0440
|
||||||
|
|
||||||
container_name: my-web-container
|
container_name: my-web-container
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -213,6 +221,14 @@ services:
|
||||||
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
- secret1
|
||||||
|
- source: secret2
|
||||||
|
target: my_secret
|
||||||
|
uid: '103'
|
||||||
|
gid: '103'
|
||||||
|
mode: 0440
|
||||||
|
|
||||||
security_opt:
|
security_opt:
|
||||||
- label=level:s0:c100,c200
|
- label=level:s0:c100,c200
|
||||||
- label=type:svirt_apache_t
|
- label=type:svirt_apache_t
|
||||||
|
@ -289,6 +305,9 @@ networks:
|
||||||
- subnet: 2001:3984:3989::/64
|
- subnet: 2001:3984:3989::/64
|
||||||
# gateway: 2001:3984:3989::1
|
# gateway: 2001:3984:3989::1
|
||||||
|
|
||||||
|
labels:
|
||||||
|
foo: bar
|
||||||
|
|
||||||
external-network:
|
external-network:
|
||||||
# Specifies that a pre-existing network called "external-network"
|
# Specifies that a pre-existing network called "external-network"
|
||||||
# can be referred to within this file as "external-network"
|
# can be referred to within this file as "external-network"
|
||||||
|
@ -313,6 +332,8 @@ volumes:
|
||||||
# Values can be strings or numbers
|
# Values can be strings or numbers
|
||||||
foo: "bar"
|
foo: "bar"
|
||||||
baz: 1
|
baz: 1
|
||||||
|
labels:
|
||||||
|
foo: bar
|
||||||
|
|
||||||
another-volume:
|
another-volume:
|
||||||
name: "user_specified_name"
|
name: "user_specified_name"
|
||||||
|
@ -340,3 +361,29 @@ volumes:
|
||||||
# can be referred to within this file as "external-volume3"
|
# can be referred to within this file as "external-volume3"
|
||||||
name: this-is-volume3
|
name: this-is-volume3
|
||||||
external: true
|
external: true
|
||||||
|
|
||||||
|
configs:
|
||||||
|
config1:
|
||||||
|
file: ./config_data
|
||||||
|
labels:
|
||||||
|
foo: bar
|
||||||
|
config2:
|
||||||
|
external:
|
||||||
|
name: my_config
|
||||||
|
config3:
|
||||||
|
external: true
|
||||||
|
config4:
|
||||||
|
name: foo
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
secret1:
|
||||||
|
file: ./secret_data
|
||||||
|
labels:
|
||||||
|
foo: bar
|
||||||
|
secret2:
|
||||||
|
external:
|
||||||
|
name: my_secret
|
||||||
|
secret3:
|
||||||
|
external: true
|
||||||
|
secret4:
|
||||||
|
name: bar
|
||||||
|
|
|
@ -14,6 +14,8 @@ func fullExampleConfig(workingDir, homeDir string) *types.Config {
|
||||||
Services: services(workingDir, homeDir),
|
Services: services(workingDir, homeDir),
|
||||||
Networks: networks(),
|
Networks: networks(),
|
||||||
Volumes: volumes(),
|
Volumes: volumes(),
|
||||||
|
Configs: configs(),
|
||||||
|
Secrets: secrets(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +37,18 @@ func services(workingDir, homeDir string) []types.ServiceConfig {
|
||||||
CapDrop: []string{"NET_ADMIN", "SYS_ADMIN"},
|
CapDrop: []string{"NET_ADMIN", "SYS_ADMIN"},
|
||||||
CgroupParent: "m-executor-abcd",
|
CgroupParent: "m-executor-abcd",
|
||||||
Command: []string{"bundle", "exec", "thin", "-p", "3000"},
|
Command: []string{"bundle", "exec", "thin", "-p", "3000"},
|
||||||
|
Configs: []types.ServiceConfigObjConfig{
|
||||||
|
{
|
||||||
|
Source: "config1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Source: "config2",
|
||||||
|
Target: "/my_config",
|
||||||
|
UID: "103",
|
||||||
|
GID: "103",
|
||||||
|
Mode: uint32Ptr(0440),
|
||||||
|
},
|
||||||
|
},
|
||||||
ContainerName: "my-web-container",
|
ContainerName: "my-web-container",
|
||||||
DependsOn: []string{"db", "redis"},
|
DependsOn: []string{"db", "redis"},
|
||||||
Deploy: types.DeployConfig{
|
Deploy: types.DeployConfig{
|
||||||
|
@ -300,6 +314,18 @@ func services(workingDir, homeDir string) []types.ServiceConfig {
|
||||||
Privileged: true,
|
Privileged: true,
|
||||||
ReadOnly: true,
|
ReadOnly: true,
|
||||||
Restart: "always",
|
Restart: "always",
|
||||||
|
Secrets: []types.ServiceSecretConfig{
|
||||||
|
{
|
||||||
|
Source: "secret1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Source: "secret2",
|
||||||
|
Target: "my_secret",
|
||||||
|
UID: "103",
|
||||||
|
GID: "103",
|
||||||
|
Mode: uint32Ptr(0440),
|
||||||
|
},
|
||||||
|
},
|
||||||
SecurityOpt: []string{
|
SecurityOpt: []string{
|
||||||
"label=level:s0:c100,c200",
|
"label=level:s0:c100,c200",
|
||||||
"label=type:svirt_apache_t",
|
"label=type:svirt_apache_t",
|
||||||
|
@ -353,6 +379,9 @@ func networks() map[string]types.NetworkConfig {
|
||||||
{Subnet: "2001:3984:3989::/64"},
|
{Subnet: "2001:3984:3989::/64"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Labels: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"external-network": {
|
"external-network": {
|
||||||
|
@ -376,6 +405,9 @@ func volumes() map[string]types.VolumeConfig {
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
"baz": "1",
|
"baz": "1",
|
||||||
},
|
},
|
||||||
|
Labels: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"another-volume": {
|
"another-volume": {
|
||||||
Name: "user_specified_name",
|
Name: "user_specified_name",
|
||||||
|
@ -400,6 +432,48 @@ func volumes() map[string]types.VolumeConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func configs() map[string]types.ConfigObjConfig {
|
||||||
|
return map[string]types.ConfigObjConfig{
|
||||||
|
"config1": {
|
||||||
|
File: "./config_data",
|
||||||
|
Labels: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"config2": {
|
||||||
|
Name: "my_config",
|
||||||
|
External: types.External{External: true},
|
||||||
|
},
|
||||||
|
"config3": {
|
||||||
|
External: types.External{External: true},
|
||||||
|
},
|
||||||
|
"config4": {
|
||||||
|
Name: "foo",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func secrets() map[string]types.SecretConfig {
|
||||||
|
return map[string]types.SecretConfig{
|
||||||
|
"secret1": {
|
||||||
|
File: "./secret_data",
|
||||||
|
Labels: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"secret2": {
|
||||||
|
Name: "my_secret",
|
||||||
|
External: types.External{External: true},
|
||||||
|
},
|
||||||
|
"secret3": {
|
||||||
|
External: types.External{External: true},
|
||||||
|
},
|
||||||
|
"secret4": {
|
||||||
|
Name: "bar",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func fullExampleYAML(workingDir string) string {
|
func fullExampleYAML(workingDir string) string {
|
||||||
return fmt.Sprintf(`version: "3.7"
|
return fmt.Sprintf(`version: "3.7"
|
||||||
services:
|
services:
|
||||||
|
@ -428,6 +502,13 @@ services:
|
||||||
- thin
|
- thin
|
||||||
- -p
|
- -p
|
||||||
- "3000"
|
- "3000"
|
||||||
|
configs:
|
||||||
|
- source: config1
|
||||||
|
- source: config2
|
||||||
|
target: /my_config
|
||||||
|
uid: "103"
|
||||||
|
gid: "103"
|
||||||
|
mode: 288
|
||||||
container_name: my-web-container
|
container_name: my-web-container
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
@ -628,6 +709,13 @@ services:
|
||||||
privileged: true
|
privileged: true
|
||||||
read_only: true
|
read_only: true
|
||||||
restart: always
|
restart: always
|
||||||
|
secrets:
|
||||||
|
- source: secret1
|
||||||
|
- source: secret2
|
||||||
|
target: my_secret
|
||||||
|
uid: "103"
|
||||||
|
gid: "103"
|
||||||
|
mode: 288
|
||||||
security_opt:
|
security_opt:
|
||||||
- label=level:s0:c100,c200
|
- label=level:s0:c100,c200
|
||||||
- label=type:svirt_apache_t
|
- label=type:svirt_apache_t
|
||||||
|
@ -689,6 +777,8 @@ networks:
|
||||||
config:
|
config:
|
||||||
- subnet: 172.16.238.0/24
|
- subnet: 172.16.238.0/24
|
||||||
- subnet: 2001:3984:3989::/64
|
- subnet: 2001:3984:3989::/64
|
||||||
|
labels:
|
||||||
|
foo: bar
|
||||||
some-network: {}
|
some-network: {}
|
||||||
volumes:
|
volumes:
|
||||||
another-volume:
|
another-volume:
|
||||||
|
@ -711,8 +801,32 @@ volumes:
|
||||||
driver_opts:
|
driver_opts:
|
||||||
baz: "1"
|
baz: "1"
|
||||||
foo: bar
|
foo: bar
|
||||||
|
labels:
|
||||||
|
foo: bar
|
||||||
some-volume: {}
|
some-volume: {}
|
||||||
secrets: {}
|
secrets:
|
||||||
configs: {}
|
secret1:
|
||||||
|
file: ./secret_data
|
||||||
|
labels:
|
||||||
|
foo: bar
|
||||||
|
secret2:
|
||||||
|
name: my_secret
|
||||||
|
external: true
|
||||||
|
secret3:
|
||||||
|
external: true
|
||||||
|
secret4:
|
||||||
|
name: bar
|
||||||
|
configs:
|
||||||
|
config1:
|
||||||
|
file: ./config_data
|
||||||
|
labels:
|
||||||
|
foo: bar
|
||||||
|
config2:
|
||||||
|
name: my_config
|
||||||
|
external: true
|
||||||
|
config3:
|
||||||
|
external: true
|
||||||
|
config4:
|
||||||
|
name: foo
|
||||||
`, filepath.Join(workingDir, "static"), filepath.Join(workingDir, "opt"))
|
`, filepath.Join(workingDir, "static"), filepath.Join(workingDir, "opt"))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue