From 8003e152764c90dd18009446960772e3cecd1c8e Mon Sep 17 00:00:00 2001 From: Michael Zappa Date: Tue, 12 Dec 2023 15:08:19 -0700 Subject: [PATCH 1/2] Add metadata to interfaces Signed-off-by: Michael Zappa --- SPEC.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SPEC.md b/SPEC.md index dcd10783..f38657db 100644 --- a/SPEC.md +++ b/SPEC.md @@ -570,6 +570,7 @@ Plugins must output a JSON object with the following keys upon a successful `ADD - `sandbox` (string): The isolation domain reference (e.g. path to network namespace) for the interface, or empty if on the host. For interfaces created inside the container, this should be the value passed via `CNI_NETNS`. - `socketPath` (string, optional): An absolute path to a socket file corresponding to this interface, if applicable. - `pciID` (string, optional): The platform-specific identifier of the PCI device corresponding to this interface, if applicable. + - `metadata`: a dictionary consisting of interface configurion information. - `ips`: IPs assigned by this attachment. Plugins may include IPs assigned external to the container. - `address` (string): an IP address in CIDR notation (eg "192.168.1.3/24"). - `gateway` (string): the default gateway for this subnet, if one exists. From 0d501e89396fe086069c245eac6a13d28367dbfd Mon Sep 17 00:00:00 2001 From: Michael Zappa Date: Tue, 12 Dec 2023 15:37:13 -0700 Subject: [PATCH 2/2] Update libcni to add metadata to interface Signed-off-by: Michael Zappa --- pkg/types/100/types.go | 1 + pkg/types/100/types_test.go | 1 + pkg/types/types_test.go | 1 + 3 files changed, 3 insertions(+) diff --git a/pkg/types/100/types.go b/pkg/types/100/types.go index c1392571..524753e3 100644 --- a/pkg/types/100/types.go +++ b/pkg/types/100/types.go @@ -273,6 +273,7 @@ type Interface struct { Sandbox string `json:"sandbox,omitempty"` SocketPath string `json:"socketPath,omitempty"` PciID string `json:"pciID,omitempty"` + Metadata map[string]string `json:"metadata,omitempty"` } func (i *Interface) String() string { diff --git a/pkg/types/100/types_test.go b/pkg/types/100/types_test.go index e74060c6..3a3d1571 100644 --- a/pkg/types/100/types_test.go +++ b/pkg/types/100/types_test.go @@ -55,6 +55,7 @@ func testResult() *current.Result { Sandbox: "/proc/3553/ns/net", PciID: "8086:9a01", SocketPath: "/path/to/vhost/fd", + Metadata: make(map[string]string), }, }, IPs: []*current.IPConfig{ diff --git a/pkg/types/types_test.go b/pkg/types/types_test.go index 73cd9ec6..c12ad815 100644 --- a/pkg/types/types_test.go +++ b/pkg/types/types_test.go @@ -169,6 +169,7 @@ var _ = Describe("Types", func() { Sandbox: "/proc/3553/ns/net", PciID: "8086:9a01", SocketPath: "/path/to/vhost/fd", + Metadata: make(map[string]string), }, }, IPs: []*current.IPConfig{