util

package
v0.0.0-...-bf278f2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RequeueInterval is the interval to requeue the request.
	RequeueInterval = 5 * time.Second
	// CFGExtension is the extension of the BFB configuration file.
	CFGExtension = ".cfg"
	// DPUSetNameLabel is the label that indicates the name of the DPUSet.
	DPUSetNameLabel = "provisioning.dpu.nvidia.com/dpuset-name"
	// DPUSetNamespaceLabel is the label that indicates the namespace of the DPUSet.
	DPUSetNamespaceLabel = "provisioning.dpu.nvidia.com/dpuset-namespace"
	// DPUPCIAddress is the label that indicates the PCI address of the DPU.
	DPUPCIAddress = "dpu-%d-pci-address"
	// DPUPFName is the label that indicates the PF name of the DPU.
	DPUPFName = "dpu-%d-pf0-name"
	// DPUPCIAddressLabel is the label that indicates the PCI address of the DPU.
	DPUPCIAddressLabel = "provisioning.dpu.nvidia.com/dpu-pciAddress"
	// DPUPFNameLabel is the label that indicates the PF name of the DPU.
	DPUPFNameLabel = "provisioning.dpu.nvidia.com/dpu-pf-name"
	// DPUHostIPLabel is the label that indicates the host IP of the DPU.
	DPUHostIPLabel = "provisioning.dpu.nvidia.com/dpu-host-ip"
	// TolerationNotReadyKey is the key for the NotReady taint.
	TolerationNotReadyKey = "node.kubernetes.io/not-ready"
	// TolerationUnreachableyKey is the key for the Unreachable taint.
	TolerationUnreachableyKey = "node.kubernetes.io/unreachable"
	// TolerationUnschedulableKey is the key for the Unschedulable taint.
	TolerationUnschedulableKey = "node.kubernetes.io/unschedulable"
	// DPUOOBBridgeConfiguredLabel is the label that indicates that the DPU OOB bridge is configured.
	DPUOOBBridgeConfiguredLabel = "dpu-oob-bridge-configured"
	// NodeFeatureDiscoveryLabelPrefix is the prefix for all NodeFeatureDiscovery labels.
	NodeFeatureDiscoveryLabelPrefix = "feature.node.kubernetes.io/"
	// NodeMaintenanceRequestorID is the requestor ID used for NodeMaintenance CRs
	NodeMaintenanceRequestorID = "dpu.nvidia.com"
	// ProvisioningGroupName is the provisioning group, used to identify provisioning as
	// additional Requestors in NodeMaintenance CR.
	ProvisioningGroupName = "provisioning.dpu.nvidia.com"
)

Variables

View Source
var (
	// Location of BFB binary files
	BFBBaseDir = "bfb"
)

Functions

func AddLabelsToNode

func AddLabelsToNode(ctx context.Context, client crclient.Client, node *corev1.Node, labels map[string]string) error

func AdminKubeConfigPath

func AdminKubeConfigPath(dc provisioningv1.DPUCluster) string

func ComputeMD5

func ComputeMD5(filePath string) (string, error)

func DPUCondition

func DPUCondition(condType provisioningv1.DPUConditionType, reason, message string) *metav1.Condition

func DeleteObject

func DeleteObject(client crclient.Client, obj crclient.Object) error

func GenerateBFBCFGFilePath

func GenerateBFBCFGFilePath(filename string) string

func GenerateBFBFilePath

func GenerateBFBFilePath(filename string) string

func GenerateBFBTMPFilePath

func GenerateBFBTMPFilePath(uid string) string

func GenerateBFBTaskName

func GenerateBFBTaskName(bfb provisioningv1.BFB) string

func GenerateBFBVersionFromURL

func GenerateBFBVersionFromURL(bfbURL string) string

func GenerateBFCFGFileName

func GenerateBFCFGFileName(dpuName string) string

func GenerateCACertName

func GenerateCACertName(dpuNamespace string) string

func GenerateCASecretName

func GenerateCASecretName(dpuNamespace string) string

func GenerateDMSPodName

func GenerateDMSPodName(dpuName string) string

func GenerateDMSServerCertName

func GenerateDMSServerCertName(dpuName string) string

func GenerateDMSServerSecretName

func GenerateDMSServerSecretName(dpuName string) string

func GenerateHostnetworkPodName

func GenerateHostnetworkPodName(dpuName string) string

func GenerateNodeName

func GenerateNodeName(dpu *provisioningv1.DPU) string

func GeneratePodToleration

func GeneratePodToleration(nodeEffect provisioningv1.NodeEffect) []corev1.Toleration

func GetDPUCondition

func GetDPUCondition(status *provisioningv1.DPUStatus, conditionType string) (int, *metav1.Condition)

func GetNamespacedName

func GetNamespacedName(obj metav1.Object) types.NamespacedName

func GetObjects

func GetObjects(client crclient.Client, objects []crclient.Object) (existObjects []crclient.Object, err error)

func GetPCIAddrFromLabel

func GetPCIAddrFromLabel(labels map[string]string, removePrefix bool) (string, error)

func IsClusterCreated

func IsClusterCreated(conditions []metav1.Condition) bool

func IsNodeReady

func IsNodeReady(node *corev1.Node) bool

func NeedUpdateLabels

func NeedUpdateLabels(label1 map[string]string, label2 map[string]string) bool

NeedUpdateLabels compares two labels. If label 2 does not contain all the key-value pairs of label 1, then return true. otherwise return false

func NewCondition

func NewCondition(condType string, err error, reason, message string) *metav1.Condition

NewCondition creates a new metav1.Condition with the given parameters. todo: merge with DPUCondition()

func RemoteExec

func RemoteExec(ns, name, container, cmd string) (string, string, error)

func ReplaceDaemonSetPodNodeNameNodeAffinity

func ReplaceDaemonSetPodNodeNameNodeAffinity(affinity *corev1.Affinity, nodename string) *corev1.Affinity

ReplaceDaemonSetPodNodeNameNodeAffinity replaces the RequiredDuringSchedulingIgnoredDuringExecution NodeAffinity of the given affinity with a new NodeAffinity that selects the given nodeName. Note that this function assumes that no NodeAffinity conflicts with the selected nodeName.

This method is copied from https://github.com/kubernetes/kubernetes/blob/dbc2b0a5c7acc349ea71a14e49913661eaf708d2/pkg/controller/daemon/util/daemonset_util.go#L176

func SetDPUCondition

func SetDPUCondition(status *provisioningv1.DPUStatus, condition *metav1.Condition) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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