From 328f5c669f9e7e2b5d9ff93e48398767860ee8e6 Mon Sep 17 00:00:00 2001 From: Tobias Babin Date: Thu, 14 Dec 2023 11:58:31 +0100 Subject: [PATCH] Squashed 'schemas/' changes from 99610a4..cff7163 cff7163 fix: made port required and targetport optional in serviceport definition (#10) 3910c0a fix: added missing protocol field in service ports (#8) d5df881 fix: converts anonmyous un-named structs into top-level defs (#5) bcd5a7f fix(schema): move unanchored refs to top level $defs c83d713 fix(schema): fixed additional properties with invalid regex patterns (#3) 6586e0e feat: support class in resources (#2) git-subtree-dir: schemas git-subtree-split: cff7163aa08f928dd49f1f24d14aeb82b537c7ac --- score-v1b1.json | 525 +++++++++++++++++++++++++----------------------- 1 file changed, 272 insertions(+), 253 deletions(-) diff --git a/score-v1b1.json b/score-v1b1.json index fa932be8..8005db9d 100644 --- a/score-v1b1.json +++ b/score-v1b1.json @@ -37,27 +37,9 @@ "ports": { "description": "List of network ports published by the service.", "type": "object", - "additionalProperties": true, "minProperties": 1, - "patternProperties": { - "^*": { - "description": "The network port description.", - "type": "object", - "required": [ - "targetPort" - ], - "additionalProperties": false, - "properties": { - "port": { - "description": "The public service port.", - "type": "number" - }, - "targetPort": { - "description": "The internal service port.", - "type": "number" - } - } - } + "additionalProperties": { + "$ref": "#/$defs/servicePort" } } } @@ -65,272 +47,309 @@ "containers": { "description": "The declared Score Specification version.", "type": "object", - "additionalProperties": true, "minProperties": 1, - "patternProperties": { - "^*": { - "description": "The container name.", + "additionalProperties": { + "$ref": "#/$defs/container" + } + }, + "resources": { + "description": "The dependencies needed by the Workload.", + "type": "object", + "minProperties": 1, + "additionalProperties": { + "$ref": "#/$defs/resource" + } + } + }, + "$defs": { + "servicePort": { + "description": "The network port description.", + "type": "object", + "required": [ + "port" + ], + "additionalProperties": false, + "properties": { + "port": { + "description": "The public service port.", + "type": "integer" + }, + "protocol": { + "description": "The transport level protocol. Defaults to TCP.", + "type": "string" + }, + "targetPort": { + "description": "The internal service port. This will default to 'port' if not provided.", + "type": "integer" + } + } + }, + "resource": { + "description": "The resource name.", + "type": "object", + "additionalProperties": false, + "required": [ + "type" + ], + "properties": { + "type": { + "description": "The resource in the target environment.", + "type": "string" + }, + "class": { + "description": "A specialisation of the resource type.", + "type": "string", + "pattern": "^[a-z0-9](?:-?[a-z0-9]+)+$" + }, + "metadata": { + "description": "The metadata for the resource.", "type": "object", - "required": [ - "image" - ], - "additionalProperties": false, + "minProperties": 1, + "additionalProperties": true, "properties": { - "image": { - "description": "The image name and tag.", - "type": "string" - }, - "command": { - "description": "If specified, overrides container entry point.", - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - }, - "args": { - "description": "If specified, overrides container entry point arguments.", - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - }, - "variables": { - "description": "The environment variables for the container.", + "annotations": { + "description": "Annotations that apply to the property.", "type": "object", "minProperties": 1, "additionalProperties": { "type": "string" } - }, - "files": { - "description": "The extra files to mount.", - "type": "array", - "minItems": 1, - "items": { - "type": "object", - "required": [ - "target" - ], - "properties": { - "target": { - "description": "The file path and name.", - "type": "string" - }, - "mode": { - "description": "The file access mode.", + } + } + }, + "properties": { + "description": "DEPRECATED: The properties that can be referenced in other places in the Score Specification file.", + "type": [ + "object", + "null" + ] + }, + "params": { + "description": "The parameters used to validate or provision the resource in the environment.", + "type": "object" + } + } + }, + "resourcesLimits": { + "description": "The compute resources limits.", + "type": "object", + "minProperties": 1, + "additionalProperties": false, + "properties": { + "memory": { + "description": "The memory limit.", + "type": "string" + }, + "cpu": { + "description": "The CPU limit.", + "type": "string" + } + } + }, + "container": { + "description": "The container name.", + "type": "object", + "required": [ + "image" + ], + "additionalProperties": false, + "properties": { + "image": { + "description": "The image name and tag.", + "type": "string" + }, + "command": { + "description": "If specified, overrides container entry point.", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "args": { + "description": "If specified, overrides container entry point arguments.", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "variables": { + "description": "The environment variables for the container.", + "type": "object", + "minProperties": 1, + "additionalProperties": { + "type": "string" + } + }, + "files": { + "description": "The extra files to mount.", + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "target" + ], + "properties": { + "target": { + "description": "The file path and name.", + "type": "string" + }, + "mode": { + "description": "The file access mode.", + "type": "string" + }, + "source": { + "description": "The relative or absolute path to the content file.", + "type": "string", + "minLength": 1 + }, + "content": { + "description": "The inline content for the file.", + "anyOf": [ + { "type": "string" }, - "source": { - "description": "The relative or absolute path to the content file.", - "type": "string", - "minLength": 1 - }, - "content": { - "description": "The inline content for the file.", - "anyOf": [{ - "type": "string" - }, { - "deprecated": true, - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - }] - }, - "noExpand": { - "description": "If set to true, the placeholders expansion will not occur in the contents of the file.", - "type": "boolean" + { + "deprecated": true, + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } } - }, - "oneOf": [{ - "required": ["content"] - }, { - "required": ["source"] - }] + ] + }, + "noExpand": { + "description": "If set to true, the placeholders expansion will not occur in the contents of the file.", + "type": "boolean" } }, - "volumes": { - "description": "The volumes to mount.", - "type": "array", - "minItems": 1, - "items": { - "type": "object", + "oneOf": [ + { "required": [ - "source", - "target" - ], - "properties": { - "source": { - "description": "The external volume reference.", - "type": "string" - }, - "path": { - "description": "An optional sub path in the volume.", - "type": "string" - }, - "target": { - "description": "The target mount on the container.", - "type": "string" - }, - "read_only": { - "description": "Indicates if the volume should be mounted in a read-only mode.", - "type": "boolean" - } - } + "content" + ] + }, + { + "required": [ + "source" + ] } - }, - "resources": { - "description": "The compute resources for the container.", - "type": "object", - "minProperties": 1, - "additionalProperties": false, - "properties": { - "limits": { - "description": "The maximum allowed resources for the container.", - "$ref": "#/properties/containers/definitions/resourcesLimits" - }, - "requests": { - "description": "The minimal resources required for the container.", - "$ref": "#/properties/containers/definitions/resourcesLimits" - } + ] + } + }, + "volumes": { + "description": "The volumes to mount.", + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "source", + "target" + ], + "properties": { + "source": { + "description": "The external volume reference.", + "type": "string" + }, + "path": { + "description": "An optional sub path in the volume.", + "type": "string" + }, + "target": { + "description": "The target mount on the container.", + "type": "string" + }, + "read_only": { + "description": "Indicates if the volume should be mounted in a read-only mode.", + "type": "boolean" } - }, - "livenessProbe": { - "description": "The liveness probe for the container.", - "$ref": "#/properties/containers/definitions/containerProbe" - }, - "readinessProbe": { - "description": "The readiness probe for the container.", - "$ref": "#/properties/containers/definitions/containerProbe" } } - } - }, - "definitions": { - "resourcesLimits": { - "description": "The compute resources limits.", + }, + "resources": { + "description": "The compute resources for the container.", "type": "object", "minProperties": 1, "additionalProperties": false, "properties": { - "memory": { - "description": "The memory limit.", - "type": "string" + "limits": { + "description": "The maximum allowed resources for the container.", + "$ref": "#/$defs/resourcesLimits" }, - "cpu": { - "description": "The CPU limit.", - "type": "string" + "requests": { + "description": "The minimal resources required for the container.", + "$ref": "#/$defs/resourcesLimits" } } }, - "containerProbe": { - "type": "object", - "minProperties": 1, - "additionalProperties": false, - "properties": { - "httpGet": { - "$ref": "#/properties/containers/definitions/httpProbe" - } - } + "livenessProbe": { + "description": "The liveness probe for the container.", + "$ref": "#/$defs/containerProbe" }, - "httpProbe": { - "description": "An HTTP probe details.", - "type": "object", - "additionalProperties": false, - "required": [ - "path" - ], - "properties": { - "host": { - "description": "Host name to connect to. Defaults to the container IP.", - "type": "string" - }, - "scheme": { - "description": "Scheme to use for connecting to the host (HTTP or HTTPS). Defaults to HTTP.", - "type": "string", - "enum": [ - "HTTP", - "HTTPS" - ] - }, - "path": { - "description": "The path of the HTTP probe endpoint.", - "type": "string" - }, - "port": { - "description": "The path of the HTTP probe endpoint.", - "type": "number" - }, - "httpHeaders": { - "description": "Additional HTTP headers to send with the request", - "type": "array", - "minItems": 1, - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "description": "The HTTP header name.", - "type": "string" - }, - "value": { - "description": "The HTTP header value.", - "type": "string" - } - } - } - } - } + "readinessProbe": { + "description": "The readiness probe for the container.", + "$ref": "#/$defs/containerProbe" } } }, - "resources": { - "description": "The dependencies needed by the Workload.", + "containerProbe": { "type": "object", "minProperties": 1, - "additionalProperties": true, - "patternProperties": { - "^*": { - "description": "The resource name.", - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "description": "The resource in the target environment.", - "type": "string" - }, - "metadata": { - "description": "The metadata for the resource.", - "type": "object", - "minProperties": 1, - "additionalProperties": true, - "properties": { - "annotations": { - "description": "Annotations that apply to the property.", - "type": "object", - "minProperties": 1, - "additionalProperties": { - "type": "string" - } - } - } - }, + "additionalProperties": false, + "properties": { + "httpGet": { + "$ref": "#/$defs/httpProbe" + } + } + }, + "httpProbe": { + "description": "An HTTP probe details.", + "type": "object", + "additionalProperties": false, + "required": [ + "path" + ], + "properties": { + "host": { + "description": "Host name to connect to. Defaults to the container IP.", + "type": "string" + }, + "scheme": { + "description": "Scheme to use for connecting to the host (HTTP or HTTPS). Defaults to HTTP.", + "type": "string", + "enum": [ + "HTTP", + "HTTPS" + ] + }, + "path": { + "description": "The path of the HTTP probe endpoint.", + "type": "string" + }, + "port": { + "description": "The path of the HTTP probe endpoint.", + "type": "integer" + }, + "httpHeaders": { + "description": "Additional HTTP headers to send with the request", + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "additionalProperties": false, "properties": { - "description": "DEPRECATED: The properties that can be referenced in other places in the Score Specification file.", - "type": [ - "object", - "null" - ] - }, - "params": { - "description": "The parameters used to validate or provision the resource in the environment.", - "type": "object" + "name": { + "description": "The HTTP header name.", + "type": "string" + }, + "value": { + "description": "The HTTP header value.", + "type": "string" + } } } }