utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	InfiniBandAnnotation    = "mellanox.infiniband.app"
	ConfiguredInfiniBandPod = "configured"
	InfiniBandSriovCni      = "ib-sriov"
)

Variables

This section is empty.

Functions

func GenerateNetworkID added in v1.0.1

func GenerateNetworkID(network *v1.NetworkSelectionElement) string

GenerateNetworkID returns the network name and network namespace with . separation

func GeneratePodNetworkID added in v1.0.1

func GeneratePodNetworkID(pod *kapi.Pod, networkID string) string

func GetPodNetwork

func GetPodNetwork(networks []*v1.NetworkSelectionElement, networkName string) (*v1.NetworkSelectionElement, error)

func GetPodNetworkGUID added in v1.0.1

func GetPodNetworkGUID(network *v1.NetworkSelectionElement) (string, error)

GetPodNetworkGUID return network cni-args guid field

func HasNetworkAttachmentAnnot added in v1.0.1

func HasNetworkAttachmentAnnot(pod *kapi.Pod) bool

HasNetworkAttachmentAnnot check if pod has Network Attachment Annotation

func IsPodNetworkConfiguredWithInfiniBand

func IsPodNetworkConfiguredWithInfiniBand(network *v1.NetworkSelectionElement) bool

IsPodNetworkConfiguredWithInfiniBand check if pod is already InfiniBand supported

func ParseNetworkID added in v1.0.1

func ParseNetworkID(networkID string) (string, string, error)

ParseNetworkID returns the network name and network namespace

func ParsePKey

func ParsePKey(pKey string) (int, error)

ParsePKey returns parsed PKey from string

func PodIsRunning

func PodIsRunning(pod *kapi.Pod) bool

PodIsRunning check if pod is in "Running" state

func PodNetworkHasGUID added in v1.0.1

func PodNetworkHasGUID(network *v1.NetworkSelectionElement) bool

PodNetworkHasGUID check if network cni-args has guid field

func PodScheduled

func PodScheduled(pod *kapi.Pod) bool

PodScheduled check if pod is assigned to node

func PodWantsNetwork

func PodWantsNetwork(pod *kapi.Pod) bool

PodWantsNetwork check if pod needs cni

func SetPodNetworkGUID added in v1.0.1

func SetPodNetworkGUID(network *v1.NetworkSelectionElement, guid string, setAsRuntimeConfig bool) error

SetPodNetworkGUID set network cni-args guid

Types

type IbSriovCniSpec

type IbSriovCniSpec struct {
	Type         string          `json:"type"`
	PKey         string          `json:"pkey"`
	Capabilities map[string]bool `json:"capabilities,omitempty"`
}

func GetIbSriovCniFromNetwork

func GetIbSriovCniFromNetwork(networkSpec map[string]interface{}) (*IbSriovCniSpec, error)

GetIbSriovCniFromNetwork check if network uses IB-SR-IOV-CNi

type SynchronizedMap

type SynchronizedMap struct {
	Items        map[string]interface{}
	sync.RWMutex // Read Write mutex, guards access to internal map.
}

SynchronizedMap a thread safe string to anything map

func NewSynchronizedMap

func NewSynchronizedMap() *SynchronizedMap

NewSynchronizedMap creates a new synchronized map

func (*SynchronizedMap) Get

func (m *SynchronizedMap) Get(key string) (interface{}, bool)

Get retrieves an element from map under given key

func (*SynchronizedMap) Remove

func (m *SynchronizedMap) Remove(key string)

Remove removes an element from the map

func (*SynchronizedMap) Set

func (m *SynchronizedMap) Set(key string, value interface{})

Set sets the given value under the specified key

func (*SynchronizedMap) UnSafeRemove

func (m *SynchronizedMap) UnSafeRemove(key string)

UnSafeRemove removes an element from the map without lock

func (*SynchronizedMap) UnSafeSet

func (m *SynchronizedMap) UnSafeSet(key string, value interface{})

UnSafeSet sets the given value under the specified key without lock

Jump to

Keyboard shortcuts

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