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 <priederer@genesiscloud.com>
This commit is contained in:
Philipp Riederer 2023-06-30 13:19:38 +02:00
parent 003fbd5785
commit 7ad9d7a04a
2 changed files with 11 additions and 7 deletions

View File

@ -268,6 +268,9 @@ func newCNIRuntimeConf(containerID, sandboxID, podName, podNamespace, podUID, ne
if delegateRc.CNIDeviceInfoFile != "" { if delegateRc.CNIDeviceInfoFile != "" {
capabilityArgs["CNIDeviceInfoFile"] = delegateRc.CNIDeviceInfoFile capabilityArgs["CNIDeviceInfoFile"] = delegateRc.CNIDeviceInfoFile
} }
if delegateRc.PodAnnotations != nil {
capabilityArgs["io.kubernetes.cri.pod-annotations"] = delegateRc.PodAnnotations
}
rt.CapabilityArgs = capabilityArgs rt.CapabilityArgs = capabilityArgs
} }
return rt, cniDeviceInfoFile return rt, cniDeviceInfoFile

View File

@ -69,13 +69,14 @@ type NetConf struct {
// RuntimeConfig specifies CNI RuntimeConfig // RuntimeConfig specifies CNI RuntimeConfig
type RuntimeConfig struct { type RuntimeConfig struct {
PortMaps []*PortMapEntry `json:"portMappings,omitempty"` PortMaps []*PortMapEntry `json:"portMappings,omitempty"`
Bandwidth *BandwidthEntry `json:"bandwidth,omitempty"` Bandwidth *BandwidthEntry `json:"bandwidth,omitempty"`
IPs []string `json:"ips,omitempty"` IPs []string `json:"ips,omitempty"`
Mac string `json:"mac,omitempty"` Mac string `json:"mac,omitempty"`
InfinibandGUID string `json:"infinibandGUID,omitempty"` InfinibandGUID string `json:"infinibandGUID,omitempty"`
DeviceID string `json:"deviceID,omitempty"` DeviceID string `json:"deviceID,omitempty"`
CNIDeviceInfoFile string `json:"CNIDeviceInfoFile,omitempty"` CNIDeviceInfoFile string `json:"CNIDeviceInfoFile,omitempty"`
PodAnnotations *map[string]string `json:"io.kubernetes.cri.pod-annotations,omitempty"`
} }
// PortMapEntry for CNI PortMapEntry // PortMapEntry for CNI PortMapEntry