daemon

package
v0.0.0-...-c28557d Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConditionConfigured       string                       = "Configured"
	ConfigurationInProgress   ConfigurationConditionReason = "InProgress"
	ConfigurationFailed       ConfigurationConditionReason = "Failed"
	ConfigurationNotRequested ConfigurationConditionReason = "NotRequested"
	ConfigurationSucceeded    ConfigurationConditionReason = "Succeeded"
)

Variables

View Source
var (
	VrbConfigPath            = "/sriov_config/config/accelerators_vrb.json"
	VrbgetSriovInventory     = VrbGetSriovInventory
	VrbsupportedAccelerators utils.AcceleratorDiscoveryConfig
)
View Source
var (
	ResetModeCmdID  = []byte{0x2, 0x0}
	AutoResetCmdID  = []byte{0x3, 0x0}
	ClearLogCmdID   = []byte{0x4, 0x0}
	RegDumpCmdID    = []byte{0x6, 0x0}
	MmReadCmdID     = []byte{0x8, 0x0}
	DeviceDataCmdID = []byte{0x9, 0x0}
)

pf_bb_config_cli command IDs

View Source
var (
	ClusterResetMode = []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
	PfFlrMode        = []byte{0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0}
	AutoResetOff     = []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
	AutoResetOn      = []byte{0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0}
	MmReadRegRead    = []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
	VoidPrivate      = []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
)

CLI command arguments

View Source
var (
	FecConfigPath = "/sriov_config/config/accelerators.json"
)

Functions

func AsIntString

func AsIntString(v bool) string

func CreateManager

func CreateManager(config *rest.Config, scheme *runtime.Scheme, namespace string, metricsPort int, healthProbePort int, log *logrus.Logger) (manager.Manager, error)
func CreateNoLinks(path string) (*os.File, error)

func DownloadFile

func DownloadFile(path, url, checksum string, client *http.Client) error

func GetSriovInventory

func GetSriovInventory(log *logrus.Logger) (*sriovv2.NodeInventory, error)

func NewPfBBConfigController

func NewPfBBConfigController(log *logrus.Logger, sharedVfioToken string) *pfBBConfigController

func NewSecureHTTPSClient

func NewSecureHTTPSClient(cert *x509.Certificate) (*http.Client, error)
func OpenFileNoLinks(path string, flag int, perm os.FileMode) (*os.File, error)
func OpenNoLinks(path string) (*os.File, error)

func ShowHelp

func ShowHelp()

func StartPfBbConfigCli

func StartPfBbConfigCli(nodeName string, ns string, directClient client.Client, cmd string, args []string, pciAddr string, log *logrus.Logger)

func StartTelemetryDaemon

func StartTelemetryDaemon(mgr manager.Manager, nodeName string, ns string, directClient client.Client, log *logrus.Logger)

func Untar

func Untar(tarFile string, dstPath string, log *logrus.Logger) (string, error)

func VrbGetSriovInventory

func VrbGetSriovInventory(log *logrus.Logger) (*vrbv1.NodeInventory, error)

func Vrbacc100BBDevConfigToIniStruct

func Vrbacc100BBDevConfigToIniStruct(in *vrbv1.ACC100BBDevConfig) interface{}

func VrbfindOrCreateConfigurationStatusCondition

func VrbfindOrCreateConfigurationStatusCondition(nc *vrbv1.SriovVrbNodeConfig) metav1.Condition

****************************************************************************

  • Function: VrbfindOrCreateConfigurationStatusCondition
  • Description: * ***************************************************************************

func VrbgetMatchingConfiguration

func VrbgetMatchingConfiguration(pciAddress string, configurations []vrbv1.PhysicalFunctionConfigExt) *vrbv1.PhysicalFunctionConfigExt

func VrbgetTelemetry

func VrbgetTelemetry(pciAddr string, vfs []vrbv1.VF, telemetryGatherer *telemetryGatherer, log *logrus.Logger)

