chore: update compose spec

This commit is contained in:
Xyphuz 2023-01-10 21:33:08 +08:00
parent e0d3baa522
commit 389c5252c4
2 changed files with 35 additions and 13 deletions

View file

@ -102,8 +102,10 @@
"shm_size": {"type": ["integer", "string"]}, "shm_size": {"type": ["integer", "string"]},
"extra_hosts": {"$ref": "#/definitions/list_or_dict"}, "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
"isolation": {"type": "string"}, "isolation": {"type": "string"},
"privileged": {"type": "boolean"},
"secrets": {"$ref": "#/definitions/service_config_or_secret"}, "secrets": {"$ref": "#/definitions/service_config_or_secret"},
"tags":{"type": "array", "items": {"type": "string"}} "tags": {"type": "array", "items": {"type": "string"}},
"platforms": {"type": "array", "items": {"type": "string"}}
}, },
"additionalProperties": false, "additionalProperties": false,
"patternProperties": {"^x-": {}} "patternProperties": {"^x-": {}}
@ -139,6 +141,7 @@
}, },
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cgroup": {"type": "string", "enum": ["host", "private"]},
"cgroup_parent": {"type": "string"}, "cgroup_parent": {"type": "string"},
"command": { "command": {
"oneOf": [ "oneOf": [
@ -364,6 +367,7 @@
} }
}, },
"user": {"type": "string"}, "user": {"type": "string"},
"uts": {"type": "string"},
"userns_mode": {"type": "string"}, "userns_mode": {"type": "string"},
"volumes": { "volumes": {
"type": "array", "type": "array",
@ -686,6 +690,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"name": {"type": "string"}, "name": {"type": "string"},
"environment": {"type": "string"},
"file": {"type": "string"}, "file": {"type": "string"},
"external": { "external": {
"type": ["boolean", "object"], "type": ["boolean", "object"],

View file

@ -1,14 +1,18 @@
# generated by datamodel-codegen: # generated by datamodel-codegen:
# filename: compose-spec.json # filename: compose-spec.json
# timestamp: 2022-05-27T05:44:40+00:00 # timestamp: 2023-01-10T13:17:45+00:00
from __future__ import annotations from __future__ import annotations
from enum import Enum
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
from pydantic import Extra, Field, conint, constr from pydantic import Extra, Field, conint, constr
from pydantic_yaml import YamlModel from pydantic_yaml import YamlModel, YamlStrEnum
class Cgroup(YamlStrEnum):
host = "host"
private = "private"
class CredentialSpec(YamlModel): class CredentialSpec(YamlModel):
@ -20,7 +24,7 @@ class CredentialSpec(YamlModel):
registry: Optional[str] = None registry: Optional[str] = None
class Condition(Enum): class Condition(YamlStrEnum):
service_started = "service_started" service_started = "service_started"
service_healthy = "service_healthy" service_healthy = "service_healthy"
service_completed_successfully = "service_completed_successfully" service_completed_successfully = "service_completed_successfully"
@ -60,7 +64,7 @@ class Port(YamlModel):
protocol: Optional[str] = None protocol: Optional[str] = None
class PullPolicy(Enum): class PullPolicy(YamlStrEnum):
always = "always" always = "always"
never = "never" never = "never"
if_not_present = "if_not_present" if_not_present = "if_not_present"
@ -76,7 +80,7 @@ class Ulimit(YamlModel):
soft: int soft: int
class Selinux(Enum): class Selinux(YamlStrEnum):
z = "z" z = "z"
Z = "Z" Z = "Z"
@ -131,7 +135,7 @@ class Healthcheck(YamlModel):
start_period: Optional[str] = None start_period: Optional[str] = None
class Order(Enum): class Order(YamlStrEnum):
start_first = "start-first" start_first = "start-first"
stop_first = "stop-first" stop_first = "stop-first"
@ -148,7 +152,7 @@ class RollbackConfig(YamlModel):
order: Optional[Order] = None order: Optional[Order] = None
class ConfigOrder(Enum): class ConfigOrder(YamlStrEnum):
start_first = "start-first" start_first = "start-first"
stop_first = "stop-first" stop_first = "stop-first"
@ -265,7 +269,9 @@ class ListOfStrings(YamlModel):
class ListOrDict(YamlModel): class ListOrDict(YamlModel):
__root__: Union[Dict[constr(regex=r".+"), Optional[Union[str, float, bool]]], List[str]] # type: ignore # noqa: F722, E501 __root__: Union[
Dict[constr(regex=r".+"), Optional[Union[str, float, bool]]], List[str] # type: ignore # noqa: F722
]
class BlkioLimit(YamlModel): class BlkioLimit(YamlModel):
@ -321,8 +327,10 @@ class BuildItem(YamlModel):
shm_size: Optional[Union[int, str]] = None shm_size: Optional[Union[int, str]] = None
extra_hosts: Optional[ListOrDict] = None extra_hosts: Optional[ListOrDict] = None
isolation: Optional[str] = None isolation: Optional[str] = None
privileged: Optional[bool] = None
secrets: Optional[ServiceConfigOrSecret] = None secrets: Optional[ServiceConfigOrSecret] = None
tags: Optional[List[str]] = None tags: Optional[List[str]] = None
platforms: Optional[List[str]] = None
class BlkioConfig(YamlModel): class BlkioConfig(YamlModel):
@ -394,6 +402,7 @@ class Secret(YamlModel):
extra = Extra.forbid extra = Extra.forbid
name: Optional[str] = None name: Optional[str] = None
environment: Optional[str] = None
file: Optional[str] = None file: Optional[str] = None
external: Optional[ExternalSecret] = None external: Optional[ExternalSecret] = None
labels: Optional[ListOrDict] = None labels: Optional[ListOrDict] = None
@ -459,6 +468,7 @@ class Service(YamlModel):
blkio_config: Optional[BlkioConfig] = None blkio_config: Optional[BlkioConfig] = None
cap_add: Optional[List[str]] = Field(None, unique_items=True) cap_add: Optional[List[str]] = Field(None, unique_items=True)
cap_drop: Optional[List[str]] = Field(None, unique_items=True) cap_drop: Optional[List[str]] = Field(None, unique_items=True)
cgroup: Optional[Cgroup] = None
cgroup_parent: Optional[str] = None cgroup_parent: Optional[str] = None
command: Optional[Union[str, List[str]]] = None command: Optional[Union[str, List[str]]] = None
configs: Optional[ServiceConfigOrSecret] = None configs: Optional[ServiceConfigOrSecret] = None
@ -473,7 +483,9 @@ class Service(YamlModel):
cpus: Optional[Union[float, str]] = None cpus: Optional[Union[float, str]] = None
cpuset: Optional[str] = None cpuset: Optional[str] = None
credential_spec: Optional[CredentialSpec] = None credential_spec: Optional[CredentialSpec] = None
depends_on: Optional[Union[ListOfStrings, Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), DependsOn]]] = None # type: ignore # noqa: F722, E501 depends_on: Optional[
Union[ListOfStrings, Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), DependsOn]] # type: ignore # noqa: F722, E501
] = None
device_cgroup_rules: Optional[ListOfStrings] = None device_cgroup_rules: Optional[ListOfStrings] = None
devices: Optional[List[str]] = Field(None, unique_items=True) devices: Optional[List[str]] = Field(None, unique_items=True)
dns: Optional[StringOrList] = None dns: Optional[StringOrList] = None
@ -503,10 +515,14 @@ class Service(YamlModel):
mem_swappiness: Optional[int] = None mem_swappiness: Optional[int] = None
memswap_limit: Optional[Union[float, str]] = None memswap_limit: Optional[Union[float, str]] = None
network_mode: Optional[str] = None network_mode: Optional[str] = None
networks: Optional[Union[ListOfStrings, Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Optional[ServiceNetwork]]]] = None # type: ignore # noqa: F722, E501 networks: Optional[
Union[
ListOfStrings, Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Optional[ServiceNetwork]] # type: ignore # noqa: F722, E501
]
] = None
oom_kill_disable: Optional[bool] = None oom_kill_disable: Optional[bool] = None
oom_score_adj: Optional[conint(ge=-1000, le=1000)] = None # type: ignore oom_score_adj: Optional[conint(ge=-1000, le=1000)] = None # type: ignore
pid: Optional[Optional[str]] = None pid: Optional[str] = None
pids_limit: Optional[Union[float, str]] = None pids_limit: Optional[Union[float, str]] = None
platform: Optional[str] = None platform: Optional[str] = None
ports: Optional[List[Union[float, str, Port]]] = Field(None, unique_items=True) ports: Optional[List[Union[float, str, Port]]] = Field(None, unique_items=True)
@ -529,6 +545,7 @@ class Service(YamlModel):
tty: Optional[bool] = None tty: Optional[bool] = None
ulimits: Optional[Dict[constr(regex=r"^[a-z]+$"), Union[int, Ulimit]]] = None # type: ignore # noqa: F722 ulimits: Optional[Dict[constr(regex=r"^[a-z]+$"), Union[int, Ulimit]]] = None # type: ignore # noqa: F722
user: Optional[str] = None user: Optional[str] = None
uts: Optional[str] = None
userns_mode: Optional[str] = None userns_mode: Optional[str] = None
volumes: Optional[List[Union[str, ServiceVolume]]] = Field(None, unique_items=True) volumes: Optional[List[Union[str, ServiceVolume]]] = Field(None, unique_items=True)
volumes_from: Optional[List[str]] = Field(None, unique_items=True) volumes_from: Optional[List[str]] = Field(None, unique_items=True)