Skip to content

Commit

Permalink
pass through the pod annotations when multus receives them
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
toelke committed Sep 29, 2023
1 parent d7e391e commit c216488
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions pkg/types/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 8 additions & 7 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c216488

Please sign in to comment.