Documentation ¶
Index ¶
- Constants
- Variables
- func AddNodeNameIndexerForPod(podInformer v1.PodInformer) error
- func AddResources(a, b v1.ResourceList) v1.ResourceList
- func AggregateAvgQuantities(quantities []resource.Quantity) *resource.Quantity
- func AggregateMaxQuantities(quantities []resource.Quantity) *resource.Quantity
- func AggregateSumQuantities(quantities []resource.Quantity) *resource.Quantity
- func ApplyPodResources(resources map[string]v1.ResourceRequirements, pod *v1.Pod)
- func CalculateResource(pod *v1.Pod) v1.ResourceList
- func CheckContainerNotRunning(pod *v1.Pod, containerName string) (bool, error)
- func CheckDaemonPod(pod *v1.Pod) bool
- func CheckObjectEqual(obj1, obj2 metav1.Object) bool
- func CheckQosClassChanged(resources map[string]v1.ResourceRequirements, pod *v1.Pod) (bool, error)
- func DeepCopyPodContainers(pod *v1.Pod) (containers []v1.Container)
- func DefaultCPUQuantityGetter(resourceList v1.ResourceList) resource.Quantity
- func DefaultMemoryQuantityGetter(resourceList v1.ResourceList) resource.Quantity
- func EmitResourceMetrics(name string, resourceList v1.ResourceList, tags map[string]string, ...)
- func FilterOutDeletingUnstructured(objList []*unstructured.Unstructured) []*unstructured.Unstructured
- func FilterOutSkipEvictionPods(pods []*v1.Pod, filterOutAnnotations, filterOutLabels sets.String) []*v1.Pod
- func FilterPodAnnotations(filterKeys []string, pod *v1.Pod) map[string]string
- func FilterPods(pods []*v1.Pod, filterFunc func(*v1.Pod) (bool, error)) []*v1.Pod
- func GenerateContainerName(containerName string) consts.ContainerName
- func GenerateDynamicResourceByGVR(gvr schema.GroupVersionResource) string
- func GenerateNamespaceNameKey(namespace, name string) string
- func GenerateObjectOwnerReferenceKey(reference metav1.OwnerReference) string
- func GeneratePodContainerName(podName, containerName string) consts.PodContainerName
- func GenerateUniqGVRNameKey(gvr string, workload metav1.Object) (string, error)
- func GenerateUniqObjectNameKey(obj metav1.Object) string
- func GenerateUniqObjectUIDKey(obj metav1.Object) string
- func GetAndUnmarshalForHttps(ctx context.Context, port int, nodeAddress, endpoint, authTokenFile string, ...) error
- func GetContainerEnvs(pod *v1.Pod, containerName string, envs ...string) map[string]string
- func GetContainerID(pod *v1.Pod, containerName string) (string, error)
- func GetNamespacedNameListFromSlice(podSlice []*v1.Pod) []string
- func GetNonzeroQoSRequests(requests *v1.ResourceList) (int64, int64)
- func GetPodCondition(pod *v1.Pod, conditionType v1.PodConditionType) (v1.PodCondition, bool)
- func GetPodHostIP(pod *v1.Pod) (string, bool)
- func GetPodListForWorkload(workloadObj runtime.Object, podIndexer cache.Indexer, labelKeyList []string, ...) ([]*core.Pod, error)
- func GetPodNamespaceNameKeyMap(podList []*v1.Pod) map[string]*v1.Pod
- func GetPodTransformer() (cache.TransformFunc, bool)
- func GetPodsAssignedToNode(nodeName string, podIndexer cache.Indexer) ([]*core.Pod, error)
- func GetRequestForQoSResource(resource v1.ResourceName, requests *v1.ResourceList, nonZero bool) int64
- func GetUnstructuredPodTemplateSpec(object *unstructured.Unstructured) (*v1.PodTemplateSpec, error)
- func GetUnstructuredSelector(object *unstructured.Unstructured) (labels.Selector, error)
- func GetUnstructuredTemplateAnnotations(object *unstructured.Unstructured) (map[string]string, error)
- func IsAssignedPod(pod *v1.Pod) bool
- func IsResourceGreaterThan(a resource.Quantity, b resource.Quantity) bool
- func MergeResources(updateList ...*v1.ResourceList) *v1.ResourceList
- func MultiplyMilliQuantity(quantity resource.Quantity, y float64) resource.Quantity
- func MultiplyQuantity(quantity resource.Quantity, y float64) resource.Quantity
- func MultiplyResourceQuantity(resourceName v1.ResourceName, quantity resource.Quantity, y float64) resource.Quantity
- func NewPodSourceImpList(pods []*v1.Pod) general.SourceList
- func NodeReady(node *v1.Node) bool
- func ObjectOwnerReferenceIndex(o interface{}) ([]string, error)
- func ParseContainerName(key consts.ContainerName) string
- func ParseHostPortForPod(pod *v1.Pod, portName string) (int32, bool)
- func ParseHostPortsForContainer(container *v1.Container, portName string) (int32, bool)
- func ParseNamespaceNameUIDKey(key string) (string, string, string, error)
- func ParsePodContainerName(key consts.PodContainerName) (string, string, error)
- func ParseUniqGVRNameKey(key string) (gvr string, namespace string, name string, err error)
- func ParseUniqObjectUIDKey(key string) (namespace string, name string, uid string, err error)
- func PodAndContainersAreTerminal(pod *v1.Pod) (containersTerminal, podWorkerTerminal bool)
- func PodAnnotationFilter(pod *v1.Pod, key, value string) bool
- func PodCPURequestCmpFunc(i1, i2 interface{}) int
- func PodGuaranteedCPUs(pod *v1.Pod) int
- func PodIsActive(pod *v1.Pod) bool
- func PodIsPending(pod *v1.Pod) bool
- func PodIsReady(pod *v1.Pod) bool
- func PodIsTerminated(pod *v1.Pod) bool
- func PodPriorityCmpFunc(i1, i2 interface{}) int
- func PodResourceDiff(pod *v1.Pod, containerResourcesToUpdate map[string]v1.ResourceRequirements) bool
- func PodUniqKeyCmpFunc(i1, i2 interface{}) int
- func ResourceQuantityToInt64Value(resourceName v1.ResourceName, quantity resource.Quantity) int64
- func ResourcesEqual(a, b v1.ResourceList) bool
- func ResourcesLess(a, b v1.ResourceList, resourceNameList []v1.ResourceName) bool
- func SetCPUQuantityGetter(getter QuantityGetter)
- func SetMemoryQuantityGetter(getter QuantityGetter)
- func SetPodTransformer(f PodTransformerFunc)
- func SumUpPodLimitResources(pod *v1.Pod) v1.ResourceList
- func SumUpPodRequestResources(pod *v1.Pod) v1.ResourceList
- func ToSchemaGVR(group, version, resource string) schema.GroupVersionResource
- func ToUnstructured(obj interface{}) (*unstructured.Unstructured, error)
- func TrimContainerIDPrefix(id string) string
- func VisitUnstructuredAncestors(object *unstructured.Unstructured, ...) bool
- type DynamicInformer
- type DynamicResourcesManager
- type KubeletConfiguration
- type PodLabelIndexer
- type PodResource
- type PodSourceList
- type PodTransformerFunc
- type QoSResource
- type QuantityGetter
- type ResourceThreshold
Constants ¶
const ( ContainerMetricPortName = "metrics" ContainerMetricStorePortName = "store" )
const ( // DefaultReclaimedMilliCPURequest defines default milli reclaimed milli-cpu request number. DefaultReclaimedMilliCPURequest int64 = 100 // 0.1 core // DefaultReclaimedMemoryRequest defines default reclaimed memory request size. DefaultReclaimedMemoryRequest int64 = 200 * 1024 * 1024 // 200 MiB )
For each of these resources, a pod that doesn't request the resource explicitly will be treated as having requested the amount indicated below, for the purpose of computing priority only. This ensures that when scheduling zero-request pods, such pods will not all be scheduled to the machine with the smallest in-use request, and that when scheduling regular pods, such pods will not see zero-request pods as consuming no resources whatsoever. We chose these values to be similar to the resources that we give to cluster addon pods (#10653). But they are pretty arbitrary. As described in #11713, we use request instead of limit to deal with resource requirements.
Variables ¶
var GetPodHostIPs = func(pod *v1.Pod) ([]string, bool) { ip, ok := GetPodHostIP(pod) if !ok { return []string{}, false } return []string{ip}, true }
Functions ¶
func AddNodeNameIndexerForPod ¶ added in v0.4.2
func AddNodeNameIndexerForPod(podInformer v1.PodInformer) error
AddNodeNameIndexerForPod add node name index for pod informer
func AddResources ¶
func AddResources(a, b v1.ResourceList) v1.ResourceList
AddResources sums up two ResourceList, and returns the summed as results.
func AggregateAvgQuantities ¶ added in v0.4.1
AggregateAvgQuantities get the average of the quantities
func AggregateMaxQuantities ¶ added in v0.4.1
AggregateMaxQuantities get the maximum of the quantities
func AggregateSumQuantities ¶ added in v0.4.1
AggregateSumQuantities get the sum of quantities
func ApplyPodResources ¶
func ApplyPodResources(resources map[string]v1.ResourceRequirements, pod *v1.Pod)
ApplyPodResources is used to apply map[string]v1.ResourceRequirements to the given pod, and ignore the container-names / resource-names that not appear in the given map param
func CalculateResource ¶ added in v0.4.0
func CalculateResource(pod *v1.Pod) v1.ResourceList
CalculateResource resourceRequest = max(sum(podSpec.Containers), podSpec.InitContainers)
func CheckContainerNotRunning ¶ added in v0.3.0
CheckContainerNotRunning returns whether the given container is not-runnin
func CheckDaemonPod ¶
CheckDaemonPod returns true if pod is for DaemonSet
func CheckObjectEqual ¶
CheckObjectEqual returns true if uid equals or the namespace/name pair equal
func CheckQosClassChanged ¶
CheckQosClassChanged checks whether the pod's QosClass will change if annotationResources are applied to this pod
func DeepCopyPodContainers ¶ added in v0.2.0
DeepCopyPodContainers returns a deep-copied objects for v1.Container slice
func DefaultCPUQuantityGetter ¶ added in v0.4.0
func DefaultCPUQuantityGetter(resourceList v1.ResourceList) resource.Quantity
DefaultCPUQuantityGetter returns cpu quantity for resourceList. since we may have different representations for cpu resource name, the prioritizes will be: native cpu name -> reclaimed milli cpu name
func DefaultMemoryQuantityGetter ¶ added in v0.4.0
func DefaultMemoryQuantityGetter(resourceList v1.ResourceList) resource.Quantity
DefaultMemoryQuantityGetter returns memory quantity for resourceList. since we may have different representations for memory resource name, the prioritizes will be: native memory name -> reclaimed memory name
func EmitResourceMetrics ¶
func EmitResourceMetrics(name string, resourceList v1.ResourceList, tags map[string]string, emitter metrics.MetricEmitter, )
EmitResourceMetrics emit metrics for given ResourceList.
func FilterOutDeletingUnstructured ¶
func FilterOutDeletingUnstructured(objList []*unstructured.Unstructured) []*unstructured.Unstructured
func FilterOutSkipEvictionPods ¶
func FilterOutSkipEvictionPods(pods []*v1.Pod, filterOutAnnotations, filterOutLabels sets.String) []*v1.Pod
FilterOutSkipEvictionPods return pods should be candidates to evict including native critical pods and user-defined filtered pods
func FilterPodAnnotations ¶ added in v0.2.0
FilterPodAnnotations returns the needed annotations for the given pod.
func FilterPods ¶
FilterPods filter pods that filter func return true.
func GenerateContainerName ¶
func GenerateContainerName(containerName string) consts.ContainerName
GenerateContainerName return a unique key for a container
func GenerateDynamicResourceByGVR ¶ added in v0.2.0
func GenerateDynamicResourceByGVR(gvr schema.GroupVersionResource) string
GenerateDynamicResourceByGVR generates dynamic resource by given gvr, the format is such as `resource.version.group`, which can be input of ParseResourceArg
func GenerateNamespaceNameKey ¶
GenerateNamespaceNameKey generate uniq key by concatenating namespace and name.
func GenerateObjectOwnerReferenceKey ¶
func GenerateObjectOwnerReferenceKey(reference metav1.OwnerReference) string
GenerateObjectOwnerReferenceKey is to generate a unique key by owner reference
func GeneratePodContainerName ¶
func GeneratePodContainerName(podName, containerName string) consts.PodContainerName
GeneratePodContainerName return a unique key for a container in a pod
func GenerateUniqGVRNameKey ¶
GenerateUniqGVRNameKey generate a uniq key (without UID) for the GVR and its corresponding object.
func GenerateUniqObjectNameKey ¶
GenerateUniqObjectNameKey generate a uniq key (without UID) for the given object.
func GenerateUniqObjectUIDKey ¶
GenerateUniqObjectUIDKey generate a uniq key (including UID) for the given object.
func GetAndUnmarshalForHttps ¶ added in v0.3.0
func GetAndUnmarshalForHttps(ctx context.Context, port int, nodeAddress, endpoint, authTokenFile string, v interface{}) error
GetAndUnmarshalForHttps gets data from the given url and unmarshal it into the given struct.
func GetContainerEnvs ¶ added in v0.2.0
GetContainerEnvs gets container envs from pod spec by container name and envs name
func GetContainerID ¶ added in v0.2.0
GetContainerID gets container id from pod status by container name
func GetNamespacedNameListFromSlice ¶
GetNamespacedNameListFromSlice returns a slice of namespaced name
func GetNonzeroQoSRequests ¶
func GetNonzeroQoSRequests(requests *v1.ResourceList) (int64, int64)
GetNonzeroQoSRequests returns the default reclaimed_millicpu and reclaimed_memory resource request if none is found or what is provided on the request.
func GetPodCondition ¶ added in v0.2.0
func GetPodCondition(pod *v1.Pod, conditionType v1.PodConditionType) (v1.PodCondition, bool)
GetPodCondition extracts the given condition for the given pod
func GetPodListForWorkload ¶
func GetPodListForWorkload(workloadObj runtime.Object, podIndexer cache.Indexer, labelKeyList []string, podLister corelisters.PodLister) ([]*core.Pod, error)
GetPodListForWorkload returns pod list that belong to the given workload we will use label selector to find pods, and this may require that the given workload is limited to several selected objects.
func GetPodTransformer ¶ added in v0.2.0
func GetPodTransformer() (cache.TransformFunc, bool)
func GetPodsAssignedToNode ¶ added in v0.4.2
GetPodsAssignedToNode returns pods that belong to this node by indexer
func GetRequestForQoSResource ¶
func GetRequestForQoSResource(resource v1.ResourceName, requests *v1.ResourceList, nonZero bool) int64
GetRequestForQoSResource returns the requested values unless nonZero is true and there is no defined request for CPU and memory. If nonZero is true and the resource has no defined request for CPU or memory, it returns a default value.
func GetUnstructuredPodTemplateSpec ¶ added in v0.4.1
func GetUnstructuredPodTemplateSpec(object *unstructured.Unstructured) (*v1.PodTemplateSpec, error)
func GetUnstructuredSelector ¶
func GetUnstructuredSelector(object *unstructured.Unstructured) (labels.Selector, error)
GetUnstructuredSelector parse a unstructured object and return its labelSelector (for pods)
func GetUnstructuredTemplateAnnotations ¶ added in v0.4.0
func GetUnstructuredTemplateAnnotations(object *unstructured.Unstructured) (map[string]string, error)
GetUnstructuredTemplateAnnotations parse a unstructured object and return its template's annotations (for workload like deployments, statefulsets)
func IsAssignedPod ¶
IsAssignedPod selects pods that are assigned (scheduled and running).
func IsResourceGreaterThan ¶
IsResourceGreaterThan checks if recommended resource is scaling down
func MergeResources ¶
func MergeResources(updateList ...*v1.ResourceList) *v1.ResourceList
MergeResources merge multi ResourceList into one ResourceList, the resource of same resource name in all ResourceList we only use the first merged one.
func MultiplyMilliQuantity ¶ added in v0.4.0
MultiplyMilliQuantity scales quantity by y.
func MultiplyQuantity ¶ added in v0.4.0
MultiplyQuantity scales quantity by y.
func MultiplyResourceQuantity ¶ added in v0.4.0
func MultiplyResourceQuantity(resourceName v1.ResourceName, quantity resource.Quantity, y float64) resource.Quantity
MultiplyResourceQuantity scales quantity according to its resource name.
func NewPodSourceImpList ¶
func NewPodSourceImpList(pods []*v1.Pod) general.SourceList
func ObjectOwnerReferenceIndex ¶
ObjectOwnerReferenceIndex is used by informer to index a resource by owner
func ParseContainerName ¶
func ParseContainerName(key consts.ContainerName) string
ParseContainerName parse key and return container name
func ParseHostPortForPod ¶ added in v0.4.0
ParseHostPortForPod gets host ports from pod spec
func ParseHostPortsForContainer ¶
ParseHostPortsForContainer gets host port from container spec
func ParseNamespaceNameUIDKey ¶ added in v0.4.0
ParseNamespaceNameUIDKey parse the given key into namespace/name/uid
func ParsePodContainerName ¶
func ParsePodContainerName(key consts.PodContainerName) (string, string, error)
ParsePodContainerName parse key and return pod name and container name
func ParseUniqGVRNameKey ¶
ParseUniqGVRNameKey parse the given key into GVR and namespace/name
func ParseUniqObjectUIDKey ¶ added in v0.4.0
ParseUniqObjectUIDKey parse the given key into namespace, name and uid
func PodAnnotationFilter ¶
PodAnnotationFilter is used to filter pods annotated with a pair of specific key and value
func PodCPURequestCmpFunc ¶
func PodCPURequestCmpFunc(i1, i2 interface{}) int
PodCPURequestCmpFunc sorts cpu request of pods with less comparison
func PodGuaranteedCPUs ¶ added in v0.5.0
func PodIsActive ¶
PodIsActive returns whether the pod is not terminated.
func PodIsPending ¶ added in v0.4.0
PodIsPending returns whether the pod is pending.
func PodIsReady ¶
PodIsReady returns whether the pod is at ready state.
func PodIsTerminated ¶
PodIsTerminated returns whether the pod is at terminal state.
func PodPriorityCmpFunc ¶
func PodPriorityCmpFunc(i1, i2 interface{}) int
PodPriorityCmpFunc sorts priority of pods with greater comparison
func PodResourceDiff ¶
func PodResourceDiff(pod *v1.Pod, containerResourcesToUpdate map[string]v1.ResourceRequirements) bool
PodResourceDiff checks if pod resources are not the same as the given resource map, both for requests and limits.
func PodUniqKeyCmpFunc ¶ added in v0.4.0
func PodUniqKeyCmpFunc(i1, i2 interface{}) int
PodUniqKeyCmpFunc sorts uniq key of pod with greater comparison
func ResourceQuantityToInt64Value ¶
func ResourceQuantityToInt64Value(resourceName v1.ResourceName, quantity resource.Quantity) int64
ResourceQuantityToInt64Value returns the int64 value according to its resource name
func ResourcesEqual ¶
func ResourcesEqual(a, b v1.ResourceList) bool
ResourcesEqual checks whether the given resources are equal with each other
func ResourcesLess ¶ added in v0.5.2
func ResourcesLess(a, b v1.ResourceList, resourceNameList []v1.ResourceName) bool
ResourcesLess checks whether the given resources a are less than b
func SetCPUQuantityGetter ¶ added in v0.4.0
func SetCPUQuantityGetter(getter QuantityGetter)
func SetMemoryQuantityGetter ¶ added in v0.4.0
func SetMemoryQuantityGetter(getter QuantityGetter)
func SetPodTransformer ¶ added in v0.4.1
func SetPodTransformer(f PodTransformerFunc)
func SumUpPodLimitResources ¶
func SumUpPodLimitResources(pod *v1.Pod) v1.ResourceList
SumUpPodLimitResources sum up resources in all containers request init container is included (count on the max limit of all init containers)
func SumUpPodRequestResources ¶
func SumUpPodRequestResources(pod *v1.Pod) v1.ResourceList
SumUpPodRequestResources sum up resources in all containers request init container is included (count on the max request of all init containers)
func ToSchemaGVR ¶
func ToSchemaGVR(group, version, resource string) schema.GroupVersionResource
func ToUnstructured ¶
func ToUnstructured(obj interface{}) (*unstructured.Unstructured, error)
func TrimContainerIDPrefix ¶
TrimContainerIDPrefix is used to parse the specific containerID out of the whole containerID info
func VisitUnstructuredAncestors ¶
func VisitUnstructuredAncestors(object *unstructured.Unstructured, unstructuredMap map[schema.GroupVersionKind]cache.GenericLister, handleFunc func(owner *unstructured.Unstructured) bool, ) bool
VisitUnstructuredAncestors is to walk through all the ancestors of the given object, during this process, we will try to handle each ancestor with the given util function. if the handleFunc returns true, it means that we should continue the walking process for other ancestors, otherwise, we break the process and return.
Types ¶
type DynamicInformer ¶ added in v0.2.0
type DynamicInformer struct { GVK schema.GroupVersionKind GVR schema.GroupVersionResource Informer informers.GenericInformer }
DynamicInformer keeps the informer-related contents for each workload
type DynamicResourcesManager ¶ added in v0.2.0
type DynamicResourcesManager struct {
// contains filtered or unexported fields
}
func NewDynamicResourcesManager ¶ added in v0.2.0
func NewDynamicResourcesManager( dynamicResources []string, mapper *dynamicmapper.RegeneratingDiscoveryRESTMapper, dynamicInformerFactory dynamicinformer.DynamicSharedInformerFactory, ) (*DynamicResourcesManager, error)
NewDynamicResourcesManager initializes a dynamic resources manger to manage dynamic informers
func (*DynamicResourcesManager) GetDynamicInformers ¶ added in v0.2.0
func (m *DynamicResourcesManager) GetDynamicInformers() map[string]DynamicInformer
GetDynamicInformers gets current dynamic informers
func (*DynamicResourcesManager) Run ¶ added in v0.2.0
func (m *DynamicResourcesManager) Run(ctx context.Context)
Run start mapper to refresh starts a goroutine to check if it has new gvr support available, and if so, panics to restart to make sure all caches are correct
type KubeletConfiguration ¶ added in v0.5.10
type KubeletConfiguration struct { // cpuManagerPolicy is the name of the policy to use. // Requires the CPUManager feature gate to be enabled. // Default: "None" // +optional CPUManagerPolicy string `json:"cpuManagerPolicy,omitempty"` // memoryManagerPolicy is the name of the policy to use by memory manager. // Requires the MemoryManager feature gate to be enabled. // Default: "none" // +optional MemoryManagerPolicy string `json:"memoryManagerPolicy,omitempty"` // topologyManagerPolicy is the name of the topology manager policy to use. // Valid values include: // // - `restricted`: kubelet only allows pods with optimal NUMA node alignment for // requested resources; // - `best-effort`: kubelet will favor pods with NUMA alignment of CPU and device // resources; // - `none`: kubelet has no knowledge of NUMA alignment of a pod's CPU and device resources. // - `single-numa-node`: kubelet only allows pods with a single NUMA alignment // of CPU and device resources. // // Policies other than "none" require the TopologyManager feature gate to be enabled. // Default: "none" // +optional TopologyManagerPolicy string `json:"topologyManagerPolicy,omitempty"` // topologyManagerScope represents the scope of topology hint generation // that topology manager requests and hint providers generate. Valid values include: // // - `container`: topology policy is applied on a per-container basis. // - `pod`: topology policy is applied on a per-pod basis. // // "pod" scope requires the TopologyManager feature gate to be enabled. // Default: "container" // +optional TopologyManagerScope string `json:"topologyManagerScope,omitempty"` // featureGates is a map of feature names to bools that enable or disable experimental // features. This field modifies piecemeal the built-in default values from // "k8s.io/kubernetes/pkg/features/kube_features.go". // Default: nil // +optional FeatureGates map[string]bool `json:"featureGates,omitempty"` // systemReserved is a set of ResourceName=ResourceQuantity (e.g. cpu=200m,memory=150G) // pairs that describe resources reserved for non-kubernetes components. // Currently only cpu and memory are supported. // See http://kubernetes.io/docs/user-guide/compute-resources for more detail. // Default: nil // +optional SystemReserved map[string]string `json:"systemReserved,omitempty"` // kubeReserved is a set of ResourceName=ResourceQuantity (e.g. cpu=200m,memory=150G) pairs // that describe resources reserved for kubernetes system components. // Currently cpu, memory and local storage for root file system are supported. // See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ // for more details. // Default: nil // +optional KubeReserved map[string]string `json:"kubeReserved,omitempty"` // The reservedSystemCPUs option specifies the CPU list reserved for the host // level system threads and kubernetes related threads. This provide a "static" // CPU list rather than the "dynamic" list by systemReserved and kubeReserved. // This option does not support systemReservedCgroup or kubeReservedCgroup. ReservedSystemCPUs string `json:"reservedSystemCPUs,omitempty"` // NumericTopologyAlignResources is a list of resources which need to be aligned numa affinity // in numeric topology policy. // Default: [cpu, memory] // +optional NumericTopologyAlignResources []string `json:"numericTopologyAlignResources,omitempty"` }
KubeletConfiguration contains the configuration for the Kubelet This struct is a simplification of the definition in the kubelet api repo, holding only the fields used by katalyst.
type PodLabelIndexer ¶
type PodLabelIndexer string
func (PodLabelIndexer) IndexFunc ¶
func (p PodLabelIndexer) IndexFunc(obj interface{}) ([]string, error)
IndexFunc is used to construct informer index for labels in pod
type PodResource ¶ added in v0.4.0
type PodResource map[string]v1.ResourceList
PodResource key: namespace/name, value: pod requested ResourceList
type PodSourceList ¶
type PodSourceList struct {
// contains filtered or unexported fields
}
func (*PodSourceList) GetSource ¶
func (pl *PodSourceList) GetSource(index int) interface{}
func (*PodSourceList) Len ¶
func (pl *PodSourceList) Len() int
func (*PodSourceList) SetSource ¶
func (pl *PodSourceList) SetSource(index int, p interface{})
type PodTransformerFunc ¶ added in v0.2.0
type QoSResource ¶
QoSResource is a collection of compute resource.
func CalculateQoSResource ¶
func CalculateQoSResource(pod *v1.Pod) (res QoSResource, non0CPU int64, non0Mem int64)
CalculateQoSResource calculates the QoS Resource of a Pod resourceRequest = max(sum(podSpec.Containers), podSpec.InitContainers) + overHead
func (*QoSResource) Add ¶
func (r *QoSResource) Add(rl v1.ResourceList)
Add adds ResourceList into QoSResource.
func (*QoSResource) SetMaxResource ¶
func (r *QoSResource) SetMaxResource(rl v1.ResourceList)
SetMaxResource compares with ResourceList and takes max value for each QoSResource.
type QuantityGetter ¶ added in v0.4.0
type QuantityGetter func(resourceList v1.ResourceList) resource.Quantity
func CPUQuantityGetter ¶ added in v0.4.0
func CPUQuantityGetter() QuantityGetter
func MemoryQuantityGetter ¶ added in v0.4.0
func MemoryQuantityGetter() QuantityGetter
type ResourceThreshold ¶ added in v0.2.0
type ResourceThreshold map[v1.ResourceName]float64
ResourceThreshold is map of resource name to threshold of water level
func (*ResourceThreshold) Set ¶ added in v0.2.0
func (t *ResourceThreshold) Set(value string) error
func (*ResourceThreshold) String ¶ added in v0.2.0
func (t *ResourceThreshold) String() string
func (*ResourceThreshold) Type ¶ added in v0.2.0
func (t *ResourceThreshold) Type() string