func VrbisConfigurationOfNonExistingInventoryRequested

func VrbisConfigurationOfNonExistingInventoryRequested(
	requestedConfiguration []vrbv1.PhysicalFunctionConfigExt,
	existingInventory *vrbv1.NodeInventory) bool

****************************************************************************

  • Function: VrbisConfigurationOfNonExistingInventoryRequested
  • Description: * ***************************************************************************

func VrbisKnownDevice

func VrbisKnownDevice(device *pci.Device) bool

func VrbparseCounters

func VrbparseCounters(fieldLine, valueLine string, vfs []vrbv1.VF, pfPciAddr string, telemetryGatherer *telemetryGatherer, log *logrus.Logger)

*****************************************************************************

  • Function: VrbparseCounters
  • Description: Parses and processes telemetry counters for VFs and PFs.
  • Updates the telemetryGatherer with the parsed metrics. ****************************************************************************

func VrbparseDeviceStatus

func VrbparseDeviceStatus(lines []string, pfPciAddr string, vfs []vrbv1.VF, telemetryGatherer *telemetryGatherer, log *logrus.Logger)

*****************************************************************************

  • Function: VrbparseDeviceStatus
  • Description: Parses the device status and updates the telemetryGatherer.
  • Calls parseVFStatus to parse and update the VF status. ****************************************************************************

func VrbparseTelemetry

func VrbparseTelemetry(file []byte, vfs []vrbv1.VF, pciAddr string, telemetryGatherer *telemetryGatherer, logger *logrus.Logger)

func VrbqueueGroupConfigToIniStruct

func VrbqueueGroupConfigToIniStruct(in vrbv1.QueueGroupConfig) queueGroupConfigIniWrapper

func VrbremoveVFs

func VrbremoveVFs(nc *NodeConfigurator, acc vrbv1.SriovAccelerator) error

func VrbunbindVFs

func VrbunbindVFs(nc *NodeConfigurator, acc vrbv1.SriovAccelerator) error

Types

type ConfigurationConditionReason

type ConfigurationConditionReason string

type Configurer

type Configurer interface {
	ApplySpec(nodeConfig fec.SriovFecNodeConfigSpec, fecDeviceUpdateRequired map[string]bool) error
}

type DevicePluginController

type DevicePluginController struct {
	client.Client
	// contains filtered or unexported fields
}

func (*DevicePluginController) RestartDevicePlugin

func (d *DevicePluginController) RestartDevicePlugin() error

type DrainAndExecute

type DrainAndExecute func(configurer func(ctx context.Context) bool, drain bool) error

type FecNodeConfigReconciler

type FecNodeConfigReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func FecNewNodeConfigReconciler

func FecNewNodeConfigReconciler(k8sClient client.Client, drainer DrainAndExecute,
	nodeNameRef types.NamespacedName, sriovfecconfigurer Configurer,
	restartDevicePluginFunction RestartDevicePluginFunction) (r *FecNodeConfigReconciler, err error)

****************************************************************************

  • Function: FecNewNodeConfigReconciler
  • Description: * ***************************************************************************

func (*FecNodeConfigReconciler) CreateEmptyNodeConfigIfNeeded

func (r *FecNodeConfigReconciler) CreateEmptyNodeConfigIfNeeded(c client.Client) error

****************************************************************************

  • Method: FecNodeConfigReconciler::
  • Description:
  • CreateEmptyNodeConfigIfNeeded creates empty CR to be Reconciled in
  • near future and filled with Status.
  • If invoked before manager's Start, it'll need a direct API client
  • (Manager's/Controller's client is cached and cache is not initialized yet). ***************************************************************************

func (*FecNodeConfigReconciler) Reconcile

****************************************************************************

  • Method: FecNodeConfigReconciler::Reconcile
  • Description: * ***************************************************************************

func (*FecNodeConfigReconciler) SetupWithManager

