mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
commit
d88994cf9f
@ -49,7 +49,7 @@ type Data struct {
|
|||||||
Checksum checksum.Checksum
|
Checksum checksum.Checksum
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDeviceManagerCheckpoint returns an instance of Checkpoint
|
// New returns an instance of Checkpoint
|
||||||
func New(devEntries []PodDevicesEntry,
|
func New(devEntries []PodDevicesEntry,
|
||||||
devices map[string][]string) DeviceManagerCheckpoint {
|
devices map[string][]string) DeviceManagerCheckpoint {
|
||||||
return &Data{
|
return &Data{
|
||||||
|
@ -54,7 +54,7 @@ type endpointImpl struct {
|
|||||||
cb monitorCallback
|
cb monitorCallback
|
||||||
}
|
}
|
||||||
|
|
||||||
// newEndpoint creates a new endpoint for the given resourceName.
|
// newEndpointImpl creates a new endpoint for the given resourceName.
|
||||||
// This is to be used during normal device plugin registration.
|
// This is to be used during normal device plugin registration.
|
||||||
func newEndpointImpl(socketPath, resourceName string, callback monitorCallback) (*endpointImpl, error) {
|
func newEndpointImpl(socketPath, resourceName string, callback monitorCallback) (*endpointImpl, error) {
|
||||||
client, c, err := dial(socketPath)
|
client, c, err := dial(socketPath)
|
||||||
|
@ -125,7 +125,7 @@ func newManagerImpl(socketPath string) (*ManagerImpl, error) {
|
|||||||
}
|
}
|
||||||
manager.callback = manager.genericDeviceUpdateCallback
|
manager.callback = manager.genericDeviceUpdateCallback
|
||||||
|
|
||||||
// The following structs are populated with real implementations in manager.Start()
|
// The following structures are populated with real implementations in manager.Start()
|
||||||
// Before that, initializes them to perform no-op operations.
|
// Before that, initializes them to perform no-op operations.
|
||||||
manager.activePods = func() []*v1.Pod { return []*v1.Pod{} }
|
manager.activePods = func() []*v1.Pod { return []*v1.Pod{} }
|
||||||
manager.sourcesReady = &sourcesReadyStub{}
|
manager.sourcesReady = &sourcesReadyStub{}
|
||||||
@ -189,8 +189,8 @@ func (m *ManagerImpl) checkpointFile() string {
|
|||||||
return filepath.Join(m.socketdir, kubeletDeviceManagerCheckpoint)
|
return filepath.Join(m.socketdir, kubeletDeviceManagerCheckpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start starts the Device Plugin Manager amd start initialization of
|
// Start starts the Device Plugin Manager and start initialization of
|
||||||
// podDevices and allocatedDevices information from checkpoint-ed state and
|
// podDevices and allocatedDevices information from checkpointed state and
|
||||||
// starts device plugin registration service.
|
// starts device plugin registration service.
|
||||||
func (m *ManagerImpl) Start(activePods ActivePodsFunc, sourcesReady config.SourcesReady) error {
|
func (m *ManagerImpl) Start(activePods ActivePodsFunc, sourcesReady config.SourcesReady) error {
|
||||||
klog.V(2).Infof("Starting Device Plugin manager")
|
klog.V(2).Infof("Starting Device Plugin manager")
|
||||||
@ -669,7 +669,7 @@ func (m *ManagerImpl) allocateContainerResources(pod *v1.Pod, container *v1.Cont
|
|||||||
// and container2 both require X resource A and Y resource B. Both allocation
|
// and container2 both require X resource A and Y resource B. Both allocation
|
||||||
// requests may fail if we serve them in mixed order.
|
// requests may fail if we serve them in mixed order.
|
||||||
// TODO: may revisit this part later if we see inefficient resource allocation
|
// TODO: may revisit this part later if we see inefficient resource allocation
|
||||||
// in real use as the result of this. Should also consider to parallize device
|
// in real use as the result of this. Should also consider to parallelize device
|
||||||
// plugin Allocate grpc calls if it becomes common that a container may require
|
// plugin Allocate grpc calls if it becomes common that a container may require
|
||||||
// resources from multiple device plugins.
|
// resources from multiple device plugins.
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user