Documentation ¶
Index ¶
- func Add(left *si.Resource, right *si.Resource) *si.Resource
- func CreateAllocationRequestForTask(appID, taskID string, resource *si.Resource, placeholder bool, ...) si.AllocationRequest
- func CreateReleaseAllocationRequestForTask(appID, allocUUID, partition, terminationType string) si.AllocationRequest
- func CreateReleaseAskRequestForTask(appID, taskID, partition string) si.AllocationRequest
- func CreateTagsForTask(pod *v1.Pod) map[string]string
- func CreateUpdateRequestForDeleteOrRestoreNode(nodeID string, action si.NodeInfo_ActionFromRM) si.NodeRequest
- func CreateUpdateRequestForNewNode(nodeID string, capacity *si.Resource, occupied *si.Resource, ...) si.NodeRequest
- func CreateUpdateRequestForRemoveApplication(appID, partition string) si.ApplicationRequest
- func CreateUpdateRequestForUpdatedNode(nodeID string, capacity *si.Resource, occupied *si.Resource, ready bool) si.NodeRequest
- func Equals(left *si.Resource, right *si.Resource) bool
- func GetNodeResource(nodeStatus *v1.NodeStatus) *si.Resource
- func GetPodResource(pod *v1.Pod) (resource *si.Resource)
- func GetTGResource(resMap map[string]resource.Quantity, members int64) *si.Resource
- func GetTerminationTypeFromString(terminationTypeStr string) si.TerminationType
- func IsZero(r *si.Resource) bool
- func ParseResource(cpuStr, memStr string) *si.Resource
- func Sub(left *si.Resource, right *si.Resource) *si.Resource
- type ResourceBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateReleaseAllocationRequestForTask ¶
func CreateReleaseAllocationRequestForTask(appID, allocUUID, partition, terminationType string) si.AllocationRequest
func CreateReleaseAskRequestForTask ¶
func CreateReleaseAskRequestForTask(appID, taskID, partition string) si.AllocationRequest
func CreateUpdateRequestForDeleteOrRestoreNode ¶
func CreateUpdateRequestForDeleteOrRestoreNode(nodeID string, action si.NodeInfo_ActionFromRM) si.NodeRequest
CreateUpdateRequestForDeleteOrRestoreNode builds a NodeRequest for Node actions like drain, decommissioning & restore
func CreateUpdateRequestForNewNode ¶
func CreateUpdateRequestForNewNode(nodeID string, capacity *si.Resource, occupied *si.Resource, existingAllocations []*si.Allocation, ready bool) si.NodeRequest
CreateUpdateRequestForNewNode builds a NodeRequest for new node addition and restoring existing node
func CreateUpdateRequestForRemoveApplication ¶
func CreateUpdateRequestForRemoveApplication(appID, partition string) si.ApplicationRequest
func CreateUpdateRequestForUpdatedNode ¶
func CreateUpdateRequestForUpdatedNode(nodeID string, capacity *si.Resource, occupied *si.Resource, ready bool) si.NodeRequest
CreateUpdateRequestForUpdatedNode builds a NodeRequest for any node updates like capacity, ready status flag etc
func GetNodeResource ¶
func GetNodeResource(nodeStatus *v1.NodeStatus) *si.Resource
func GetPodResource ¶
Get the resources from a pod's containers and convert that into a internal resource. A pod has two resource parts: Requests and Limits. Based on the values a pod gets a QOS assigned, as per https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/ QOS class Guaranteed and Burstable are supported. However Burstable is scheduled based on the request values, limits are ignored in the current setup. BestEffort pods are scheduled using a minimum resource of 1MB only.
func GetTGResource ¶
func GetTerminationTypeFromString ¶
func GetTerminationTypeFromString(terminationTypeStr string) si.TerminationType
func ParseResource ¶
parse cpu and memory from string to si.Resource, both of them are optional if parse failed with some errors, log the error and return a nil
Types ¶
type ResourceBuilder ¶
type ResourceBuilder struct {
// contains filtered or unexported fields
}
resource builder is a helper struct to construct si resources
func NewResourceBuilder ¶
func NewResourceBuilder() *ResourceBuilder
func (*ResourceBuilder) AddResource ¶
func (w *ResourceBuilder) AddResource(name string, value int64) *ResourceBuilder
func (*ResourceBuilder) Build ¶
func (w *ResourceBuilder) Build() *si.Resource