Documentation
¶
Index ¶
- Constants
- func BuildCDIDevices(kind, sanitizedClass, id string, annotations map[string]string, envVar string) (*cdispec.Spec, string, string, []*pluginapi.CDIDevice)
- func EnsureNvmlInitialized() error
- func ShutdownNvml()
- func StartDevicePlugins(ctx context.Context, kubeConfig *rest.Config) error
- func UpdateAllocationStatus(ctx context.Context, client versioned.Interface, ...) (*instav1.AllocationClaim, error)
- func WriteCDISpecForResource(resourceName string, id string, annotations map[string]string, envVar string) (string, []*pluginapi.CDIDevice, error)
- type EmulatedMigGpuDiscoverer
- type Manager
- type MigGpuDiscoverer
- type MigProfile
- type RealMigGpuDiscoverer
- type Registrar
- type Server
- func (s *Server) Allocate(ctx context.Context, req *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
- func (s *Server) GetDevicePluginOptions(ctx context.Context, req *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)
- func (s *Server) ListAndWatch(req *pluginapi.Empty, stream pluginapi.DevicePlugin_ListAndWatchServer) error
- func (s *Server) PreStartContainer(ctx context.Context, req *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error)
- func (s *Server) Start(ctx context.Context) error
Constants ¶
const ( // AttributeMediaExtensions indicates the MIG profile supports media // extensions. This mirrors the upstream constant used in the older // controller implementation. AttributeMediaExtensions = "me" )
Variables ¶
This section is empty.
Functions ¶
func BuildCDIDevices ¶
func BuildCDIDevices(kind, sanitizedClass, id string, annotations map[string]string, envVar string) (*cdispec.Spec, string, string, []*pluginapi.CDIDevice)
BuildCDIDevices builds a CDI spec and returns the spec object, spec name, spec path, and the corresponding CDIDevice slice. This helper is exported so that other packages (and tests) can generate CDI specs in a consistent way.
func EnsureNvmlInitialized ¶
func EnsureNvmlInitialized() error
EnsureNvmlInitialized initializes NVML only once. Subsequent calls return the initialization result from the first attempt.
func ShutdownNvml ¶
func ShutdownNvml()
ShutdownNvml shuts down NVML the first time it is called. It can be safely deferred from multiple places.
func StartDevicePlugins ¶
StartDevicePlugins starts device managers, gRPC servers, and registrars for each resource.
func UpdateAllocationStatus ¶
func UpdateAllocationStatus(ctx context.Context, client versioned.Interface, alloc *instav1.AllocationClaim, status instav1.AllocationClaimState) (*instav1.AllocationClaim, error)
UpdateAllocationStatus safely updates the status of the given AllocationClaim using the provided client while holding the allocation mutex. This prevents multiple goroutines from updating the same object concurrently.
func WriteCDISpecForResource ¶
func WriteCDISpecForResource(resourceName string, id string, annotations map[string]string, envVar string) (string, []*pluginapi.CDIDevice, error)
WriteCDISpecForResource parses the given resource name, generates a CDI spec using BuildCDIDevices and writes it to the CDI cache. It returns the path to the written spec along with the generated CDIDevices.
Types ¶
type EmulatedMigGpuDiscoverer ¶
type EmulatedMigGpuDiscoverer struct {
// contains filtered or unexported fields
}
EmulatedMigGpuDiscoverer implements MigGpuDiscoverer for emulated mode.
func (*EmulatedMigGpuDiscoverer) Discover ¶
func (e *EmulatedMigGpuDiscoverer) Discover() (*instav1.NodeAccelerator, error)
type Manager ¶
type Manager struct {
// ResourceName is the extended-resource string (e.g. "mig.das.com/1g.5gb").
ResourceName string
// contains filtered or unexported fields
}
Manager tracks and monitors devices for a specific extended-resource. It drives discovery and health monitoring and pushes device updates.
func NewManager ¶
func NewManager(resourceName string, resources instav1.DiscoveredNodeResources) *Manager
NewManager creates a Manager for the given extended-resource name.
type MigGpuDiscoverer ¶
type MigGpuDiscoverer interface {
Discover() (*instav1.NodeAccelerator, error)
}
MigGpuDiscoverer is an interface for MIG GPU discovery implementations. Discover returns the NodeAccelerator object containing the discovered resources for the node.
type MigProfile ¶
MigProfile represents a MIG profile in a human readable format. The NVML library provides integer identifiers which are cumbersome to work with directly.
func NewMigProfile ¶
func NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int, giSliceCount, ciSliceCount uint32, migMemorySizeMB, totalDeviceMemoryBytes uint64) *MigProfile
NewMigProfile constructs a new MigProfile using details from the GPU and compute instance profiles.
func (MigProfile) Attributes ¶
func (m MigProfile) Attributes() []string
Attributes returns any attribute strings associated with this profile.
func (MigProfile) String ¶
func (m MigProfile) String() string
String returns the canonical string representation of the MIG profile, e.g. "1g.5gb".
type RealMigGpuDiscoverer ¶
type RealMigGpuDiscoverer struct {
// contains filtered or unexported fields
}
RealMigGpuDiscoverer implements MigGpuDiscoverer for real hardware.
func (*RealMigGpuDiscoverer) Discover ¶
func (r *RealMigGpuDiscoverer) Discover() (*instav1.NodeAccelerator, error)
type Registrar ¶
Registrar handles registration of a device-plugin socket with the kubelet.
func NewRegistrar ¶
NewRegistrar constructs a Registrar for the given socket and resource.
type Server ¶
type Server struct {
pluginapi.UnimplementedDevicePluginServer
Manager *Manager
SocketPath string
InstasliceClient instaclient.Interface
KubeClient kubernetes.Interface
DynamicClient dynamic.Interface
NodeName string
EmulatedMode instav1.EmulatedMode
// contains filtered or unexported fields
}
func (*Server) Allocate ¶
func (s *Server) Allocate(ctx context.Context, req *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
func (*Server) GetDevicePluginOptions ¶
func (s *Server) GetDevicePluginOptions(ctx context.Context, req *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)
GetDevicePluginOptions returns the options supported by the device plugin.
func (*Server) ListAndWatch ¶
func (s *Server) ListAndWatch(req *pluginapi.Empty, stream pluginapi.DevicePlugin_ListAndWatchServer) error
ListAndWatch streams the list of devices, sending initial list and subsequent updates.
func (*Server) PreStartContainer ¶
func (s *Server) PreStartContainer(ctx context.Context, req *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error)