func (r *FecNodeConfigReconciler) SetupWithManager(mgr ctrl.Manager) error

****************************************************************************

  • Method: FecNodeConfigReconciler::
  • Description: * ***************************************************************************

type NodeConfigurator

type NodeConfigurator struct {
	client.Client
	Log *logrus.Logger
	// contains filtered or unexported fields
}

func NewNodeConfigurator

func NewNodeConfigurator(logger *logrus.Logger, pfBBConfigController *pfBBConfigController, client client.Client, nodeNameRef types.NamespacedName) *NodeConfigurator

func (*NodeConfigurator) ApplySpec

func (n *NodeConfigurator) ApplySpec(nodeConfig sriovv2.SriovFecNodeConfigSpec, fecDeviceUpdateRequired map[string]bool) error

func (*NodeConfigurator) VrbApplySpec

func (n *NodeConfigurator) VrbApplySpec(nodeConfig vrbv1.SriovVrbNodeConfigSpec, vrbDeviceUpdateRequired map[string]bool) error

func (*NodeConfigurator) VrbcleanAcceleratorConfig

func (n *NodeConfigurator) VrbcleanAcceleratorConfig(acc vrbv1.SriovAccelerator) error

func (*NodeConfigurator) VrbconfigureAccelerator

func (n *NodeConfigurator) VrbconfigureAccelerator(acc vrbv1.SriovAccelerator, requestedConfig *vrbv1.PhysicalFunctionConfigExt) error

type RestartDevicePluginFunction

type RestartDevicePluginFunction func() error

type VFUnion

type VFUnion interface{}

VFUnion represents a union of fec.VF and vrbv1.VF

type VrbConfigurer

type VrbConfigurer interface {
	VrbApplySpec(nodeConfig vrbv1.SriovVrbNodeConfigSpec, vrbDeviceUpdateRequired map[string]bool) error
}

type VrbNodeConfigReconciler

type VrbNodeConfigReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func VrbNewNodeConfigReconciler

func VrbNewNodeConfigReconciler(k8sClient client.Client, drainer DrainAndExecute, nodeNameRef types.NamespacedName, vrbconfigurer VrbConfigurer, restartDevicePluginFunction RestartDevicePluginFunction) (r *VrbNodeConfigReconciler, err error)

****************************************************************************

  • Function: VrbNewNodeConfigReconciler
  • Description: * ***************************************************************************

func (*VrbNodeConfigReconciler) CreateEmptyNodeConfigIfNeeded

func (r *VrbNodeConfigReconciler) CreateEmptyNodeConfigIfNeeded(c client.Client) error

****************************************************************************

  • Method: VrbNodeConfigReconciler::CreateEmptyNodeConfigIfNeeded
  • Description: * ***************************************************************************

func (*VrbNodeConfigReconciler) Reconcile

****************************************************************************

  • Method: VrbNodeConfigReconciler::Reconcile
  • Description: This function is the main reconciliation loop for the VrbNodeConfig
  • custom resource. It is triggered by changes to the resource and
  • performs the following steps:
  • 1. Reads the VrbNodeConfig resource.
  • 2. Reads the existing inventory of the node.
  • 3. Validates the VrbNodeConfig specification.
  • 4. Checks if the requested configuration refers to non-existing
  • accelerators and updates the status accordingly.
  • 5. Determines if a card update is required based on the current
  • and requested configurations.
  • 6. If an update is required, it updates the status to indicate
  • that the configuration is in progress.
  • 7. Configures the node based on the VrbNodeConfig specification.
  • 8. Updates the status to indicate whether the configuration
  • succeeded or failed. ***************************************************************************

func (*VrbNodeConfigReconciler) SetupWithManager

func (r *VrbNodeConfigReconciler) SetupWithManager(mgr ctrl.Manager) error

****************************************************************************

  • Method: VrbNodeConfigReconciler::SetupWithManager
  • Description: * ***************************************************************************

Jump to

Keyboard shortcuts

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