From 7e5d36d469ff01153f40b16ab722f0ebe25d41ae Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Wed, 25 Dec 2024 10:35:04 +0530 Subject: [PATCH] fix: pci driver rebind config validation We need a field named `name` to distinguish between named documents, as decoder expects a `name` yaml key. Fixes: https://github.com/siderolabs/talos/discussions/10025 Fixes by using standard `name` field instead of `pciID`. Signed-off-by: Noel Georgi --- .../config/schemas/config.schema.json | 6 ++-- .../config/types/hardware/hardware_doc.go | 2 +- .../hardware/pci_driver_rebind_config.go | 2 +- .../testdata/pcidriverrebindconfig.yaml | 2 +- .../hardware/pcidriverrebindconfig.md | 4 +-- .../content/v1.10/schemas/config.schema.json | 6 ++-- .../configuration/hardware/_index.md | 8 ----- .../hardware/pcidriverrebindconfig.md | 33 ------------------- 8 files changed, 11 insertions(+), 52 deletions(-) delete mode 100644 website/content/v1.9/reference/configuration/hardware/_index.md delete mode 100644 website/content/v1.9/reference/configuration/hardware/pcidriverrebindconfig.md diff --git a/pkg/machinery/config/schemas/config.schema.json b/pkg/machinery/config/schemas/config.schema.json index 2afe96cadc..7464717a2b 100644 --- a/pkg/machinery/config/schemas/config.schema.json +++ b/pkg/machinery/config/schemas/config.schema.json @@ -187,9 +187,9 @@ "markdownDescription": "kind is the kind of the resource.", "x-intellij-html-description": "\u003cp\u003ekind is the kind of the resource.\u003c/p\u003e\n" }, - "pciID": { + "name": { "type": "string", - "title": "pciID", + "title": "name", "description": "PCI device id\n", "markdownDescription": "PCI device id", "x-intellij-html-description": "\u003cp\u003ePCI device id\u003c/p\u003e\n" @@ -207,7 +207,7 @@ "required": [ "apiVersion", "kind", - "pciID", + "name", "targetDriver" ] }, diff --git a/pkg/machinery/config/types/hardware/hardware_doc.go b/pkg/machinery/config/types/hardware/hardware_doc.go index 1b73394678..116562d72a 100644 --- a/pkg/machinery/config/types/hardware/hardware_doc.go +++ b/pkg/machinery/config/types/hardware/hardware_doc.go @@ -18,7 +18,7 @@ func (PCIDriverRebindConfigV1Alpha1) Doc() *encoder.Doc { Fields: []encoder.Doc{ {}, { - Name: "pciID", + Name: "name", Type: "string", Note: "", Description: "PCI device id", diff --git a/pkg/machinery/config/types/hardware/pci_driver_rebind_config.go b/pkg/machinery/config/types/hardware/pci_driver_rebind_config.go index b3eb8c7b27..5334dd6df8 100644 --- a/pkg/machinery/config/types/hardware/pci_driver_rebind_config.go +++ b/pkg/machinery/config/types/hardware/pci_driver_rebind_config.go @@ -51,7 +51,7 @@ type PCIDriverRebindConfigV1Alpha1 struct { // description: | // PCI device id // schemaRequired: true - MetaName string `yaml:"pciID"` + MetaName string `yaml:"name"` // description: | // Target driver to rebind the PCI device to. // schemaRequired: true diff --git a/pkg/machinery/config/types/hardware/testdata/pcidriverrebindconfig.yaml b/pkg/machinery/config/types/hardware/testdata/pcidriverrebindconfig.yaml index d030dfb63a..db6f5234ad 100644 --- a/pkg/machinery/config/types/hardware/testdata/pcidriverrebindconfig.yaml +++ b/pkg/machinery/config/types/hardware/testdata/pcidriverrebindconfig.yaml @@ -1,4 +1,4 @@ apiVersion: v1alpha1 kind: PCIDriverRebindConfig -pciID: "0000:04:00.00" +name: "0000:04:00.00" targetDriver: vfio-pci diff --git a/website/content/v1.10/reference/configuration/hardware/pcidriverrebindconfig.md b/website/content/v1.10/reference/configuration/hardware/pcidriverrebindconfig.md index 236058ea5e..0b99774936 100644 --- a/website/content/v1.10/reference/configuration/hardware/pcidriverrebindconfig.md +++ b/website/content/v1.10/reference/configuration/hardware/pcidriverrebindconfig.md @@ -16,14 +16,14 @@ title: PCIDriverRebindConfig {{< highlight yaml >}} apiVersion: v1alpha1 kind: PCIDriverRebindConfig -pciID: 0000:04:00.00 # PCI device id +name: 0000:04:00.00 # PCI device id targetDriver: vfio-pci # Target driver to rebind the PCI device to. {{< /highlight >}} | Field | Type | Description | Value(s) | |-------|------|-------------|----------| -|`pciID` |string |PCI device id | | +|`name` |string |PCI device id | | |`targetDriver` |string |Target driver to rebind the PCI device to. | | diff --git a/website/content/v1.10/schemas/config.schema.json b/website/content/v1.10/schemas/config.schema.json index 2afe96cadc..7464717a2b 100644 --- a/website/content/v1.10/schemas/config.schema.json +++ b/website/content/v1.10/schemas/config.schema.json @@ -187,9 +187,9 @@ "markdownDescription": "kind is the kind of the resource.", "x-intellij-html-description": "\u003cp\u003ekind is the kind of the resource.\u003c/p\u003e\n" }, - "pciID": { + "name": { "type": "string", - "title": "pciID", + "title": "name", "description": "PCI device id\n", "markdownDescription": "PCI device id", "x-intellij-html-description": "\u003cp\u003ePCI device id\u003c/p\u003e\n" @@ -207,7 +207,7 @@ "required": [ "apiVersion", "kind", - "pciID", + "name", "targetDriver" ] }, diff --git a/website/content/v1.9/reference/configuration/hardware/_index.md b/website/content/v1.9/reference/configuration/hardware/_index.md deleted file mode 100644 index 684b659bf0..0000000000 --- a/website/content/v1.9/reference/configuration/hardware/_index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -description: | - Package hardware provides hardware related config documents. -title: hardware ---- - - - diff --git a/website/content/v1.9/reference/configuration/hardware/pcidriverrebindconfig.md b/website/content/v1.9/reference/configuration/hardware/pcidriverrebindconfig.md deleted file mode 100644 index 236058ea5e..0000000000 --- a/website/content/v1.9/reference/configuration/hardware/pcidriverrebindconfig.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: PCIDriverRebindConfig allows to configure PCI driver rebinds. -title: PCIDriverRebindConfig ---- - - - - - - - - - - - -{{< highlight yaml >}} -apiVersion: v1alpha1 -kind: PCIDriverRebindConfig -pciID: 0000:04:00.00 # PCI device id -targetDriver: vfio-pci # Target driver to rebind the PCI device to. -{{< /highlight >}} - - -| Field | Type | Description | Value(s) | -|-------|------|-------------|----------| -|`pciID` |string |PCI device id | | -|`targetDriver` |string |Target driver to rebind the PCI device to. | | - - - - - -