From 39db88802575014940d58f7e8e5f55bec3e303a4 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 20 Dec 2022 09:06:41 +0100 Subject: [PATCH] add support for build.privileged and service.cgroup Signed-off-by: Nicolas De Loof --- schema/compose-spec.json | 17 ++++++++--------- types/types.go | 2 ++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/schema/compose-spec.json b/schema/compose-spec.json index 5710e475..7e693823 100644 --- a/schema/compose-spec.json +++ b/schema/compose-spec.json @@ -102,6 +102,7 @@ "shm_size": {"type": ["integer", "string"]}, "extra_hosts": {"$ref": "#/definitions/list_or_dict"}, "isolation": {"type": "string"}, + "privileged": {"type": "boolean"}, "secrets": {"$ref": "#/definitions/service_config_or_secret"}, "tags": {"type": "array", "items": {"type": "string"}}, "platforms": {"type": "array", "items": {"type": "string"}} @@ -407,9 +408,7 @@ {"type": "string"} ] }, - "mode": { - "type": "number" - } + "mode": {"type": "number"} }, "additionalProperties": false, "patternProperties": {"^x-": {}} @@ -581,12 +580,12 @@ "items": { "type": "object", "properties": { - "capabilities": {"$ref": "#/definitions/list_of_strings"}, - "count": {"type": ["string", "integer"]}, - "device_ids": {"$ref": "#/definitions/list_of_strings"}, - "driver":{"type": "string"}, - "options":{"$ref": "#/definitions/list_or_dict"} - }, + "capabilities": {"$ref": "#/definitions/list_of_strings"}, + "count": {"type": ["string", "integer"]}, + "device_ids": {"$ref": "#/definitions/list_of_strings"}, + "driver":{"type": "string"}, + "options":{"$ref": "#/definitions/list_or_dict"} + }, "additionalProperties": false, "patternProperties": {"^x-": {}} } diff --git a/types/types.go b/types/types.go index 2c4f02d1..156cacd0 100644 --- a/types/types.go +++ b/types/types.go @@ -93,6 +93,7 @@ type ServiceConfig struct { CapAdd []string `mapstructure:"cap_add" yaml:"cap_add,omitempty" json:"cap_add,omitempty"` CapDrop []string `mapstructure:"cap_drop" yaml:"cap_drop,omitempty" json:"cap_drop,omitempty"` CgroupParent string `mapstructure:"cgroup_parent" yaml:"cgroup_parent,omitempty" json:"cgroup_parent,omitempty"` + Cgroup string `mapstructure:"cgroup" yaml:"cgroup,omitempty" json:"cgroup,omitempty"` CPUCount int64 `mapstructure:"cpu_count" yaml:"cpu_count,omitempty" json:"cpu_count,omitempty"` CPUPercent float32 `mapstructure:"cpu_percent" yaml:"cpu_percent,omitempty" json:"cpu_percent,omitempty"` CPUPeriod int64 `mapstructure:"cpu_period" yaml:"cpu_period,omitempty" json:"cpu_period,omitempty"` @@ -319,6 +320,7 @@ type BuildConfig struct { Secrets []ServiceSecretConfig `yaml:",omitempty" json:"secrets,omitempty"` Tags StringList `mapstructure:"tags" yaml:"tags,omitempty" json:"tags,omitempty"` Platforms StringList `mapstructure:"platforms" yaml:"platforms,omitempty" json:"platforms,omitempty"` + Privileged bool `yaml:",omitempty" json:"privileged,omitempty"` Extensions map[string]interface{} `yaml:",inline" json:"-"` }