From 6a68851f263c55158e1adfad16ef1097fe63cb4e Mon Sep 17 00:00:00 2001 From: Casey Callendrello Date: Mon, 1 Jul 2024 17:28:26 +0200 Subject: [PATCH 1/2] SPEC: use correct GC field name. The SPEC and libcni disagreed on the name to use for still-valid attachments. Change the spec to be aligned with libcni. Signed-off-by: Casey Callendrello --- SPEC.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SPEC.md b/SPEC.md index 71d35dd7..8e2013cd 100644 --- a/SPEC.md +++ b/SPEC.md @@ -387,7 +387,7 @@ The runtime MUST NOT use GC as a substitute for DEL. Plugins may be unable to cl The runtime must provide a JSON-serialized plugin configuration object (defined below) on standard in. It contains an additional key; -- `cni.dev/attachments` (array of objects): The list of **still valid** attachments to this network: +- `cni.dev/valid-attachments` (array of objects): The list of **still valid** attachments to this network: - `containerID` (string): the value of CNI_CONTAINERID as provided during the CNI ADD operation - `ifname` (string): the value of CNI_IFNAME as provided during the CNI ADD operation @@ -496,7 +496,7 @@ For attachment-specific operations (ADD, DEL, CHECK), additional field requireme - `capabilities`: must not be set For GC operations: -- `cni.dev/attachments`: as specified in section 2. +- `cni.dev/valid-attachments`: as specified in section 2. All other fields not prefixed with `cni.dev/` should be passed through unaltered. From 692efbd2a7756cfd0acbb4d4ae65a58e3c58d6b1 Mon Sep 17 00:00:00 2001 From: Casey Callendrello Date: Mon, 1 Jul 2024 17:29:06 +0200 Subject: [PATCH 2/2] libcni: set both GC valid attachment keys I made an (embarassing) error where SPEC.md and libcni disagreed on the key for valid attachments for a GC operation. The spec has been updated, but libcni should set both keys as a transition mechanism. Signed-off-by: Casey Callendrello --- libcni/api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libcni/api.go b/libcni/api.go index de2dc622..201a12e9 100644 --- a/libcni/api.go +++ b/libcni/api.go @@ -817,6 +817,8 @@ func (c *CNIConfig) GCNetworkList(ctx context.Context, list *NetworkConfigList, } if args != nil { inject["cni.dev/valid-attachments"] = args.ValidAttachments + // #1101: spec used incorrect variable name + inject["cni.dev/attachments"] = args.ValidAttachments } for _, plugin := range list.Plugins {