Documentation
¶
Index ¶
- Constants
- Variables
- type Context
- func (ctx *Context) EWPorts() ([]pciutil.NICPort, error)
- func (ctx *Context) GetResolvedNVConfig() *ResolvedNVConfig
- func (ctx *Context) NSPorts() ([]pciutil.NICPort, error)
- func (ctx *Context) Ports(scope pciutil.PortScope) ([]pciutil.NICPort, error)
- func (ctx *Context) SetResolvedNVConfig(r *ResolvedNVConfig)
- type DeferredNVConfigParam
- type NVConfigParams
- type Operation
- type ResolvedNVConfig
Constants ¶
const DefaultKubeletKubeconfigPath = "/etc/kubernetes/kubelet.conf"
DefaultKubeletKubeconfigPath is the default path to the kubelet kubeconfig on DPU nodes.
Variables ¶
var ErrBootstrapAborted = errors.New("bootstrap aborted for DPU reprovision")
ErrBootstrapAborted indicates bootstrap exited so the owned-DPU watch can handle reprovision.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// Options are the options for the DPU agent, loaded at startup (e.g. from command line).
Options opts.Options
// RebootMethodDiscovery is set once per agent run before operations execute.
// When true, the agent reports RebootMethodDiscovery=True (device-query path) on status condition;
RebootMethodDiscovery bool
// Client is the controller-runtime client used to fetch Kubernetes objects
// (e.g. DPU, Secret, BlueFieldSoftware). Both zero-trust and trusted-host
// modes use the same client; trusted-host routes through an HTTP proxy.
Client client.Client
// WatchClient watches DPU CR changes for owned-DPU reprovision reconcile.
WatchClient client.WithWatch
// K8sClient is the typed kubernetes clientset, used by operations that need
// APIs not exposed by the controller-runtime client (e.g. Discovery).
K8sClient kubernetes.Interface
// DPUFlavor is the live DPUFlavor named by LatestDPU.spec.dpuFlavor.
// GetLatestDPU loads it from the API on each Run(); operations must not read a disk snapshot.
DPUFlavor provisioningv1.DPUFlavor
// LatestDPU is the current DPU resource, populated by GetLatestDPU.
// Operations use it to read spec/status and to decide behavior.
LatestDPU *provisioningv1.DPU
// Status is the in-memory DPU internal status. Operations read and update it;
// the agent pushes it to the API via the runner's updateStatus method.
Status provisioningv1.AgentStatus
// CondMessage is cleared before each operation attempt. On success, dpuagent
// truncates and writes it to the operation condition message.
CondMessage string
// DeferredNVConfigParams lists flavor NVConfig parameters not exposed by mlxconfig q
// on the current pass (device-query path). Populated by nvconfig; reboot fails with
// NoAction while any entries remain because they cannot be applied without a reboot.
DeferredNVConfigParams []DeferredNVConfigParam
// CurrentBootID caches the current host boot_id for this agent run so reboot
// operations do not need to read it repeatedly.
CurrentBootID string
// DiscoverPorts discovers physical NIC ports for the given scope.
// If nil, DefaultPortDiscoverer.DiscoverPhysicalPort(FilterForScope(scope)) is used.
// Tests inject this to stub discovery for N/S, E/W, or all.
DiscoverPorts func(scope pciutil.PortScope) ([]pciutil.NICPort, error)
// GrubConfigChanged is set by ConfigureKernelCmdLine when it writes a new grub config
// and runs update-grub. HandleReboot uses this to force a reboot even when the reboot
// method is NoAction, so that the new kernel parameters take effect.
GrubConfigChanged bool
// UpdateStatusUntilSuccess, when set, pushes Status to the API until success (e.g. agent's updateStatusUntilSuccess).
// Used by operations that must ensure status is persisted before continuing (e.g. before shutdown).
//
// It may be invoked twice for the same execution: once from inside Execute
// and once from Run() when ShouldUpdateStatusBeforeContinue is true. Calling it twice is safe: the same
// status is pushed again, so the result is idempotent; at most it causes one redundant API call.
// Returns an error when status update must abort (e.g. reprovision detection).
UpdateStatusUntilSuccess func(context.Context) error
// ClearHostOSInit requests a null merge patch of agentStatus.hostOSInit on the next status update.
ClearHostOSInit bool
// SRIOVState holds sriovconfig plans for the shared device-plugin config.
// Untyped to avoid an import cycle; only sriovconfig.sharedState should read it.
SRIOVState any
// contains filtered or unexported fields
}
Context is the context for all operations. It is passed to all operations and can be used to pass data between operations. Since the Context is not thread-safe, do not access it from multiple goroutines.
func (*Context) EWPorts ¶
EWPorts returns the discovered E/W NIC ports, running discovery on the first successful call and caching the result. Errors are NOT cached so that the caller's retry loop will re-attempt discovery.
func (*Context) GetResolvedNVConfig ¶
func (ctx *Context) GetResolvedNVConfig() *ResolvedNVConfig
GetResolvedNVConfig returns the cached ResolvedNVConfig, or nil if not yet resolved.
func (*Context) NSPorts ¶
NSPorts returns the discovered N/S NIC ports, running discovery on the first successful call and caching the result. Errors are NOT cached so that the caller's retry loop will re-attempt discovery.
func (*Context) Ports ¶
Ports returns physical NIC ports for scope. N/S and E/W results are cached separately on first success; PortScopeAll is not cached.
func (*Context) SetResolvedNVConfig ¶
func (ctx *Context) SetResolvedNVConfig(r *ResolvedNVConfig)
SetResolvedNVConfig caches a successful resolve. Call only after full success; do not cache errors (same semantics as NSPorts).
type DeferredNVConfigParam ¶
DeferredNVConfigParam is one deferred mlxconfig set request for a PCI device.
type NVConfigParams ¶
type NVConfigParams struct {
// Params is the space-joined NVConfig parameters (empty = reset-only).
Params string
// Force applies the batch with --force and skips the mlxconfig q deferral filter.
Force bool
}
NVConfigParams is the resolved apply plan for one PCI function. Params and Force are kept together so the flag cannot drift away from the parameters it applies to.
type Operation ¶
type Operation interface {
Name() string
ConditionType() string
Execute(execCtx context.Context, optCtx *Context) error
ShouldSkip(optCtx *Context) bool
ShouldUpdateStatusBeforeContinue(optCtx *Context) bool
}
Operation is the interface for all operations. The same optCtx instance is passed to all operations, which can be used to pass data between operations. Since the optCtx is not thread-safe, do not execute operations in parallel.
type ResolvedNVConfig ¶
type ResolvedNVConfig struct {
// PCIToParams maps PCI address to its resolved apply plan.
PCIToParams map[string]NVConfigParams
// HostOSInitPCIs are the sorted PCI devices used for mlxreg host OS init release.
HostOSInitPCIs []string
// HostOSInitRequired is true when flavor nvconfig requests DELAY_HOST_OS_INIT user-mode (0x3).
HostOSInitRequired bool
}
ResolvedNVConfig is the once-resolved view of DPUFlavor.spec.nvconfig against discovered N/S ports.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sriovconfig creates the SR-IOV functions a DPUFlavor declares: the Scalable Functions of spec.scalableFunctions (plus the DMA SF of spec.dma) and the Virtual Functions of spec.virtualFunctions.
|
Package sriovconfig creates the SR-IOV functions a DPUFlavor declares: the Scalable Functions of spec.scalableFunctions (plus the DMA SF of spec.dma) and the Virtual Functions of spec.virtualFunctions. |