util

package
v0.38.4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	True = "True"

	OneMegaByte = int64(1024 * 1024)
	OneMBPS     = int64(1000000)

	ResourceGpu     = "nvidia.com/gpu"
	ResourceNetwork = "titus/network"
)

Variables

View Source
var (
	// Deprecated
	ComputeResourceLowCPU = titusPool.ComputeResource{
		CPU:         1,
		GPU:         0,
		MemoryMB:    8096,
		DiskMB:      16384,
		NetworkMBPS: 256,
	}
	ComputeResourcesRegular = titusPool.ComputeResource{
		CPU:         4,
		GPU:         0,
		MemoryMB:    8096,
		DiskMB:      16384,
		NetworkMBPS: 256,
	}
	ComputeResourcesHighCPU = titusPool.ComputeResource{
		CPU:         20,
		GPU:         0,
		MemoryMB:    8096,
		DiskMB:      16384,
		NetworkMBPS: 256,
	}

	// Proportional resoure allocation across all dimensions (excluding GPU which is a special case).
	ComputeResourcesUnitProportional = titusPool.ComputeResource{
		CPU:         1,
		GPU:         0,
		MemoryMB:    8096,
		DiskMB:      16384,
		NetworkMBPS: 256,
	}

	MachineFromUnitProportional96 = func() *machineTypeV1.MachineTypeConfig {
		return &machineTypeV1.MachineTypeConfig{
			ObjectMeta: v12.ObjectMeta{
				Name:      "test.proportional96",
				Namespace: "default",
			},
			Spec: machineTypeV1.MachineType{
				Name:            "m5.metal",
				ComputeResource: ComputeResourcesUnitProportional.Multiply(96),
			},
		}
	}
)

Functions

func ConvertComputeResourceToResourceGroups added in v0.38.4

func ConvertComputeResourceToResourceGroups(cr v12.ComputeResource, shape v12.ComputeResource) v13.ResourceGroups

func ConvertResourceGroupsToComputeResource added in v0.38.4

func ConvertResourceGroupsToComputeResource(groups v13.ResourceGroups) v12.ComputeResource

func FindLabel

func FindLabel(labels map[string]string, labelName string) (string, bool)

func FromComputeResourceToResourceList

func FromComputeResourceToResourceList(resources v12.ComputeResource) v1.ResourceList

func FromResourceListToComputeResource

func FromResourceListToComputeResource(limits v1.ResourceList) v12.ComputeResource

FIXME Resources are in MB but should be in bytes

func GetGpu added in v0.13.0

func GetGpu(limits v1.ResourceList) int64

func HasLabelAndValue

func HasLabelAndValue(labels map[string]string, labelName string, value string) bool

func ToJSONString

func ToJSONString(value interface{}) string

Types

type FormatDetailsLevel

type FormatDetailsLevel int
const (
	FormatCompact    FormatDetailsLevel = 0
	FormatEssentials FormatDetailsLevel = 1
	FormatDetails    FormatDetailsLevel = 2
)

type FormatterOptions

type FormatterOptions struct {
	Level FormatDetailsLevel
}

type NodeAndPods

type NodeAndPods struct {
	Node *v1.Node
	Pods []*v1.Pod
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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