diff --git a/cli/command/service/create.go b/cli/command/service/create.go index 6e19f8b748..299cdc383f 100644 --- a/cli/command/service/create.go +++ b/cli/command/service/create.go @@ -77,8 +77,6 @@ func runCreate(dockerCli command.Cli, flags *pflag.FlagSet, opts *serviceOptions return err } - fmt.Printf("%v\n", service.TaskTemplate.Resources) - specifiedSecrets := opts.secrets.Value() if len(specifiedSecrets) > 0 { // parse and validate secrets diff --git a/cli/compose/convert/service.go b/cli/compose/convert/service.go index 3c9a6a661a..e58c241c22 100644 --- a/cli/compose/convert/service.go +++ b/cli/compose/convert/service.go @@ -510,9 +510,25 @@ func convertResources(source composetypes.Resources) (*swarm.ResourceRequirement return nil, err } } + + var generic []swarm.GenericResource + for _, res := range source.Reservations.GenericResources { + var r swarm.GenericResource + + if res.DiscreteResourceSpec != nil { + r.DiscreteResourceSpec = &swarm.DiscreteGenericResource{ + Kind: res.DiscreteResourceSpec.Kind, + Value: res.DiscreteResourceSpec.Value, + } + } + + generic = append(generic, r) + } + resources.Reservations = &swarm.Resources{ - NanoCPUs: cpus, - MemoryBytes: int64(source.Reservations.MemoryBytes), + NanoCPUs: cpus, + MemoryBytes: int64(source.Reservations.MemoryBytes), + GenericResources: generic, } } return resources, nil diff --git a/cli/compose/loader/full-example.yml b/cli/compose/loader/full-example.yml index aefb56869e..0a52111c32 100644 --- a/cli/compose/loader/full-example.yml +++ b/cli/compose/loader/full-example.yml @@ -1,4 +1,4 @@ -version: "3.4" +version: "3.5" services: foo: @@ -16,7 +16,6 @@ services: labels: [FOO=BAR] - cap_add: - ALL @@ -54,6 +53,13 @@ services: reservations: cpus: '0.0001' memory: 20M + generic_resources: + - discrete_resource_spec: + kind: 'gpu' + value: 2 + - discrete_resource_spec: + kind: 'ssd' + value: 1 restart_policy: condition: on-failure delay: 5s diff --git a/cli/compose/loader/loader_test.go b/cli/compose/loader/loader_test.go index e56202d86c..d609311abc 100644 --- a/cli/compose/loader/loader_test.go +++ b/cli/compose/loader/loader_test.go @@ -879,6 +879,20 @@ func TestFullExample(t *testing.T) { Reservations: &types.Resource{ NanoCPUs: "0.0001", MemoryBytes: 20 * 1024 * 1024, + GenericResources: []types.GenericResource{ + { + DiscreteResourceSpec: &types.DiscreteGenericResource{ + Kind: "gpu", + Value: 2, + }, + }, + { + DiscreteResourceSpec: &types.DiscreteGenericResource{ + Kind: "ssd", + Value: 1, + }, + }, + }, }, }, RestartPolicy: &types.RestartPolicy{ diff --git a/cli/compose/schema/bindata.go b/cli/compose/schema/bindata.go index da71abb1a7..e234c2cddd 100644 --- a/cli/compose/schema/bindata.go +++ b/cli/compose/schema/bindata.go @@ -173,7 +173,7 @@ func dataConfig_schema_v34Json() (*asset, error) { return a, nil } -var _dataConfig_schema_v35Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x1b\x4b\x73\xdb\xbc\xf1\xae\x5f\xc1\xe1\xf7\xdd\x22\xd9\x99\x69\xda\x99\xe6\xd6\x63\x4f\xed\xb9\x1e\x85\x03\x81\x2b\x09\x31\x08\x20\x0b\x50\xb6\x92\xf1\x7f\xef\xf0\x29\x90\x04\x09\x50\xa2\x63\xa7\xcd\xc9\x16\xb9\xbb\xc0\xbe\x1f\x00\x7f\xac\xa2\x28\xfe\x53\xd3\x23\x64\x24\xfe\x1c\xc5\x47\x63\xd4\xe7\xfb\xfb\xaf\x5a\x8a\x4d\xf5\xf4\x4e\xe2\xe1\x3e\x45\xb2\x37\x9b\x8f\x9f\xee\xab\x67\x7f\xc4\xeb\x02\x8f\xa5\x05\x0a\x95\x62\xcf\x0e\x49\xf5\x26\x39\xfd\xe5\xee\xaf\x77\x05\x7a\x05\x62\xce\x0a\x0a\x20\xb9\xfb\x0a\xd4\x54\xcf\x10\xbe\xe5\x0c\xa1\x40\x7e\x88\x4f\x80\x9a\x49\x11\x6f\xd7\xab\xe2\x9d\x42\xa9\x00\x0d\x03\x1d\x7f\x8e\x8a\xcd\x45\x51\x0b\xd2\x3c\xb0\xc8\x6a\x83\x4c\x1c\xe2\xf2\xf1\x4b\x49\x21\x8a\x62\x0d\x78\x62\xd4\xa2\xd0\x6e\xf5\x8f\xfb\x0b\xfd\xfb\x16\x6c\xdd\xa7\x6a\x6d\xb6\x7c\xae\x88\x31\x80\xe2\xdf\xc3\xbd\x95\xaf\xbf\x3c\x90\xcd\xf7\x7f\x6c\xfe\xf3\x71\xf3\xf7\xbb\x64\xb3\xfd\xf0\x67\xe7\x75\x21\x5f\x84\x7d\xb5\x7c\x0a\x7b\x26\x98\x61\x52\xb4\xeb\xc7\x2d\xe4\x4b\xfd\xdf\x4b\xbb\x30\x49\xd3\x12\x98\xf0\xce\xda\x7b\xc2\x35\x74\x79\x16\x60\x9e\x24\x3e\xfa\x78\x6e\xc1\xde\x88\xe7\x7a\x7d\x07\xcf\x5d\x76\x4e\x92\xe7\x99\x57\x83\x0d\xd4\x1b\x31\x53\x2d\xbf\x8c\xfe\x34\x50\x04\xe3\x37\xd9\x0a\xea\xcd\x2c\xb6\x58\x7e\x19\x86\xab\xa8\xe1\x63\xb8\x81\x7a\x23\x86\xab\xe5\x6f\x63\x78\xd5\x30\xed\xde\x63\xfc\xe5\x79\x53\xfc\x7d\x29\x69\x4e\xd2\xab\xa8\x58\xfb\x2b\x99\xe8\xc4\x3c\x97\x38\x5d\x31\x67\x5c\x9e\xad\x40\x47\x24\x99\x82\xe2\xf2\x5c\xee\xdc\x2d\xb3\x0a\x20\x03\x61\xe2\x56\x4c\x51\x14\xef\x72\xc6\xd3\xbe\xd4\xa5\x80\x7f\x15\x24\x1e\xac\x87\x51\xf4\xa3\x1f\xde\x2d\x3a\xe5\xfb\xce\xaf\x71\xa3\x68\xdf\x8f\xf0\xd2\xbe\xa7\x52\x18\x78\x36\x25\x53\xd3\x4b\x57\x22\x90\xf4\x11\x70\xcf\x38\x84\x62\x10\xac\x2c\x7d\x44\x64\x9c\x69\x93\x48\x4c\x52\x46\x8d\x13\x9f\x93\x1d\xf0\x9b\x28\x50\x42\x8f\x90\xec\x51\x66\x5e\x2a\xfb\xa4\xe2\x44\x3b\x09\x35\x11\x3c\x90\x73\x43\xf0\x00\x6e\xc9\xf6\x80\x07\xd8\x7e\xdf\x6a\x51\xad\x5f\xdb\x95\x83\x60\x4c\x89\x4a\x48\x9a\x76\xf6\x41\x10\xc9\x39\x5e\x47\x31\x33\x90\x69\x37\x43\x51\x9c\x0b\xf6\x2d\x87\x7f\xd6\x20\x06\x73\xe8\xd3\x4d\x51\xaa\xe5\x09\x1f\x50\xe6\x2a\x51\x04\x0b\x47\x9a\x16\x76\x4c\x65\x96\x11\xb1\x94\x77\xcd\xe1\x23\x40\xf2\x83\x38\x1f\xd9\x2e\x5b\xaf\x61\xbf\x6a\x57\xeb\x6c\x6b\x84\x1b\x3f\x3f\xc3\x78\xe1\x8f\x18\xfe\x98\x51\x84\x5c\x99\x23\x0d\x0d\x01\xd3\xae\xe0\x84\xcf\x59\x1a\x0e\x7c\x98\x03\x9c\xc9\xb4\xbb\x6f\x91\x67\x3b\xc0\x81\x4b\x76\x3d\x6b\xf8\x7b\xbb\x72\xbd\xe9\x69\xdf\x10\x26\x00\x13\x41\x32\x9f\xac\x62\x8a\x90\x82\x30\x8c\xf0\x44\x2b\xa0\x1d\xf0\x46\x53\x13\x9a\x89\x83\x42\x72\x8c\x70\x60\xda\xe0\x79\x3a\x28\xbd\xd8\x1b\x4b\x41\x81\x48\x75\x52\x35\x21\xf3\xa3\x67\x9c\x42\xdb\x91\x2c\x1a\x26\x52\x31\x95\x15\x2a\x32\x45\x5e\x28\xf6\x16\xf7\x10\x13\x0d\x04\xe9\xf1\x4a\x7c\x99\x11\x26\x42\x94\x0a\xc2\xe0\x59\x49\x56\x85\xb1\x77\x17\x9f\x40\x9c\x92\xd6\x6e\x66\x8b\x01\xc4\x89\xa1\x14\x59\x13\xa4\xc3\xb2\xb3\x85\xff\xac\xa4\x86\xdb\x83\x63\x8d\xf1\xd0\x30\xbe\x6e\x7d\x7a\xdb\x95\x5e\xbc\x97\x98\x91\x62\xb3\xcd\xda\xb6\x0f\x77\x96\x1a\x5a\x9e\x2d\x40\x9b\x87\xa2\xaa\x25\x3c\xe1\x4c\x3c\x2e\x6f\xe2\xf0\x6c\x90\x24\x47\xa9\xcd\x35\x05\x50\x7c\x04\xc2\xcd\x91\x1e\x81\x3e\x4e\xa0\xdb\x50\x1d\x6c\xa9\x4d\x88\x91\xb3\x8c\x1c\xfc\x40\x8a\x7a\x41\xb4\xe4\xc4\xd4\xc3\x8e\x29\xc0\xab\x2b\xc2\x78\x51\x2d\x59\x64\xe5\xe1\x50\x80\x8e\x99\xe6\xa0\xc3\xa8\x5f\xfb\x6a\xf3\x14\xd9\x09\x30\xb4\xdc\x94\xea\xd2\x18\xf5\x5f\x86\xa4\x7d\x6f\x27\xd9\x01\xfd\x72\x57\x35\x92\x13\xee\x57\xfe\xc7\x79\xbc\x1d\xe6\xd6\x61\x76\xed\x3f\xe9\x71\x18\x56\x10\x77\xb4\x92\x11\x5a\xd4\xbd\x08\x7a\x44\xaf\x17\xd0\xba\xb0\x4f\x06\xc5\xc1\x05\x76\x00\x3c\xc8\xc0\x63\x21\xfd\xaa\x7e\x63\x7e\x9f\x17\xa4\x3a\xef\x30\xc0\xc3\xcd\xd8\xf6\x42\xb7\x79\xd9\xae\xdf\xc4\x4a\x38\xc2\x19\xd1\xe0\x77\xf6\xc9\xc6\xad\xa5\xc6\xd4\xe9\x53\xa0\x4d\xb8\x70\xff\x36\x89\x3b\x82\x3a\x4a\x33\xbc\xc7\xf3\x90\xb2\x6b\x59\xce\x9d\x1b\xd9\xfa\xab\xdb\xd7\x6c\x41\x55\xb7\x42\xef\xc6\x8a\x32\x42\xd8\x0e\xa6\x24\x9a\x9f\xd2\x34\x5d\xe2\xd4\xa5\x32\xa8\x16\x1f\xf6\x51\x7d\x75\x07\x21\xbd\x4e\xf3\x35\x11\xa5\x1c\xd0\x8e\xd6\x8b\x09\x03\x87\xa2\xe7\x71\x27\x81\x7c\xc7\x99\x3e\x42\x3a\x07\x07\xa5\x91\x54\xf2\x30\xc7\x70\x8e\x89\xc2\x9d\x61\xa2\x11\xbb\xaa\x88\x53\xc8\x4e\x8c\xc3\xa1\xc7\xf1\x4e\x4a\x0e\x44\x74\x12\x05\x02\x49\x13\x29\xf8\x39\x00\x52\x1b\x82\xde\xf1\x85\x06\x9a\x23\x33\xe7\x44\x2a\xb3\x78\xf9\xa8\x8f\x59\xa2\xd9\x77\xe8\xfa\xde\xc5\xea\x6b\x42\xdb\xde\x86\x7a\xc3\xf8\xe8\xf7\xcc\xe2\xff\x66\x66\xa1\xcf\x9a\x9a\xeb\x6a\x6b\x6d\x52\x26\x12\xa9\x40\x78\x7d\x43\x1b\xa9\x92\x03\x12\x0a\x89\x02\x64\xd2\x29\x8a\x4e\x80\x4d\x73\xac\x5a\x83\x01\x19\xcd\x0e\x82\xb8\xe3\x8e\x05\x6a\x32\xb5\xbf\x72\x5a\x60\x8c\xdf\xd9\x73\xce\x32\x36\xee\x34\x0e\xab\x0d\xa8\xd7\xaa\x5a\xcd\x5d\xa2\x4d\x94\x67\x41\x21\x7b\xa2\x43\x98\x6e\x10\x02\x3a\x83\x23\xc1\x19\xa9\xa3\x74\xcc\xfd\x48\x7e\x72\xf5\x0d\xce\x7d\x75\x8e\xd5\x4b\x7a\xeb\x7a\x23\x5b\x27\xfc\xac\xd2\xab\xbf\x8d\xed\x68\xf5\xe3\x76\xaa\x5c\x7b\x9b\xb8\x12\x46\xe8\xa9\x06\xa4\x05\x1d\x9e\x0f\x47\xbf\x44\x84\xee\xe8\xa8\x04\x77\xe8\x26\x20\x8e\xd7\x2b\x05\xc6\xce\xd7\x8e\xfa\xc1\x15\x81\x85\x43\xa5\xd0\x4c\x1b\x10\xd4\x3d\x88\x75\x22\xed\xd8\xe0\x94\x63\x28\x94\xe9\xbe\x2b\xac\xeb\x2a\xa1\xc8\x61\x7c\x14\xe3\xee\x4d\x82\x7d\xb5\xbe\x3a\xf0\x53\x58\x11\x92\x4a\x35\xa2\x9a\x70\x36\xe6\xa6\xd9\xde\xe8\x62\xa2\x0e\x1d\x0b\x19\x4f\x12\x1f\x8b\x84\x94\x32\x77\xe4\x58\xf5\x50\x66\x5c\x3e\xe8\x0d\x05\x1b\x02\xae\x13\x73\x1b\xd4\x7b\x0b\x61\xfa\xf4\xbe\x06\x1a\x3d\x59\x67\x9a\xec\x7a\x07\x18\xae\x44\x5b\x64\x06\x3c\xb9\xf3\xbd\xbf\x60\x40\x30\xc8\x7a\x27\x11\x4d\x29\x65\x67\x7c\xd0\xef\x73\x5e\x6f\x58\x06\x32\x77\x06\xa7\x90\x6a\x89\xa0\x99\x5f\x6f\xad\x6c\x33\xad\xe9\xc5\xd6\x3d\x07\x8f\x09\x59\x90\x7d\x0b\x7a\xb0\xce\xb5\xaa\x29\x80\xd7\x4c\x42\xd2\x23\x88\xb4\x3c\x71\x09\xca\xa5\x08\x8a\x33\x4a\xb4\xaf\x5e\xb9\x61\xe6\x9c\xab\x94\x18\x48\xea\xeb\x34\x73\x2a\xc4\x89\xd2\x50\x11\x24\x9c\x03\x67\x3a\x0b\x29\xb5\xe2\x14\x38\x71\xe6\x1a\xaf\xdd\x94\xe8\x7b\xc2\x78\x8e\x90\x10\x1a\x30\x9f\xaf\x35\x25\x98\x91\xce\xe0\x15\xb6\x64\x46\x9e\x93\x66\xd9\x12\xc4\xe3\xb5\x25\x92\xc4\xd4\x5d\x6a\xad\x0b\xbb\xc8\x33\x47\xb1\x53\xf9\xc5\x66\xcf\x50\x9b\xaa\x27\x96\xaa\xfe\xd5\x0d\xea\x2f\xa3\x73\x86\xd0\xd1\xb4\x65\x75\x55\x55\x32\xaf\x61\x98\x30\x87\x4b\xfb\x31\x62\x9d\xcd\x8a\x03\x89\x21\xe8\x22\xa0\xb6\x27\x07\x5e\xfc\x45\xa5\x50\x85\x24\xc9\x59\x55\x08\x2d\x21\x0a\x2a\x45\xb5\x8f\x10\x2b\xbd\xd1\x2d\x0a\x1b\x2d\xda\xb8\x4c\x19\x6f\x04\x29\x11\x9e\x98\x48\xe5\xd3\xfc\xe8\xbb\x80\xb4\x15\x27\x14\x7a\x11\xfb\x56\x41\x6b\x83\x84\x09\x33\xfb\x44\xad\x2f\x16\x85\xb0\x07\x04\x31\xf4\x88\x68\xba\xb3\x89\xc6\xbb\x1b\x1f\x6f\x7e\x0e\x6b\x08\xad\x8a\x12\xff\x0d\x06\x9b\xb7\x2a\xff\x86\x1a\xb1\x75\x77\x4f\x76\x6f\xe1\xbc\xd5\xe1\x58\x46\xa7\x2a\xf7\x9e\xce\x65\x90\xc9\xe9\x2b\x2b\x37\xdc\x1a\xf7\xb1\xd8\x80\x2d\x50\xbd\x04\x1d\xe7\xd6\x50\x89\x54\xcb\xcf\x93\xfc\x47\xb6\x5b\xff\x34\x83\x29\x92\x2d\x15\x43\x82\x0f\xb8\x63\x67\xf9\x14\xbd\x83\xe8\x90\xef\x44\xd8\x1d\xcf\x77\x16\x1d\xec\x8a\xb9\xbe\xc4\x32\xa2\xd5\x87\xb6\x13\x5b\xb7\xb2\xda\x06\xab\x78\xf4\x06\xc9\x72\xfb\x2f\x9b\xc2\xfe\x10\xd8\xd5\x3d\x12\x63\x08\x3d\x06\x35\x9a\x33\xeb\xfd\x1b\xe2\xd0\x60\x1c\xe2\x0c\x43\x35\xd4\x02\x51\x28\xe4\x4a\xcf\xff\x46\xa4\xfa\xd5\xed\xfa\xe7\xd9\x60\xfd\x71\x8b\xf7\x03\x8a\x12\xea\xea\x5c\x1f\x62\x79\x01\xd7\x58\xdf\x81\x5e\xdf\x58\x5d\x83\x64\xe8\x54\x57\x0d\xf5\x5b\x5d\x6f\xad\xae\xde\xe1\xa2\xa5\xb6\xe1\x54\x71\x4a\x92\xc1\x37\xa0\x6a\x8c\x6d\x77\x1b\x7d\x30\xc7\x27\xa5\xdd\x1a\x6a\xea\xea\x41\x03\x32\x32\xdb\xee\x2d\x5a\x0b\x71\x9a\xf3\x05\xf3\xc7\xdd\x87\x89\x4a\x71\xea\xa6\xe2\x2b\x95\x58\x0b\x5c\xeb\x70\xeb\xb4\xd7\x84\x37\xd2\x1d\x7e\x11\x37\x1e\x23\x1a\xfc\xc1\xf7\x71\x05\x9f\xe2\x3c\x98\x7a\xff\xe8\x1e\xe4\x55\xdf\xb6\x6d\x3b\xf2\xe9\x81\x54\x17\x84\xad\x84\xbd\xb5\xe7\x12\xa3\x5f\x34\xb8\xbe\x9a\xeb\x1f\x23\x36\x5f\xaf\x8d\xdc\x6c\x58\xd9\x7f\xcb\xaf\x11\x57\x2f\xab\xff\x06\x00\x00\xff\xff\x9b\x23\x27\xbe\xf7\x3d\x00\x00") +var _dataConfig_schema_v35Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x1b\xc9\x72\xec\xb6\xf1\x3e\x5f\xc1\x82\x7d\xb3\x16\x57\xc5\x49\x55\xde\x2d\xc7\x9c\x92\x73\x54\xf3\x58\x18\xb0\x87\x03\x0b\x04\x60\x00\x1c\x69\xfc\x4a\xff\x9e\xe2\x2a\x90\xc4\x46\x0d\xf5\x24\x27\x3e\x49\x43\x76\x37\x7a\x43\x6f\x00\xbf\xed\xb2\x0c\xfd\xa8\xc9\x09\x2a\x8c\xbe\x64\xe8\x64\x8c\xfc\x72\x7f\xff\xab\x16\xfc\xb6\x7b\x7a\x27\x54\x79\x5f\x28\x7c\x34\xb7\x3f\xff\x72\xdf\x3d\xfb\x01\xdd\x34\x78\xb4\x68\x50\x88\xe0\x47\x5a\xe6\xdd\x9b\xfc\xfc\x97\xbb\xbf\xde\x35\xe8\x1d\x88\xb9\x48\x68\x80\xc4\xe1\x57\x20\xa6\x7b\xa6\xe0\xb7\x9a\x2a\x68\x90\x1f\xd0\x19\x94\xa6\x82\xa3\xfd\xcd\xae\x79\x27\x95\x90\xa0\x0c\x05\x8d\xbe\x64\x0d\x73\x59\x36\x82\x0c\x0f\x2c\xb2\xda\x28\xca\x4b\xd4\x3e\x7e\x69\x29\x64\x19\xd2\xa0\xce\x94\x58\x14\x46\x56\x7f\xb8\x7f\xa5\x7f\x3f\x82\xdd\xcc\xa9\x5a\xcc\xb6\xcf\x25\x36\x06\x14\xff\xf7\x92\xb7\xf6\xf5\xd7\x07\x7c\xfb\xfb\x3f\x6e\xff\xf3\xf3\xed\xdf\xef\xf2\xdb\xfd\x4f\x3f\x4e\x5e\x37\xfa\x55\x70\xec\x96\x2f\xe0\x48\x39\x35\x54\xf0\x71\x7d\x34\x42\xbe\xf4\xff\xbd\x8c\x0b\xe3\xa2\x68\x81\x31\x9b\xac\x7d\xc4\x4c\xc3\x54\x66\x0e\xe6\x49\xa8\xc7\x98\xcc\x23\xd8\x07\xc9\xdc\xaf\xef\x90\x79\x2a\xce\x59\xb0\xba\x8a\x5a\x70\x80\xfa\x20\x61\xba\xe5\xb7\xb1\x9f\x06\xa2\xc0\xc4\x5d\xb6\x83\xfa\x30\x8f\x6d\x96\xdf\x46\xe0\x2e\x6a\xc4\x04\x1e\xa0\x3e\x48\xe0\x6e\xf9\xeb\x04\xde\x0d\x42\xbb\x79\x44\x5f\x9f\x6f\x9b\xbf\x2f\x2d\xcd\x20\xbd\x8e\x8a\xc5\x5f\x2b\xc4\x24\xe6\xb9\xd4\xe9\x8a\x39\x7e\x7d\x8e\x0a\xf5\x68\xb2\x00\xc9\xc4\xa5\xe5\xdc\xad\xb3\x0e\xa0\x02\x6e\xd0\xa8\xa6\x2c\x43\x87\x9a\xb2\x62\xae\x75\xc1\xe1\x5f\x0d\x89\x07\xeb\x61\x96\x7d\x9b\x87\x77\x8b\x4e\xfb\x7e\xf2\xcb\xef\x14\xe3\x7b\x8f\x2c\xe3\x7b\x22\xb8\x81\x67\xd3\x0a\x15\x5e\xba\x53\x81\x20\x8f\xa0\x8e\x94\x41\x2a\x06\x56\x9d\xa7\x7b\x54\xc6\xa8\x36\xb9\x50\x79\x41\x89\x71\xe2\x33\x7c\x00\x76\x15\x05\x82\xc9\x09\xf2\xa3\x12\x55\x94\xca\x31\xef\x24\xd1\x4e\x42\x43\x04\x4f\x94\xdc\x60\x55\x82\x5b\xb3\x33\xe0\x05\x76\x7c\x6f\x8d\xa8\xd6\xaf\xfd\xce\x41\x10\x11\x2c\x73\x5c\x14\x13\x3e\xb0\x52\xf8\x82\x6e\x32\x44\x0d\x54\xda\x2d\x50\x86\x6a\x4e\x7f\xab\xe1\x9f\x3d\x88\x51\x35\xcc\xe9\x16\x4a\xc8\xed\x09\x97\x4a\xd4\x32\x97\x58\x35\x1b\x29\xac\x6c\x44\x44\x55\x61\xbe\xd5\xee\x5a\x23\x47\x82\xe6\x17\x71\x3e\xb3\xb7\x6c\xbf\x86\xfd\x6a\x5c\x6d\xc2\x96\x47\x9a\xb8\x3c\xcb\x78\x11\x8f\x18\xf1\x98\xd1\x84\x5c\x51\x2b\x92\x1a\x02\xc2\x5b\xc1\x09\x5f\xd3\x22\x1d\xb8\x5c\x03\x5c\x89\x62\xca\x37\xaf\xab\x03\xa8\xc5\x96\x9c\xee\xac\xe5\xef\xfd\xce\xf5\x66\x66\x7d\x83\x29\x07\x95\x73\x5c\xc5\x74\x85\x88\x82\x02\xb8\xa1\x98\xe5\x5a\x02\x99\x80\x0f\x96\x0a\x58\x06\x25\x85\x64\xa4\xa0\xa4\xda\xa8\x4b\x38\x28\xbd\xd8\x8c\x15\x20\x81\x17\x3a\xef\x9a\x90\xf5\xd1\x13\x15\x30\x76\x24\x9b\x86\x89\x82\x87\xb2\x42\x47\xa6\xc9\x0b\x0d\x6f\x68\x86\x98\x6b\xc0\x8a\x9c\xde\x88\x2f\x2a\x4c\x79\x8a\x51\x81\x1b\x75\x91\x82\x76\x61\xec\xd3\xc5\x27\xe0\xe7\x7c\xf4\x9b\xd5\x6a\x00\x7e\xa6\x4a\xf0\x6a\x08\xd2\x69\xd9\xd9\xc2\x7f\x96\x42\xc3\xf5\xc1\xb1\xc7\x78\x18\x04\xbf\x19\xf7\xf4\x7e\xaa\x3d\x74\x14\xaa\xc2\x0d\xb3\xc3\xda\xf6\x1e\x9e\x2c\xb5\xf4\x3c\x5b\x81\xb6\x0c\x4d\x55\x8b\x59\xce\x28\x7f\xdc\xde\xc5\xe1\xd9\x28\x9c\x9f\x84\x36\x6f\x29\x80\xd0\x09\x30\x33\x27\x72\x02\xf2\x18\x40\xb7\xa1\x26\xd8\x42\x9b\x14\x27\xa7\x15\x2e\xe3\x40\x92\x44\x41\xb4\x60\xd8\xf4\xc3\x8e\x10\xe0\x9b\x2b\x42\xb4\xa9\x95\x2c\xb2\xa2\x2c\x1b\x50\x9f\x6b\x2e\x3a\x8c\xfe\x75\xac\x36\x2f\x14\x3d\x83\x4a\x2d\x37\x85\x7c\x6d\x8c\xe6\x2f\x53\xd2\x7e\xb4\x93\x9c\x80\x7e\xbd\xeb\x1a\xc9\xc0\xf6\x6b\xff\x63\x0c\xed\x97\xb9\x75\x99\x5d\xe7\x4f\x66\x12\xa6\x15\xc4\x13\xab\x54\x98\x34\x75\xaf\x02\xed\xb1\xeb\x2b\x68\x5f\xd8\xe7\x8b\xe2\xe0\x15\x76\x01\xbc\xc8\xc0\xbe\x90\xfe\xa6\x7e\x63\x7d\x9f\x97\x64\xba\xe8\x30\x20\x22\x8d\x8f\xbd\x54\x36\x5f\xd9\x8d\xbb\x58\x0b\x87\x19\xc5\x1a\xe2\x9b\x3d\xd8\xb8\x8d\xd4\xa8\x3c\xff\x92\xe8\x13\x2e\xdc\xbf\x05\x71\x3d\xa8\x5e\x9a\xe9\x3d\x5e\x84\x94\x5d\xcb\x32\xe6\x64\x64\x1f\xaf\x6e\xdf\xb3\x05\x95\xd3\x0a\x7d\x1a\x2b\xda\x08\x61\x6f\x30\x29\x94\xf9\x2e\x4d\xd3\x6b\x9c\x7a\xad\x0c\xba\xc5\x97\x7d\xd4\xdc\xdc\x49\x48\xef\xd3\x7c\x05\xa2\x94\x03\xda\xd1\x7a\x51\x6e\xa0\x6c\x7a\x1e\x77\x12\xa8\x0f\x8c\xea\x13\x14\x6b\x70\x94\x30\x82\x08\x96\xb6\x31\x9c\x63\xa2\xf4\xcd\x10\x68\xc4\xde\x54\xc4\x49\x45\xcf\x94\x41\x39\x93\xf8\x20\x04\x03\xcc\x27\x89\x42\x01\x2e\x72\xc1\xd9\x25\x01\x52\x1b\xac\xa2\xe3\x0b\x0d\xa4\x56\xd4\x5c\x72\x21\xcd\xe6\xe5\xa3\x3e\x55\xb9\xa6\xbf\xc3\x74\xef\xbd\x7a\x7d\x4f\x68\x3f\x63\x68\x36\x8c\xcf\xfe\x9c\x59\xfc\xdf\xcc\x2c\xf4\x45\x13\xf3\xb6\xda\x5a\x9b\x82\xf2\x5c\x48\xe0\xd1\xbd\xa1\x8d\x90\x79\xa9\x30\x81\x5c\x82\xa2\xc2\xa9\x8a\x49\x80\x2d\x6a\xd5\xb5\x06\x0b\x32\x9a\x96\x1c\xbb\xe3\x8e\x05\x6a\x2a\x79\x7c\xe3\xb4\xc0\x98\xf8\x66\xaf\x19\xad\xa8\x7f\xd3\x38\xbc\x36\xa1\x5e\xeb\x6a\x35\x77\x89\x16\x28\xcf\x92\x42\x76\xa0\x43\x08\x37\x08\x09\x9d\xc1\x09\xab\x15\xa9\xa3\xdd\x98\x47\x4f\x7e\x72\xf5\x0d\x4e\xbe\x26\xc7\xea\x2d\xbd\x9b\x9e\x91\xbd\x13\x7e\x55\xe9\x35\x67\x63\xef\xad\x7e\xdc\x9b\xaa\xd6\xd1\x26\xae\x85\xe1\x3a\xd4\x80\x8c\xa0\xcb\xf3\xe1\xec\x0f\x11\xa1\x27\x36\x6a\xc1\x1d\xb6\x49\x88\xe3\xfd\x4a\x89\xb1\xf3\xbd\xa3\x7e\x72\x45\x60\xe1\x10\xc1\x35\xd5\x06\x38\x71\x0f\x62\x9d\x48\x07\xba\x38\xe5\x58\x2a\x25\xdc\x77\xa5\x75\x5d\x2d\x14\x2e\xfd\xa3\x18\x77\x6f\x92\xbc\x57\xfb\xab\x03\xdf\x45\x14\x2e\x88\x90\x1e\xd3\xa4\x8b\xb1\x36\xcd\xce\x46\x17\x81\x3a\xd4\x17\x32\x9e\x84\x7a\x6c\x12\x52\x41\xdd\x91\x63\x37\x43\x59\x71\xf9\x60\x36\x14\x1c\x08\xb8\x4e\xcc\x6d\xd0\xe8\x2d\x84\xf0\xe9\x7d\x0f\xe4\x3d\x59\xa7\x1a\x1f\x66\x07\x18\xae\x44\xdb\x64\x06\x75\x76\xe7\xfb\x78\xc1\xa0\xc0\x28\x3a\x3b\x89\x18\x4a\x29\x3b\xe3\x83\xfe\x9c\xf3\x7a\x43\x2b\x10\xb5\x33\x38\xa5\x54\x4b\x58\x99\xf5\xf5\xd6\xce\x76\xd3\x9e\x1e\xb2\xee\x39\x44\x5c\xc8\x82\x9c\x7b\xd0\x83\x75\xae\xd5\x4d\x01\xa2\x6e\x92\x92\x1e\x81\x17\xed\x89\x4b\x52\x2e\x55\x20\x19\x25\x58\xc7\xea\x95\x2b\x66\xce\xb5\x2c\xb0\x81\xbc\xbf\x4e\xb3\xa6\x42\x0c\x94\x86\x12\x2b\xcc\x18\x30\xaa\xab\x94\x52\x0b\x15\xc0\xb0\x33\xd7\x44\xfd\xa6\x45\x3f\x62\xca\x6a\x05\x39\x26\x09\xf3\xf9\xde\x52\x9c\x1a\xe1\x0c\x5e\x69\x4b\x56\xf8\x39\x1f\x96\x6d\x41\x22\xbb\xb6\x45\x12\xaa\x70\x97\x5a\x37\x8d\x5f\xd4\x95\xa3\xd8\xe9\xf6\xc5\xed\x91\x2a\x6d\xba\x9e\x58\xc8\xfe\xd7\x34\xa8\xbf\x78\xe7\x0c\xa9\xa3\x69\xcb\xeb\xba\xaa\x64\x5d\xc3\x10\x70\x07\x67\xfb\x11\xa3\x18\xa3\xda\xbe\x27\xb2\x4e\x9d\x94\xa2\x0a\x2a\x11\x3b\x5a\x76\xe8\x2f\x5d\x87\x0e\xd4\x46\x97\x4d\x46\xf0\x1d\x7d\x7c\x16\x05\x38\xa0\x4b\xe0\xa0\x28\xc9\x27\xde\xe0\x89\x2e\x4b\xd8\x77\x9a\xdf\x5e\xef\xd9\x5d\x9a\x11\x8c\x76\xc5\xed\x16\xee\x4d\x04\xef\xf8\x48\x89\x3c\x57\x86\xba\x26\xee\x34\xad\x79\x25\x4d\x34\x2b\xb4\x08\x4f\x94\x17\xe2\x69\x7d\x46\xdd\x40\xdb\x92\x61\x02\xb3\x2c\x7c\xad\xa2\xb5\x51\x98\x72\xb3\xfa\x94\x74\xae\x16\xa9\xe0\x08\x0a\xf8\x32\xca\x65\xe1\x6e\x35\xf3\x77\xac\x31\xd9\xe2\x12\xf6\x10\x5a\x36\x6d\xdb\x07\x0c\xab\xaf\x35\xfe\x15\x75\xbf\x33\xdc\x84\x4a\xb7\x25\xc2\xa2\x07\x98\x5a\xcf\x61\x35\xbf\xb5\x02\x57\x99\x0a\xaa\x89\x02\x03\xe3\xca\xe3\x8d\xa8\xa9\x8b\x05\x3d\x21\xec\x05\xe8\xb1\xef\xa6\xa3\x81\x1a\x9d\x31\xab\x13\xa6\xaf\x6f\x3a\xaf\xf6\xb5\x7f\x09\xc8\xb3\x8f\x06\xac\xab\xa9\x21\x9b\x0e\x60\x1b\xd4\xe2\x49\x97\x13\x7a\xa8\x5c\xc8\xed\xa7\xa3\xf1\x0b\x08\xfb\xf8\x6c\x8e\x4a\x5c\x6d\x15\x3d\x93\xaf\x6b\x20\x67\x33\x90\x7d\x82\xb8\x58\x1f\x78\xda\x8d\xe5\x4f\x16\x17\xed\xfe\xaf\xbf\x92\xe5\xb1\xea\xc3\x38\x57\xb8\x19\x75\xb5\x4f\x36\xb1\xf7\x3e\xd4\x76\xfc\xb7\x23\x8e\xf9\x91\x86\x6b\x16\x82\x8d\xc1\xe4\x94\x34\x36\x59\xd9\xbd\x5e\x91\x65\x16\xc3\x3d\x67\x18\xea\xa1\x36\x88\x42\x29\x17\xd4\xfe\x37\x22\xd5\x1f\xdd\xaf\xbf\x9f\x0f\xf6\x9f\x6a\x45\x3f\x07\x6a\xa1\xa2\x73\xcd\x6b\x3c\x2f\xe1\x52\xf6\x27\xb0\xeb\x07\x9b\x6b\x91\x0c\x9d\xe6\xea\xa1\xfe\x34\xd7\x47\x9b\x6b\x76\x54\x6e\x99\x6d\x39\x23\x0f\x69\x32\xf9\x3e\x5f\x8f\xb1\x9f\xb2\x31\x07\x73\x7c\x20\xed\xeb\x4e\xbc\x4c\xf9\x4e\x6a\x66\x8b\xf6\x4a\x0c\x4b\xbe\x61\xfe\xb8\xfb\x29\x50\x29\x86\xee\xdd\xbe\x53\x89\xb5\xc1\x25\x25\xb7\x4d\x67\xe3\x87\x41\xbb\xcb\xef\x3b\xfd\x31\x62\xc0\x5f\x7c\xed\xd9\xc8\xc9\x2f\x8b\x33\x9c\x6f\xd3\x63\xe9\xee\x4b\xcd\xfd\x44\x3f\x33\x90\xee\xba\xbb\x95\xb0\xf7\x49\x4d\xad\xeb\x1b\xd0\xf9\xa1\xf8\xf0\x2d\xa6\xe7\x9e\xce\xce\xfe\xdb\x7e\x5b\xbb\x7b\xd9\xfd\x37\x00\x00\xff\xff\x8f\xfe\xaa\xe6\xc5\x40\x00\x00") func dataConfig_schema_v35JsonBytes() ([]byte, error) { return bindataRead( diff --git a/cli/compose/schema/data/config_schema_v3.5.json b/cli/compose/schema/data/config_schema_v3.5.json index bcd3b11091..d3352c7d52 100644 --- a/cli/compose/schema/data/config_schema_v3.5.json +++ b/cli/compose/schema/data/config_schema_v3.5.json @@ -354,8 +354,23 @@ "resources": { "type": "object", "properties": { - "limits": {"$ref": "#/definitions/resource"}, - "reservations": {"$ref": "#/definitions/resource"} + "limits": { + "type": "object", + "properties": { + "cpus": {"type": "string"}, + "memory": {"type": "string"} + }, + "additionalProperties": false + }, + "reservations": { + "type": "object", + "properties": { + "cpus": {"type": "string"}, + "memory": {"type": "string"}, + "generic_resources": {"$ref": "#/definitions/generic_resources"} + }, + "additionalProperties": false + } }, "additionalProperties": false }, @@ -390,14 +405,23 @@ "additionalProperties": false }, - "resource": { - "id": "#/definitions/resource", - "type": "object", - "properties": { - "cpus": {"type": "string"}, - "memory": {"type": "string"} - }, - "additionalProperties": false + "generic_resources": { + "id": "#/definitions/generic_resources", + "type": "array", + "items": { + "type": "object", + "properties": { + "discrete_resource_spec": { + "type": "object", + "properties": { + "kind": {"type": "string"}, + "value": {"type": "number"} + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } }, "network": { diff --git a/cli/compose/types/types.go b/cli/compose/types/types.go index 27177718e2..c68187efe1 100644 --- a/cli/compose/types/types.go +++ b/cli/compose/types/types.go @@ -217,8 +217,24 @@ type Resources struct { // Resource is a resource to be limited or reserved type Resource struct { // TODO: types to convert from units and ratios - NanoCPUs string `mapstructure:"cpus"` - MemoryBytes UnitBytes `mapstructure:"memory"` + NanoCPUs string `mapstructure:"cpus"` + MemoryBytes UnitBytes `mapstructure:"memory"` + GenericResources []GenericResource `mapstructure:"generic_resources"` +} + +// GenericResource represents a "user defined" resource which can +// only be an integer (e.g: SSD=3) for a service +type GenericResource struct { + DiscreteResourceSpec *DiscreteGenericResource `mapstructure:"discrete_resource_spec"` +} + +// DiscreteGenericResource represents a "user defined" resource which is defined +// as an integer +// "Kind" is used to describe the Kind of a resource (e.g: "GPU", "FPGA", "SSD", ...) +// Value is used to count the resource (SSD=5, HDD=3, ...) +type DiscreteGenericResource struct { + Kind string + Value int64 } // UnitBytes is the bytes type