topology

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNumaTopologyStatus

func GenerateNumaTopologyStatus(
	socketStatusMap map[int]*nodev1alpha1.SocketStatus,
	numaStatusMap map[int]*nodev1alpha1.NumaStatus,
) *nodev1alpha1.TopologyStatus

GenerateNumaTopologyStatus generate numa topology status by merging socket status and numa status according to the numa id, and sort them to get stable result at the end.

func GenerateSocketStatus

func GenerateSocketStatus(
	numaCapacity map[int]*v1.ResourceList,
	numaAllocatable map[int]*v1.ResourceList,
	numa2socket map[int]int,
) map[int]*nodev1alpha1.SocketStatus

GenerateSocketStatus generate a map of socket id to socket status, which includes numa id and numa capacity of each socket.

func GetNumaToSocketMap

func GetNumaToSocketMap(nodes []info.Node) map[int]int

GetNumaToSocketMap parse numa info to get the map of numa id to socket id

Types

type Adapter

type Adapter interface {
	// GetNumaTopologyStatus return newest numa topology status
	GetNumaTopologyStatus(ctx context.Context) (*nodev1alpha1.TopologyStatus, error)

	// Run start Adapter with stop and notify channel
	Run(ctx context.Context, notify chan struct{}) error
}

Adapter is to get numa topology status, the src of that can be kubelet checkpoint file or pod resource api in the future.

func NewPodResourcesServerTopologyAdapter

func NewPodResourcesServerTopologyAdapter(metaServer *metaserver.MetaServer, endpoints []string,
	skipNumaAllocatableDeviceNames sets.String, numaInfoGetter NumaInfoGetter,
	podNumaBindingFilter func(*v1.Pod) bool, getClientFunc podresources.GetClientFunc) (Adapter, error)

NewPodResourcesServerTopologyAdapter creates a topology adapter which uses pod resources server

type DummyAdapter

type DummyAdapter struct{}

DummyAdapter is a dummy topology adapter for test

func (DummyAdapter) GetNumaTopologyStatus

func (d DummyAdapter) GetNumaTopologyStatus(ctx context.Context) (*nodev1alpha1.TopologyStatus, error)

GetNumaTopologyStatus is to get dummy numa topology status

func (DummyAdapter) Run

func (d DummyAdapter) Run(_ context.Context, _ chan struct{}) error

Run is to start the dummy topology adapter

type NumaInfoGetter

type NumaInfoGetter func() ([]info.Node, error)

NumaInfoGetter is to get numa info

Jump to

Keyboard shortcuts

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