utils

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 17 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanDeviceInfoForCNI added in v1.2.0

func CleanDeviceInfoForCNI(cniPath string) error

CleanDeviceInfoForCNI removes a DeviceInfo CNI File.

func CleanDeviceInfoForDP added in v1.2.0

func CleanDeviceInfoForDP(resourceName string, deviceID string) error

CleanDeviceInfoForDP removes a DeviceInfo DP File.

func CopyDeviceInfoForCNIFromDP added in v1.2.0

func CopyDeviceInfoForCNIFromDP(cniPath string, resourceName string, deviceID string) error

CopyDeviceInfoForCNIFromDP saves a DeviceInfo structure created by a DP to a CNI File.

func CreateNetworkStatus

func CreateNetworkStatus(r cnitypes.Result, networkName string, defaultNetwork bool, dev *v1.DeviceInfo) (*v1.NetworkStatus, error)

CreateNetworkStatus create NetworkStatus from CNI result

func GetCNIConfig

func GetCNIConfig(net *v1.NetworkAttachmentDefinition, confDir string) (config []byte, err error)

GetCNIConfig (from annotation string to CNI JSON bytes)

func GetCNIConfigFromFile

func GetCNIConfigFromFile(name, confDir string) ([]byte, error)

GetCNIConfigFromSpec reads a CNI JSON configuration from given directory (confDir)

func GetCNIConfigFromSpec

func GetCNIConfigFromSpec(configData, netName string) ([]byte, error)

GetCNIConfigFromSpec reads a CNI JSON configuration from the NetworkAttachmentDefinition object's Spec.Config field and fills in any missing details like the network name

func GetCNIDeviceInfoPath added in v1.2.0

func GetCNIDeviceInfoPath(filename string) string

GetCNIDeviceInfoPath returns the standard Device Plugin DevInfo filename The path is fixed but the filename is flexible and determined by the caller.

func GetNetworkStatus

func GetNetworkStatus(pod *corev1.Pod) ([]v1.NetworkStatus, error)

GetNetworkStatus returns pod's network status

func LoadDeviceInfoFromCNI added in v1.2.0

func LoadDeviceInfoFromCNI(cniPath string) (*v1.DeviceInfo, error)

LoadDeviceInfoFromCNI loads a DeviceInfo structure from created by a CNI. Returns an error if the device information is malformed and (nil, nil) if it does not exist

func LoadDeviceInfoFromDP added in v1.2.0

func LoadDeviceInfoFromDP(resourceName string, deviceID string) (*v1.DeviceInfo, error)

LoadDeviceInfoFromDP loads a DeviceInfo structure from file created by a Device Plugin Returns an error if the device information is malformed and (nil, nil) if it does not exist

func ParseNetworkAnnotation

func ParseNetworkAnnotation(podNetworks, defaultNamespace string) ([]*v1.NetworkSelectionElement, error)

ParseNetworkAnnotation parses actual annotation string and get NetworkSelectionElement

func ParsePodNetworkAnnotation

func ParsePodNetworkAnnotation(pod *corev1.Pod) ([]*v1.NetworkSelectionElement, error)

ParsePodNetworkAnnotation parses Pod annotation for net-attach-def and get NetworkSelectionElement

func SaveDeviceInfoForCNI added in v1.2.0

func SaveDeviceInfoForCNI(cniPath string, devInfo *v1.DeviceInfo) error

SaveDeviceInfoForCNI saves a DeviceInfo structure created by a CNI

func SaveDeviceInfoForDP added in v1.2.0

func SaveDeviceInfoForDP(resourceName string, deviceID string, devInfo *v1.DeviceInfo) error

SaveDeviceInfoForDP saves a DeviceInfo structure created by a Device Plugin

func SetNetworkStatus

func SetNetworkStatus(client kubernetes.Interface, pod *corev1.Pod, statuses []v1.NetworkStatus) error

SetNetworkStatus updates the Pod status

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL