common

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomResources

type CustomResources map[corev1.ResourceName]resource.Quantity

CustomResources is a key-value map for defining custom resources

func (CustomResources) DeepCopy

func (cr CustomResources) DeepCopy() CustomResources

DeepCopy copy the custom resource

func (CustomResources) Equal

func (cr CustomResources) Equal(other CustomResources) bool

Equal return if resources is equal

type ProviderNode

type ProviderNode struct {
	sync.Mutex
	*corev1.Node
}

ProviderNode defines the virtual kubelet node of tensile-kube

func (*ProviderNode) AddResource

func (n *ProviderNode) AddResource(resource *Resource) error

AddResource add resource to the node

func (*ProviderNode) DeepCopy

func (n *ProviderNode) DeepCopy() *corev1.Node

DeepCopy deepcopy node with lock, to avoid concurrent read-write

func (*ProviderNode) SubResource

func (n *ProviderNode) SubResource(resource *Resource) error

SubResource sub resource from the node

type Resource

type Resource struct {
	// CPU requirement
	CPU resource.Quantity
	// Memory requirement
	Memory resource.Quantity
	// Pods requirement
	Pods resource.Quantity
	// EphemeralStorage requirement
	EphemeralStorage resource.Quantity
	// Custom resource requirement
	Custom CustomResources
}

Resource defines the resources of a pod, it provides func `Add`, `Sub` to make computation flexible

func ConvertResource

func ConvertResource(resources corev1.ResourceList) *Resource

ConvertResource converts ResourceList to Resource

func NewResource

func NewResource() *Resource

NewResource returns A resource struct

func (*Resource) Add

func (r *Resource) Add(nc *Resource)

Add adds resource to the current one

func (*Resource) Equal

func (r *Resource) Equal(other *Resource) bool

Equal is for two resources comparision

func (*Resource) SetCapacityToNode

func (r *Resource) SetCapacityToNode(node *corev1.Node)

SetCapacityToNode set the resource the virtual-kubelet node

func (*Resource) Sub

func (r *Resource) Sub(nc *Resource)

Sub subs resource from the current one

Jump to

Keyboard shortcuts

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