Documentation ¶
Index ¶
- Constants
- type AllocRequest
- type AllocResp
- type ByPriority
- type Condition
- type ConditionType
- type IP
- type Local
- func (l *Local) Allocate(ctx context.Context, cni *daemon.CNI, request ResourceRequest) (chan *AllocResp, []Trace)
- func (l *Local) Dispose(n int) int
- func (l *Local) Priority() int
- func (l *Local) Release(ctx context.Context, cni *daemon.CNI, request NetworkResource) bool
- func (l *Local) Run(ctx context.Context, podResources []daemon.PodResources, wg *sync.WaitGroup) error
- func (l *Local) Status() Status
- func (l *Local) Usage() (int, int, error)
- type LocalIPRequest
- type LocalIPResource
- type Manager
- func (m *Manager) Allocate(ctx context.Context, cni *daemon.CNI, req *AllocRequest) (NetworkResources, error)
- func (m *Manager) Release(ctx context.Context, cni *daemon.CNI, req *ReleaseRequest) error
- func (m *Manager) Run(ctx context.Context, wg *sync.WaitGroup, podResources []daemon.PodResources) error
- func (m *Manager) Status() []Status
- type NetworkInterface
- type NetworkResource
- type NetworkResources
- type NodeCondition
- type NodeConditionHandler
- type ReleaseRequest
- type Remote
- func (r *Remote) Allocate(ctx context.Context, cni *daemon.CNI, request ResourceRequest) (chan *AllocResp, []Trace)
- func (r *Remote) Dispose(n int) int
- func (r *Remote) Priority() int
- func (r *Remote) Release(ctx context.Context, cni *daemon.CNI, request NetworkResource) bool
- func (r *Remote) Run(ctx context.Context, podResources []daemon.PodResources, wg *sync.WaitGroup) error
- type RemoteIPRequest
- type RemoteIPResource
- type ReportStatus
- type ResourceRequest
- type ResourceType
- type Set
- func (s Set) Add(ip *IP)
- func (s Set) Allocatable() []*IP
- func (s Set) ByPodID(podID string) *IP
- func (s Set) Delete(ip ...netip.Addr)
- func (s Set) Deleting() []netip.Addr
- func (s Set) Idles() []*IP
- func (s Set) InUse() []*IP
- func (s Set) PeekAvailable(podID string) *IP
- func (s Set) PutDeleting(ip ...netip.Addr)
- func (s Set) PutValid(ip ...netip.Addr)
- func (s Set) Release(podID string, ip netip.Addr)
- type Status
- type Trace
- type Trunk
- func (r *Trunk) Allocate(ctx context.Context, cni *daemon.CNI, request ResourceRequest) (chan *AllocResp, []Trace)
- func (r *Trunk) Dispose(n int) int
- func (r *Trunk) Priority() int
- func (r *Trunk) Release(ctx context.Context, cni *daemon.CNI, request NetworkResource) bool
- func (r *Trunk) Run(ctx context.Context, podResources []daemon.PodResources, wg *sync.WaitGroup) error
- func (r *Trunk) Status() Status
- func (r *Trunk) Usage() (int, int, error)
- type Usage
- type Veth
- func (r *Veth) Allocate(ctx context.Context, cni *daemon.CNI, request ResourceRequest) (chan *AllocResp, []Trace)
- func (r *Veth) Dispose(n int) int
- func (r *Veth) Priority() int
- func (r *Veth) Release(ctx context.Context, cni *daemon.CNI, request NetworkResource) bool
- func (r *Veth) Run(ctx context.Context, podResources []daemon.PodResources, wg *sync.WaitGroup) error
- type VethRequest
- type VethResource
Constants ¶
View Source
const ( ResourceTypeLocalIP = 1 << iota ResourceTypeVeth ResourceTypeRemoteIP ResourceTypeRDMA )
View Source
const (
LocalIPTypeERDMA = "ERDMA"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllocRequest ¶
type AllocRequest struct {
ResourceRequests []ResourceRequest
}
AllocRequest represent a bunch of resource must be met.
type AllocResp ¶
type AllocResp struct { Err error NetworkConfigs NetworkResources }
type ByPriority ¶
type ByPriority []NetworkInterface
func (ByPriority) Len ¶
func (n ByPriority) Len() int
func (ByPriority) Less ¶
func (n ByPriority) Less(i, j int) bool
func (ByPriority) Swap ¶
func (n ByPriority) Swap(i, j int)
type ConditionType ¶
type ConditionType int
const ( Full ConditionType = iota ResourceTypeMismatch NetworkInterfaceMismatch InsufficientVSwitchIP )
func (ConditionType) String ¶
func (i ConditionType) String() string
type IP ¶
type IP struct {
// contains filtered or unexported fields
}
func (*IP) Allocatable ¶
func (*IP) SetInvalid ¶
func (ip *IP) SetInvalid()
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
type LocalIPRequest ¶
type LocalIPRequest struct { NetworkInterfaceID string LocalIPType string IPv4 netip.Addr IPv6 netip.Addr NoCache bool // do not use cached ip }
func (*LocalIPRequest) ResourceType ¶
func (l *LocalIPRequest) ResourceType() ResourceType
type LocalIPResource ¶
func (*LocalIPResource) ResourceType ¶
func (l *LocalIPResource) ResourceType() ResourceType
func (*LocalIPResource) ToRPC ¶
func (l *LocalIPResource) ToRPC() []*rpc.NetConf
func (*LocalIPResource) ToStore ¶
func (l *LocalIPResource) ToStore() []daemon.ResourceItem
type Manager ¶
func NewManager ¶
func NewManager(minIdles, maxIdles, total int, syncPeriod time.Duration, networkInterfaces []NetworkInterface, k8s k8s.Kubernetes) *Manager
func (*Manager) Allocate ¶
func (m *Manager) Allocate(ctx context.Context, cni *daemon.CNI, req *AllocRequest) (NetworkResources, error)
Allocate find the resource manager and send the request to it. Caller should roll back the allocated resource if any error happen.
type NetworkInterface ¶
type NetworkInterface interface { Allocate(ctx context.Context, cni *daemon.CNI, request ResourceRequest) (chan *AllocResp, []Trace) Release(ctx context.Context, cni *daemon.CNI, request NetworkResource) bool Priority() int Dispose(n int) int Run(ctx context.Context, podResources []daemon.PodResources, wg *sync.WaitGroup) error }
type NetworkResource ¶
type NetworkResource interface { ResourceType() ResourceType ToRPC() []*rpc.NetConf ToStore() []daemon.ResourceItem }
type NetworkResources ¶
type NetworkResources []NetworkResource
type NodeCondition ¶
type NodeCondition struct {
// contains filtered or unexported fields
}
func (*NodeCondition) Run ¶
func (n *NodeCondition) Run()
func (*NodeCondition) SetIPExhaustive ¶
func (n *NodeCondition) SetIPExhaustive()
func (*NodeCondition) UnsetIPExhaustive ¶
func (n *NodeCondition) UnsetIPExhaustive()
type NodeConditionHandler ¶
type NodeConditionHandler func(status corev1.ConditionStatus, reason, message string) error
type ReleaseRequest ¶
type ReleaseRequest struct {
NetworkResources []NetworkResource
}
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
type RemoteIPRequest ¶
type RemoteIPRequest struct{}
func (*RemoteIPRequest) ResourceType ¶
func (l *RemoteIPRequest) ResourceType() ResourceType
type RemoteIPResource ¶
type RemoteIPResource struct {
// contains filtered or unexported fields
}
func (*RemoteIPResource) ResourceType ¶
func (l *RemoteIPResource) ResourceType() ResourceType
func (*RemoteIPResource) ToRPC ¶
func (l *RemoteIPResource) ToRPC() []*rpc.NetConf
func (*RemoteIPResource) ToStore ¶
func (l *RemoteIPResource) ToStore() []daemon.ResourceItem
type ReportStatus ¶
type ReportStatus interface {
Status() Status
}
type ResourceRequest ¶
type ResourceRequest interface {
ResourceType() ResourceType
}
type ResourceType ¶
type ResourceType int
type Trace ¶
type Trace struct { Condition ConditionType Reason string }
type Trunk ¶
type Trunk struct {
// contains filtered or unexported fields
}
type VethRequest ¶
type VethRequest struct{}
func (*VethRequest) ResourceType ¶
func (l *VethRequest) ResourceType() ResourceType
type VethResource ¶
type VethResource struct {
Name string
}
func (VethResource) ResourceType ¶
func (v VethResource) ResourceType() ResourceType
func (VethResource) ToRPC ¶
func (v VethResource) ToRPC() []*rpc.NetConf
func (VethResource) ToStore ¶
func (v VethResource) ToStore() []daemon.ResourceItem
Click to show internal directories.
Click to hide internal directories.