From c216488d18ac4eafbbf8dbb78961de4152d364bd Mon Sep 17 00:00:00 2001 From: Philipp Riederer Date: Fri, 30 Jun 2023 13:19:38 +0200 Subject: [PATCH] pass through the pod annotations when multus receives them See https://github.com/kubernetes/kubernetes/issues/69882\#issuecomment-1509077177 Passing the annotations seems not to be a standardized behaviour, but it is very useful nontheless. Signed-off-by: Philipp Riederer --- pkg/types/conf.go | 3 +++ pkg/types/types.go | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pkg/types/conf.go b/pkg/types/conf.go index 4402b4ec7..b66dcbd95 100644 --- a/pkg/types/conf.go +++ b/pkg/types/conf.go @@ -268,6 +268,9 @@ func newCNIRuntimeConf(containerID, sandboxID, podName, podNamespace, podUID, ne if delegateRc.CNIDeviceInfoFile != "" { capabilityArgs["CNIDeviceInfoFile"] = delegateRc.CNIDeviceInfoFile } + if delegateRc.PodAnnotations != nil { + capabilityArgs["io.kubernetes.cri.pod-annotations"] = delegateRc.PodAnnotations + } rt.CapabilityArgs = capabilityArgs } return rt, cniDeviceInfoFile diff --git a/pkg/types/types.go b/pkg/types/types.go index 1a410db59..779823028 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -69,13 +69,14 @@ type NetConf struct { // RuntimeConfig specifies CNI RuntimeConfig type RuntimeConfig struct { - PortMaps []*PortMapEntry `json:"portMappings,omitempty"` - Bandwidth *BandwidthEntry `json:"bandwidth,omitempty"` - IPs []string `json:"ips,omitempty"` - Mac string `json:"mac,omitempty"` - InfinibandGUID string `json:"infinibandGUID,omitempty"` - DeviceID string `json:"deviceID,omitempty"` - CNIDeviceInfoFile string `json:"CNIDeviceInfoFile,omitempty"` + PortMaps []*PortMapEntry `json:"portMappings,omitempty"` + Bandwidth *BandwidthEntry `json:"bandwidth,omitempty"` + IPs []string `json:"ips,omitempty"` + Mac string `json:"mac,omitempty"` + InfinibandGUID string `json:"infinibandGUID,omitempty"` + DeviceID string `json:"deviceID,omitempty"` + CNIDeviceInfoFile string `json:"CNIDeviceInfoFile,omitempty"` + PodAnnotations *map[string]string `json:"io.kubernetes.cri.pod-annotations,omitempty"` } // PortMapEntry for CNI PortMapEntry