344 lines
7.1 KiB
JSON
344 lines
7.1 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://platform.example/templates/generic-inference-service/v1",
|
|
"title": "generic-inference-service@v1",
|
|
"description": "Generic HTTP runtime that downloads a pinned Hugging Face model during pod startup",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"templateRef",
|
|
"metadata",
|
|
"runtime",
|
|
"replicas",
|
|
"resources",
|
|
"healthCheck",
|
|
"resolvedModel"
|
|
],
|
|
"properties": {
|
|
"templateRef": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"name",
|
|
"version"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"const": "generic-inference-service"
|
|
},
|
|
"version": {
|
|
"const": "v1"
|
|
}
|
|
}
|
|
},
|
|
"type": {
|
|
"const": "inference"
|
|
},
|
|
"metadata": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"description": {
|
|
"type": "string"
|
|
},
|
|
"owner": {
|
|
"type": "string"
|
|
},
|
|
"labels": {
|
|
"type": "object",
|
|
"propertyNames": {
|
|
"not": {
|
|
"pattern": "^platform\\.example/"
|
|
}
|
|
},
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"runtime": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"image",
|
|
"resolvedImage",
|
|
"ports"
|
|
],
|
|
"properties": {
|
|
"image": {
|
|
"type": "string"
|
|
},
|
|
"resolvedImage": {
|
|
"type": "string",
|
|
"pattern": "^[^ @]+@sha256:[a-f0-9]{64}$"
|
|
},
|
|
"command": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"args": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"ports": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"name",
|
|
"containerPort"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"maxLength": 15,
|
|
"pattern": "^(?=[a-z0-9-]*[a-z])[a-z0-9]+(?:-[a-z0-9]+)*$"
|
|
},
|
|
"containerPort": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 65535
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"runAsRoot": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"env": {
|
|
"type": "object",
|
|
"propertyNames": {
|
|
"allOf": [
|
|
{
|
|
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
},
|
|
{
|
|
"not": {
|
|
"const": "MODEL_PATH"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"replicas": {
|
|
"type": "integer",
|
|
"minimum": 0,
|
|
"maximum": 10
|
|
},
|
|
"resources": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"size"
|
|
],
|
|
"properties": {
|
|
"size": {
|
|
"enum": [
|
|
"nano",
|
|
"small",
|
|
"medium",
|
|
"large"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"healthCheck": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"path",
|
|
"port",
|
|
"initialDelaySeconds"
|
|
],
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"pattern": "^/"
|
|
},
|
|
"port": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 65535
|
|
},
|
|
"initialDelaySeconds": {
|
|
"type": "integer",
|
|
"minimum": 0,
|
|
"maximum": 600
|
|
}
|
|
}
|
|
},
|
|
"exposure": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"public": {
|
|
"const": false
|
|
},
|
|
"path": {
|
|
"const": "/"
|
|
}
|
|
}
|
|
},
|
|
"secretRefs": {
|
|
"type": "array",
|
|
"maxItems": 0
|
|
},
|
|
"dependencies": {
|
|
"type": "array",
|
|
"maxItems": 20,
|
|
"items": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"serviceId",
|
|
"alias",
|
|
"protocol",
|
|
"portName"
|
|
],
|
|
"properties": {
|
|
"serviceId": {
|
|
"type": "string",
|
|
"pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
|
|
},
|
|
"alias": {
|
|
"type": "string",
|
|
"pattern": "^[A-Z][A-Z0-9_]{0,48}$"
|
|
},
|
|
"protocol": {
|
|
"const": "http"
|
|
},
|
|
"portName": {
|
|
"type": "string",
|
|
"pattern": "^[a-z0-9](?:[-a-z0-9]{0,18}[a-z0-9])?$"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"contract": {
|
|
"type": "object",
|
|
"additionalProperties": false
|
|
},
|
|
"resolvedModel": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"source"
|
|
],
|
|
"properties": {
|
|
"source": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"type",
|
|
"repoId",
|
|
"commit"
|
|
],
|
|
"properties": {
|
|
"type": {
|
|
"const": "huggingface"
|
|
},
|
|
"repoId": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*/[A-Za-z0-9][A-Za-z0-9._-]*$",
|
|
"maxLength": 256
|
|
},
|
|
"commit": {
|
|
"type": "string",
|
|
"pattern": "^[0-9a-f]{40}$"
|
|
}
|
|
}
|
|
},
|
|
"credentialRef": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"pattern": "^[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?$"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": {
|
|
"required": [
|
|
"exposure"
|
|
],
|
|
"properties": {
|
|
"exposure": {
|
|
"required": [
|
|
"public"
|
|
],
|
|
"properties": {
|
|
"public": {
|
|
"const": true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"metadata": {
|
|
"required": [
|
|
"labels"
|
|
],
|
|
"properties": {
|
|
"labels": {
|
|
"required": [
|
|
"service"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"required": [
|
|
"volumeAttachments"
|
|
],
|
|
"properties": {
|
|
"volumeAttachments": {
|
|
"minItems": 1
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"replicas": {
|
|
"const": 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"runtime": {
|
|
"properties": {
|
|
"ports": {
|
|
"minItems": 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"then": {}
|
|
}
|
|
]
|
|
}
|