-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from joshwget/modify-schema
Modify libcompose schema to support Rancher Compose specific fields
- Loading branch information
Showing
7 changed files
with
592 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package main | ||
|
||
//go:generate go run scripts/inline_schema.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"id": "config_schema_v1.json", | ||
|
||
"type": "object", | ||
|
||
"patternProperties": { | ||
"^[a-zA-Z0-9._-]+$": { | ||
"$ref": "#/definitions/service" | ||
} | ||
}, | ||
|
||
"additionalProperties": false, | ||
|
||
"definitions": { | ||
"service": { | ||
"id": "#/definitions/service", | ||
"type": "object", | ||
|
||
"properties": { | ||
"build": {"type": "string"}, | ||
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, | ||
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, | ||
"certs": {"$ref": "#/definitions/list_of_strings"}, | ||
"cgroup_parent": {"type": "string"}, | ||
"command": { | ||
"oneOf": [ | ||
{"type": "string"}, | ||
{"type": "array", "items": {"type": "string"}} | ||
] | ||
}, | ||
"container_name": {"type": "string"}, | ||
"cpu_shares": {"type": ["number", "string"]}, | ||
"cpu_quota": {"type": ["number", "string"]}, | ||
"cpuset": {"type": "string"}, | ||
"device_read_iops": {"$ref": "#/definitions/list_or_dict"}, | ||
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, | ||
"device_write_iops": {"$ref": "#/definitions/list_or_dict"}, | ||
"default_cert": {"type": "string"}, | ||
"disks": {"type": "array"}, | ||
"dns": {"$ref": "#/definitions/string_or_list"}, | ||
"dns_search": {"$ref": "#/definitions/string_or_list"}, | ||
"dockerfile": {"type": "string"}, | ||
"domainname": {"type": "string"}, | ||
"entrypoint": { | ||
"oneOf": [ | ||
{"type": "string"}, | ||
{"type": "array", "items": {"type": "string"}} | ||
] | ||
}, | ||
"env_file": {"$ref": "#/definitions/string_or_list"}, | ||
"environment": {"$ref": "#/definitions/list_or_dict"}, | ||
|
||
"expose": { | ||
"type": "array", | ||
"items": { | ||
"type": ["string", "number"], | ||
"format": "expose" | ||
}, | ||
"uniqueItems": true | ||
}, | ||
|
||
"extends": { | ||
"oneOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "object", | ||
|
||
"properties": { | ||
"service": {"type": "string"}, | ||
"file": {"type": "string"} | ||
}, | ||
"required": ["service"], | ||
"additionalProperties": false | ||
} | ||
] | ||
}, | ||
|
||
"extra_hosts": {"$ref": "#/definitions/list_or_dict"}, | ||
"external_ips": {"$ref": "#/definitions/list_of_strings"}, | ||
"external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, | ||
"health_check": {"type": "object"}, | ||
"hostname": {"type": "string"}, | ||
"image": {"type": "string"}, | ||
"ipc": {"type": "string"}, | ||
"labels": {"$ref": "#/definitions/list_or_dict"}, | ||
"links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, | ||
"load_balancer_config": {"type": "object"}, | ||
"log_driver": {"type": "string"}, | ||
"log_opt": {"type": "object"}, | ||
"mac_address": {"type": "string"}, | ||
"memory": {"type": ["number", "string"]}, | ||
"mem_limit": {"type": ["number", "string"]}, | ||
"memswap_limit": {"type": ["number", "string"]}, | ||
"mem_swappiness": {"type": "integer"}, | ||
"metadata": {"type": "object"}, | ||
"net": {"type": "string"}, | ||
"pid": {"type": ["string", "null"]}, | ||
|
||
"ports": { | ||
"type": "array", | ||
"items": { | ||
"type": ["string", "number"], | ||
"format": "ports" | ||
}, | ||
"uniqueItems": true | ||
}, | ||
|
||
"privileged": {"type": "boolean"}, | ||
"read_only": {"type": "boolean"}, | ||
"restart": {"type": "string"}, | ||
"retain_ip": {"type": "boolean"}, | ||
"scale": {"type": ["number", "string"]}, | ||
"scale_policy": {"type": "object"}, | ||
"security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, | ||
"shm_size": {"type": ["number", "string"]}, | ||
"stdin_open": {"type": "boolean"}, | ||
"stop_signal": {"type": "string"}, | ||
"tty": {"type": "boolean"}, | ||
"type": {"type": "string"}, | ||
"update_strategy": {"type": "object"}, | ||
"ulimits": { | ||
"type": "object", | ||
"patternProperties": { | ||
"^[a-z]+$": { | ||
"oneOf": [ | ||
{"type": "integer"}, | ||
{ | ||
"type":"object", | ||
"properties": { | ||
"hard": {"type": "integer"}, | ||
"soft": {"type": "integer"} | ||
}, | ||
"required": ["soft", "hard"], | ||
"additionalProperties": false | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"user": {"type": "string"}, | ||
"userdata": {"type": "string"}, | ||
"vcpu": {"type": ["number", "string"]}, | ||
"volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, | ||
"volume_driver": {"type": "string"}, | ||
"volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, | ||
"working_dir": {"type": "string"} | ||
}, | ||
|
||
"dependencies": { | ||
"memswap_limit": ["mem_limit"] | ||
}, | ||
"additionalProperties": false | ||
}, | ||
|
||
"string_or_list": { | ||
"oneOf": [ | ||
{"type": "string"}, | ||
{"$ref": "#/definitions/list_of_strings"} | ||
] | ||
}, | ||
|
||
"list_of_strings": { | ||
"type": "array", | ||
"items": {"type": "string"}, | ||
"uniqueItems": true | ||
}, | ||
|
||
"list_or_dict": { | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"patternProperties": { | ||
".+": { | ||
"type": ["string", "number", "null", "boolean"] | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{"type": "array", "items": {"type": "string"}, "uniqueItems": true} | ||
] | ||
}, | ||
|
||
"constraints": { | ||
"service": { | ||
"id": "#/definitions/constraints/service", | ||
"anyOf": [ | ||
{ | ||
"required": ["build"], | ||
"not": {"required": ["image"]} | ||
}, | ||
{ | ||
"required": ["image"], | ||
"not": {"anyOf": [ | ||
{"required": ["build"]}, | ||
{"required": ["dockerfile"]} | ||
]} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.