From 63b48aafaa17616d75f79f7cfe54fc0f2827692d Mon Sep 17 00:00:00 2001 From: liuxu Date: Tue, 5 Mar 2024 22:20:43 +0800 Subject: [PATCH 09/10] support cdi spec --- src/json/schema/cdi/container_edits.json | 28 ++++++++++++++++ src/json/schema/cdi/device.json | 20 ++++++++++++ src/json/schema/cdi/device_node.json | 37 ++++++++++++++++++++++ src/json/schema/cdi/hook.json | 26 +++++++++++++++ src/json/schema/cdi/mount.json | 23 ++++++++++++++ src/json/schema/cdi/spec.json | 30 ++++++++++++++++++ src/json/schema/host-config.json | 6 ++++ src/json/schema/isulad-daemon-configs.json | 6 ++++ 8 files changed, 176 insertions(+) create mode 100644 src/json/schema/cdi/container_edits.json create mode 100644 src/json/schema/cdi/device.json create mode 100644 src/json/schema/cdi/device_node.json create mode 100644 src/json/schema/cdi/hook.json create mode 100644 src/json/schema/cdi/mount.json create mode 100644 src/json/schema/cdi/spec.json diff --git a/src/json/schema/cdi/container_edits.json b/src/json/schema/cdi/container_edits.json new file mode 100644 index 0000000..41356e4 --- /dev/null +++ b/src/json/schema/cdi/container_edits.json @@ -0,0 +1,28 @@ +{ + "_comment": "third party depend: cdi", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "env": { + "$ref": "../defs.json#/definitions/ArrayOfStrings" + }, + "deviceNodes": { + "type": "array", + "items": { + "$ref": "device_node.json" + } + }, + "mounts": { + "type": "array", + "items": { + "$ref": "mount.json" + } + }, + "hooks": { + "type": "array", + "items": { + "$ref": "hook.json" + } + } + } +} \ No newline at end of file diff --git a/src/json/schema/cdi/device.json b/src/json/schema/cdi/device.json new file mode 100644 index 0000000..4277347 --- /dev/null +++ b/src/json/schema/cdi/device.json @@ -0,0 +1,20 @@ +{ + "_comment": "third party depend: cdi", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "annotations": { + "$ref": "../defs.json#/definitions/annotations" + }, + "containerEdits": { + "$ref": "container_edits.json" + } + }, + "required": [ + "name", + "containerEdits" + ] +} \ No newline at end of file diff --git a/src/json/schema/cdi/device_node.json b/src/json/schema/cdi/device_node.json new file mode 100644 index 0000000..7c442e3 --- /dev/null +++ b/src/json/schema/cdi/device_node.json @@ -0,0 +1,37 @@ +{ + "_comment": "third party depend: cdi", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "hostPath": { + "type": "string" + }, + "type": { + "type": "string" + }, + "major": { + "$ref": "../defs.json#/definitions/int64" + }, + "minor": { + "$ref": "../defs.json#/definitions/int64" + }, + "fileMode": { + "$ref": "../defs.json#/definitions/int64" + }, + "permissions": { + "type": "string" + }, + "uid": { + "$ref": "../defs.json#/definitions/UID" + }, + "gid": { + "$ref": "../defs.json#/definitions/GID" + } + }, + "required": [ + "path" + ] +} \ No newline at end of file diff --git a/src/json/schema/cdi/hook.json b/src/json/schema/cdi/hook.json new file mode 100644 index 0000000..66d9d22 --- /dev/null +++ b/src/json/schema/cdi/hook.json @@ -0,0 +1,26 @@ +{ + "_comment": "third party depend: cdi", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "hookName": { + "type": "string" + }, + "path": { + "type": "string" + }, + "args": { + "$ref": "../defs.json#/definitions/ArrayOfStrings" + }, + "env": { + "$ref": "../defs.json#/definitions/ArrayOfStrings" + }, + "timeout": { + "$ref": "../defs.json#/definitions/int32" + } + }, + "required": [ + "hookName", + "path" + ] +} \ No newline at end of file diff --git a/src/json/schema/cdi/mount.json b/src/json/schema/cdi/mount.json new file mode 100644 index 0000000..ff8b8a9 --- /dev/null +++ b/src/json/schema/cdi/mount.json @@ -0,0 +1,23 @@ +{ + "_comment": "third party depend: cdi", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "hostPath": { + "type": "string" + }, + "containerPath": { + "type": "string" + }, + "type": { + "type": "string" + }, + "options": { + "$ref": "../defs.json#/definitions/ArrayOfStrings" + } + }, + "required": [ + "hostPath", + "containerPath" + ] +} \ No newline at end of file diff --git a/src/json/schema/cdi/spec.json b/src/json/schema/cdi/spec.json new file mode 100644 index 0000000..583afb0 --- /dev/null +++ b/src/json/schema/cdi/spec.json @@ -0,0 +1,30 @@ +{ + "_comment": "third party depend: cdi", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "cdiVersion": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "annotations": { + "$ref": "../defs.json#/definitions/annotations" + }, + "devices": { + "type": "array", + "items": { + "$ref": "device.json" + } + }, + "containerEdits": { + "$ref": "container_edits.json" + } + }, + "required": [ + "cdiVersion", + "kind", + "devices" + ] +} \ No newline at end of file diff --git a/src/json/schema/host-config.json b/src/json/schema/host-config.json index 30f1bdc..6af8021 100644 --- a/src/json/schema/host-config.json +++ b/src/json/schema/host-config.json @@ -305,6 +305,12 @@ "items": { "type": "string" } + }, + "CdiRequestedDevices": { + "type": "array", + "items": { + "type": "string" + } } } } diff --git a/src/json/schema/isulad-daemon-configs.json b/src/json/schema/isulad-daemon-configs.json index bbacfd6..cd8948a 100644 --- a/src/json/schema/isulad-daemon-configs.json +++ b/src/json/schema/isulad-daemon-configs.json @@ -179,6 +179,12 @@ }, "enable-pod-events": { "type": "boolean" + }, + "cdi-spec-dirs": { + "type": "ArrayOfStrings" + }, + "enable-cdi": { + "type": "boolean" } } } -- 2.34.1