Documentation ¶
Index ¶
- Constants
- Variables
- func AddOrUpdateCNRTaint(cnr *apis.CustomNodeResource, taint *apis.Taint) (*apis.CustomNodeResource, bool, error)
- func CNRTaintExists(taints []*apis.Taint, taintToFind *apis.Taint) bool
- func CalculateSPDHash(spd *apiworkload.ServiceProfileDescriptor) (string, error)
- func CheckCNRConditionMatched(curCondition *nodev1alpha1.CNRCondition, status corev1.ConditionStatus, ...) bool
- func CheckPodSpecUpdated(pod *core.Pod) bool
- func CheckSPDMatchWithPod(pod *core.Pod, spd *apiworkload.ServiceProfileDescriptor, ...) bool
- func CheckVPARecommendationMatchVPA(vpaRec *apis.VerticalPodAutoscalerRecommendation, ...) bool
- func CheckVPAStatusLegal(vpa *apis.KatalystVerticalPodAutoscaler, pods []*core.Pod) (bool, string, error)
- func CheckWorkloadEnableVPA(runtimeObject runtime.Object) bool
- func CheckWorkloadSPDEnabled(workload metav1.Object) bool
- func ConvertNumaEvictionRankingMetricsToStringList(metrics []v1alpha1.NumaEvictionRankingMetric) []string
- func ConvertStringListToNumaEvictionRankingMetrics(metrics []string) []v1alpha1.NumaEvictionRankingMetric
- func ConvertStringListToSystemEvictionRankingMetrics(metrics []string) []v1alpha1.SystemEvictionRankingMetric
- func ConvertSystemEvictionRankingMetricsToStringList(metrics []v1alpha1.SystemEvictionRankingMetric) []string
- func ConvertVPAContainerResourceToRecommendedContainerResources(resource apis.ContainerResources) apis.RecommendedContainerResources
- func ConvertVPAContainerResourceToResourceRequirements(containerResource apis.ContainerResources) core.ResourceRequirements
- func DeleteCNRTaint(taints []*apis.Taint, taintToDelete *apis.Taint) ([]*apis.Taint, bool)
- func GenerateNumaSocketZone(nodes []info.Node) map[ZoneNode]ZoneNode
- func GenerateVPAPodResizePolicyAnnotations(pod *core.Pod, containerPolicies map[string]apis.ContainerResourcePolicy) (map[string]string, error)
- func GenerateVPAPodResizeResourceAnnotations(pod *core.Pod, ...) (map[string]core.ResourceRequirements, error)
- func GenerateVPAPolicyMap(vpa *apis.KatalystVerticalPodAutoscaler) (map[string]apis.ContainerResourcePolicy, error)
- func GenerateVPAResourceMap(vpa *apis.KatalystVerticalPodAutoscaler) (map[consts.PodContainerName]apis.ContainerResources, ...)
- func GetCNRCondition(status *apis.CustomNodeResourceStatus, conditionType apis.CNRConditionType) (int, *apis.CNRCondition)
- func GetPodListForSPD(spd *apiworkload.ServiceProfileDescriptor, podIndexer cache.Indexer, ...) ([]*core.Pod, error)
- func GetPodListForVPA(vpa *apis.KatalystVerticalPodAutoscaler, podIndexer cache.Indexer, ...) ([]*core.Pod, error)
- func GetPodSPDName(pod *core.Pod) (string, error)
- func GetSPDForPod(pod *core.Pod, spdIndexer cache.Indexer, ...) (*apiworkload.ServiceProfileDescriptor, error)
- func GetSPDForVPA(vpa *apis.KatalystVerticalPodAutoscaler, spdIndexer cache.Indexer, ...) (*workload.ServiceProfileDescriptor, error)
- func GetSPDForWorkload(workload *unstructured.Unstructured, spdIndexer cache.Indexer, ...) (*apiworkload.ServiceProfileDescriptor, error)
- func GetSPDHash(spd *apiworkload.ServiceProfileDescriptor) string
- func GetServiceBusinessIndicatorTarget(spd *workloadapis.ServiceProfileDescriptor) (map[string]IndicatorTarget, error)
- func GetServiceBusinessIndicatorValue(spd *workloadapis.ServiceProfileDescriptor) (map[string]float64, error)
- func GetServiceSystemIndicatorTarget(spd *workloadapis.ServiceProfileDescriptor) (map[string]IndicatorTarget, error)
- func GetVPAForPod(pod *core.Pod, vpaIndexer cache.Indexer, ...) (*apis.KatalystVerticalPodAutoscaler, error)
- func GetVPAForVPARec(vpaRec *apis.VerticalPodAutoscalerRecommendation, ...) (*apis.KatalystVerticalPodAutoscaler, error)
- func GetVPAForWorkload(workload *unstructured.Unstructured, vpaIndexer cache.Indexer, ...) (*apis.KatalystVerticalPodAutoscaler, error)
- func GetVPARecForVPA(vpa *apis.KatalystVerticalPodAutoscaler, vpaRecIndexer cache.Indexer, ...) (*apis.VerticalPodAutoscalerRecommendation, error)
- func GetWorkloadForSPD(spd *apiworkload.ServiceProfileDescriptor, lister cache.GenericLister) (runtime.Object, error)
- func GetWorkloadForVPA(vpa *apis.KatalystVerticalPodAutoscaler, workloadLister cache.GenericLister) (runtime.Object, error)
- func InsertSPDBusinessIndicatorSpec(spec *apiworkload.ServiceProfileDescriptorSpec, ...)
- func InsertSPDBusinessIndicatorStatus(status *apiworkload.ServiceProfileDescriptorStatus, ...)
- func InsertSPDSystemIndicatorSpec(spec *apiworkload.ServiceProfileDescriptorSpec, ...)
- func MatchCNRTaint(taintToMatch, taint *apis.Taint) bool
- func MergeAllocations(dst, src []*apis.Allocation) []*apis.Allocation
- func MergeAttributes(dst, src []apis.Attribute) []apis.Attribute
- func MergeResources(dst, src apis.Resources) apis.Resources
- func MergeTopologyZone(dst, src []*apis.TopologyZone) []*apis.TopologyZone
- func RemoveCNRTaint(cnr *apis.CustomNodeResource, taint *apis.Taint) (*apis.CustomNodeResource, bool, error)
- func SPDTargetReferenceIndex(obj interface{}) ([]string, error)
- func SetCNRCondition(cnr *apis.CustomNodeResource, conditionType apis.CNRConditionType, ...)
- func SetSPDHash(spd *apiworkload.ServiceProfileDescriptor, hash string)
- func VPATargetReferenceIndex(obj interface{}) ([]string, error)
- type IndicatorTarget
- type KCCTargetResource
- func (g KCCTargetResource) CheckExpired(now time.Time) bool
- func (g KCCTargetResource) CheckValid() bool
- func (g KCCTargetResource) DeepCopy() KCCTargetResource
- func (g KCCTargetResource) GenerateConfigHash() (string, error)
- func (g KCCTargetResource) GetCollisionCount() *int32
- func (g KCCTargetResource) GetGenericStatus() v1alpha1.GenericConfigStatus
- func (g KCCTargetResource) GetHash() string
- func (g KCCTargetResource) GetLabelSelector() string
- func (g KCCTargetResource) GetLastDuration() *time.Duration
- func (g KCCTargetResource) GetNodeNames() []string
- func (g KCCTargetResource) GetObservedGeneration() int64
- func (g KCCTargetResource) GetPriority() int32
- func (g KCCTargetResource) GetRevisionHistoryLimit() int64
- func (g KCCTargetResource) IsUpdated() bool
- func (g KCCTargetResource) SetCollisionCount(count *int32)
- func (g KCCTargetResource) SetGenericStatus(status v1alpha1.GenericConfigStatus)
- func (g KCCTargetResource) SetHash(hash string)
- func (g KCCTargetResource) SetObservedGeneration(generation int64)
- func (g KCCTargetResource) Unmarshal(conf interface{}) error
- type TopologyZoneGenerator
- type ZoneAllocations
- type ZoneAttributes
- type ZoneMeta
- type ZoneNode
- type ZoneTopology
Constants ¶
const ( CNRFieldNameNodeResourceProperties = "NodeResourceProperties" CNRFieldNameTopologyZone = "TopologyZone" CNRFieldNameResources = "Resources" CNRFieldNameTopologyPolicy = "TopologyPolicy" )
those fields are used by in-tree reporter plugins to refer specific field names of CNR.
const (
CNRKind = "CustomNodeResource"
)
Variables ¶
var ( CNRGroupVersionKind = metav1.GroupVersionKind{ Group: nodev1alpha1.SchemeGroupVersion.Group, Kind: CNRKind, Version: nodev1alpha1.SchemeGroupVersion.Version, } )
Functions ¶
func AddOrUpdateCNRTaint ¶
func AddOrUpdateCNRTaint(cnr *apis.CustomNodeResource, taint *apis.Taint) (*apis.CustomNodeResource, bool, error)
AddOrUpdateCNRTaint tries to add a taint to annotations list. Returns a new copy of updated CNR and true if something was updated false otherwise.
func CNRTaintExists ¶
CNRTaintExists checks if the given taint exists in list of taints. Returns true if exists false otherwise.
func CalculateSPDHash ¶
func CalculateSPDHash(spd *apiworkload.ServiceProfileDescriptor) (string, error)
CalculateSPDHash calculate current spd hash by its spec and status
func CheckCNRConditionMatched ¶
func CheckCNRConditionMatched(curCondition *nodev1alpha1.CNRCondition, status corev1.ConditionStatus, reason, message string) bool
CheckCNRConditionMatched checks if current CNR condition matches the update condition
func CheckPodSpecUpdated ¶
CheckPodSpecUpdated checks pod spec whether is updated to expected resize resource in annotation
func CheckSPDMatchWithPod ¶
func CheckSPDMatchWithPod(pod *core.Pod, spd *apiworkload.ServiceProfileDescriptor, workloadListerMap map[schema.GroupVersionKind]cache.GenericLister) bool
CheckSPDMatchWithPod checks whether the given pod and spd matches with each other
func CheckVPARecommendationMatchVPA ¶
func CheckVPARecommendationMatchVPA(vpaRec *apis.VerticalPodAutoscalerRecommendation, vpa *apis.KatalystVerticalPodAutoscaler) bool
func CheckVPAStatusLegal ¶
func CheckVPAStatusLegal(vpa *apis.KatalystVerticalPodAutoscaler, pods []*core.Pod) (bool, string, error)
CheckVPAStatusLegal checks following things and return a msg 1. recommended resource mustn't change pod qos class 2. recommended resource mustn't scale up in VPA 1.0 todo: remove this in VPA 2.0 3. recommended resource mustn't be negative if vpa status is illegal, we'll refuse update its status
func CheckWorkloadEnableVPA ¶
CheckWorkloadEnableVPA is used to check whether the object enables VPA functionality
func CheckWorkloadSPDEnabled ¶
CheckWorkloadSPDEnabled checks if the given workload is enabled with service profiling.
func ConvertNumaEvictionRankingMetricsToStringList ¶
func ConvertNumaEvictionRankingMetricsToStringList(metrics []v1alpha1.NumaEvictionRankingMetric) []string
func ConvertStringListToNumaEvictionRankingMetrics ¶
func ConvertStringListToNumaEvictionRankingMetrics(metrics []string) []v1alpha1.NumaEvictionRankingMetric
func ConvertStringListToSystemEvictionRankingMetrics ¶
func ConvertStringListToSystemEvictionRankingMetrics(metrics []string) []v1alpha1.SystemEvictionRankingMetric
func ConvertSystemEvictionRankingMetricsToStringList ¶
func ConvertSystemEvictionRankingMetricsToStringList(metrics []v1alpha1.SystemEvictionRankingMetric) []string
func ConvertVPAContainerResourceToRecommendedContainerResources ¶
func ConvertVPAContainerResourceToRecommendedContainerResources(resource apis.ContainerResources) apis.RecommendedContainerResources
ConvertVPAContainerResourceToRecommendedContainerResources converts apis.ContainerResources to apis.RecommendedContainerResources
func ConvertVPAContainerResourceToResourceRequirements ¶
func ConvertVPAContainerResourceToResourceRequirements(containerResource apis.ContainerResources) core.ResourceRequirements
ConvertVPAContainerResourceToResourceRequirements converts target value in apis.ContainerResources to core.ResourceRequirements
func DeleteCNRTaint ¶
DeleteCNRTaint removes all the taints that have the same key and effect to given taintToDelete.
func GenerateNumaSocketZone ¶
GenerateNumaSocketZone parse numa info to get the map of numa zone node to socket zone node
func GenerateVPAPodResizePolicyAnnotations ¶
func GenerateVPAPodResizePolicyAnnotations(pod *core.Pod, containerPolicies map[string]apis.ContainerResourcePolicy) (map[string]string, error)
GenerateVPAPodResizePolicyAnnotations returns mapping from containerName to policy
func GenerateVPAPodResizeResourceAnnotations ¶
func GenerateVPAPodResizeResourceAnnotations(pod *core.Pod, podResources map[consts.PodContainerName]apis.ContainerResources, containerResources map[consts.ContainerName]apis.ContainerResources) (map[string]core.ResourceRequirements, error)
GenerateVPAPodResizeResourceAnnotations returns mapping from containerName to resourceRequirements by merging the given podResources and containerResources; and podResources is always superior to containerResources
func GenerateVPAPolicyMap ¶
func GenerateVPAPolicyMap(vpa *apis.KatalystVerticalPodAutoscaler) (map[string]apis.ContainerResourcePolicy, error)
GenerateVPAPolicyMap returns vpa resource policy at container-level
func GenerateVPAResourceMap ¶
func GenerateVPAResourceMap(vpa *apis.KatalystVerticalPodAutoscaler) (map[consts.PodContainerName]apis.ContainerResources, map[consts.ContainerName]apis.ContainerResources, error)
GenerateVPAResourceMap returns the map of pod resources and container resources; the returned pod resources map use GeneratePodContainerName as key, and apis.ContainerResources as value the returned container resources map use GenerateContainerName as key, and apis.ContainerResources as value
func GetCNRCondition ¶
func GetCNRCondition(status *apis.CustomNodeResourceStatus, conditionType apis.CNRConditionType) (int, *apis.CNRCondition)
GetCNRCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodListForSPD ¶
func GetPodListForSPD(spd *apiworkload.ServiceProfileDescriptor, podIndexer cache.Indexer, podLabelIndexKeyList []string, workloadLister cache.GenericLister, podLister corelisters.PodLister) ([]*core.Pod, error)
GetPodListForSPD is used to get pods that should be managed by the given spd, we'll always get through workload
func GetPodListForVPA ¶
func GetPodListForVPA(vpa *apis.KatalystVerticalPodAutoscaler, podIndexer cache.Indexer, podLabelIndexKeyList []string, workloadLister cache.GenericLister, podLister corelisters.PodLister) ([]*core.Pod, error)
GetPodListForVPA is used to get pods that should be managed by the given vpa, we'll always get through workload
func GetPodSPDName ¶
GetPodSPDName gets spd name from pod annotation
func GetSPDForPod ¶
func GetSPDForPod(pod *core.Pod, spdIndexer cache.Indexer, workloadListerMap map[schema.GroupVersionKind]cache.GenericLister, spdLister workloadlister.ServiceProfileDescriptorLister) (*apiworkload.ServiceProfileDescriptor, error)
GetSPDForPod is used to get spd that should manage the given vpa, we'll try to find by annotation for pod, and then go through workload if not exist, and we will find it recursively since we don't know in which level the owner will be.
func GetSPDForVPA ¶
func GetSPDForVPA(vpa *apis.KatalystVerticalPodAutoscaler, spdIndexer cache.Indexer, workloadLister cache.GenericLister, spdLister workloadlister.ServiceProfileDescriptorLister) (*workload.ServiceProfileDescriptor, error)
GetSPDForVPA is used to get spd that matches with the workload belongs to the given vpa the preference is indexer --> GetSPDForWorkload
func GetSPDForWorkload ¶
func GetSPDForWorkload(workload *unstructured.Unstructured, spdIndexer cache.Indexer, spdLister workloadlister.ServiceProfileDescriptorLister) (*apiworkload.ServiceProfileDescriptor, error)
GetSPDForWorkload is used to get spd that should manage the given workload the preference is annotation ---> indexer --> lister
func GetSPDHash ¶
func GetSPDHash(spd *apiworkload.ServiceProfileDescriptor) string
GetSPDHash get spd hash from spd annotation
func GetServiceBusinessIndicatorTarget ¶
func GetServiceBusinessIndicatorTarget(spd *workloadapis.ServiceProfileDescriptor) (map[string]IndicatorTarget, error)
GetServiceBusinessIndicatorTarget get service business indicator target from spd if there are duplicate upper bound or lower bound, return error
func GetServiceBusinessIndicatorValue ¶
func GetServiceBusinessIndicatorValue(spd *workloadapis.ServiceProfileDescriptor) (map[string]float64, error)
GetServiceBusinessIndicatorValue returns the current value of business indicators The returned map is a map from indicator name to its current value, and if duplicate indicators are found, the first one is used
func GetServiceSystemIndicatorTarget ¶
func GetServiceSystemIndicatorTarget(spd *workloadapis.ServiceProfileDescriptor) (map[string]IndicatorTarget, error)
GetServiceSystemIndicatorTarget get service system indicator target from spd if there are duplicate upper bound or lower bound, return error
func GetVPAForPod ¶
func GetVPAForPod(pod *core.Pod, vpaIndexer cache.Indexer, workloadListerMap map[schema.GroupVersionKind]cache.GenericLister, vpaLister autoscalelister.KatalystVerticalPodAutoscalerLister) (*apis.KatalystVerticalPodAutoscaler, error)
GetVPAForPod is used to get vpa that should manage the given vpa, we'll always get through workload, and we will find it recursively since we don't know in which level the owner will be.
func GetVPAForVPARec ¶
func GetVPAForVPARec(vpaRec *apis.VerticalPodAutoscalerRecommendation, vpaLister autoscalelister.KatalystVerticalPodAutoscalerLister) (*apis.KatalystVerticalPodAutoscaler, error)
GetVPAForVPARec is used to get vpa that should manage the given vpaRec
func GetVPAForWorkload ¶
func GetVPAForWorkload(workload *unstructured.Unstructured, vpaIndexer cache.Indexer, vpaLister autoscalelister.KatalystVerticalPodAutoscalerLister) (*apis.KatalystVerticalPodAutoscaler, error)
GetVPAForWorkload is used to get vpa that should manage the given workload
func GetVPARecForVPA ¶
func GetVPARecForVPA(vpa *apis.KatalystVerticalPodAutoscaler, vpaRecIndexer cache.Indexer, recLister autoscalelister.VerticalPodAutoscalerRecommendationLister) (*apis.VerticalPodAutoscalerRecommendation, error)
GetVPARecForVPA is used to get vpaRec that should be managed the given vpa
func GetWorkloadForSPD ¶
func GetWorkloadForSPD(spd *apiworkload.ServiceProfileDescriptor, lister cache.GenericLister) (runtime.Object, error)
GetWorkloadForSPD is used to get workload that should be managed the given spd
func GetWorkloadForVPA ¶
func GetWorkloadForVPA(vpa *apis.KatalystVerticalPodAutoscaler, workloadLister cache.GenericLister) (runtime.Object, error)
GetWorkloadForVPA is used to get workload that should be managed by the given vpa
func InsertSPDBusinessIndicatorSpec ¶
func InsertSPDBusinessIndicatorSpec(spec *apiworkload.ServiceProfileDescriptorSpec, serviceBusinessIndicatorSpec *apiworkload.ServiceBusinessIndicatorSpec)
func InsertSPDBusinessIndicatorStatus ¶
func InsertSPDBusinessIndicatorStatus(status *apiworkload.ServiceProfileDescriptorStatus, serviceBusinessIndicatorStatus *apiworkload.ServiceBusinessIndicatorStatus)
func InsertSPDSystemIndicatorSpec ¶
func InsertSPDSystemIndicatorSpec(spec *apiworkload.ServiceProfileDescriptorSpec, serviceSystemIndicatorSpec *apiworkload.ServiceSystemIndicatorSpec)
func MatchCNRTaint ¶
MatchCNRTaint checks if the taint matches taintToMatch. Taints are unique by key:effect, if the two taints have same key:effect, regard as they match.
func MergeAllocations ¶
func MergeAllocations(dst, src []*apis.Allocation) []*apis.Allocation
MergeAllocations merges two allocations, returns the merged result. If the same allocation exists in both dst and src, the one in dst will be kept.
func MergeAttributes ¶
MergeAttributes merges two attributes, returns the merged result. If the same attribute exists in both dst and src, the one in dst will be kept.
func MergeResources ¶
MergeResources merges two resources, returns the merged result.
func MergeTopologyZone ¶
func MergeTopologyZone(dst, src []*apis.TopologyZone) []*apis.TopologyZone
MergeTopologyZone merges two topology zones recursively, returns the merged result. If the same zone exists in both dst and src, the one in dst will be kept.
func RemoveCNRTaint ¶
func RemoveCNRTaint(cnr *apis.CustomNodeResource, taint *apis.Taint) (*apis.CustomNodeResource, bool, error)
RemoveCNRTaint tries to remove a taint cnr taints. Returns a new copy of updated CNR and true if something was updated false otherwise.
func SPDTargetReferenceIndex ¶
SPDTargetReferenceIndex is used to construct informer index for target reference in SPD
func SetCNRCondition ¶
func SetCNRCondition(cnr *apis.CustomNodeResource, conditionType apis.CNRConditionType, status corev1.ConditionStatus, reason, message string, now metav1.Time)
SetCNRCondition set specific cnr condition.
func SetSPDHash ¶
func SetSPDHash(spd *apiworkload.ServiceProfileDescriptor, hash string)
SetSPDHash set spd hash to spd annotation
func VPATargetReferenceIndex ¶
VPATargetReferenceIndex is used to construct informer index for target reference in VPA
Types ¶
type IndicatorTarget ¶
type KCCTargetResource ¶
type KCCTargetResource struct {
*unstructured.Unstructured
}
KCCTargetResource is used to provide util function to get detailed information about KCC Target fields.
func ToKCCTargetResource ¶
func ToKCCTargetResource(obj *unstructured.Unstructured) KCCTargetResource
func (KCCTargetResource) CheckExpired ¶
func (g KCCTargetResource) CheckExpired(now time.Time) bool
func (KCCTargetResource) CheckValid ¶
func (g KCCTargetResource) CheckValid() bool
func (KCCTargetResource) DeepCopy ¶
func (g KCCTargetResource) DeepCopy() KCCTargetResource
func (KCCTargetResource) GenerateConfigHash ¶
func (g KCCTargetResource) GenerateConfigHash() (string, error)
func (KCCTargetResource) GetCollisionCount ¶
func (g KCCTargetResource) GetCollisionCount() *int32
func (KCCTargetResource) GetGenericStatus ¶
func (g KCCTargetResource) GetGenericStatus() v1alpha1.GenericConfigStatus
func (KCCTargetResource) GetHash ¶
func (g KCCTargetResource) GetHash() string
func (KCCTargetResource) GetLabelSelector ¶
func (g KCCTargetResource) GetLabelSelector() string
func (KCCTargetResource) GetLastDuration ¶
func (g KCCTargetResource) GetLastDuration() *time.Duration
func (KCCTargetResource) GetNodeNames ¶
func (g KCCTargetResource) GetNodeNames() []string
func (KCCTargetResource) GetObservedGeneration ¶
func (g KCCTargetResource) GetObservedGeneration() int64
func (KCCTargetResource) GetPriority ¶
func (g KCCTargetResource) GetPriority() int32
func (KCCTargetResource) GetRevisionHistoryLimit ¶
func (g KCCTargetResource) GetRevisionHistoryLimit() int64
func (KCCTargetResource) IsUpdated ¶
func (g KCCTargetResource) IsUpdated() bool
func (KCCTargetResource) SetCollisionCount ¶
func (g KCCTargetResource) SetCollisionCount(count *int32)
func (KCCTargetResource) SetGenericStatus ¶
func (g KCCTargetResource) SetGenericStatus(status v1alpha1.GenericConfigStatus)
func (KCCTargetResource) SetHash ¶
func (g KCCTargetResource) SetHash(hash string)
func (KCCTargetResource) SetObservedGeneration ¶
func (g KCCTargetResource) SetObservedGeneration(generation int64)
func (KCCTargetResource) Unmarshal ¶
func (g KCCTargetResource) Unmarshal(conf interface{}) error
type TopologyZoneGenerator ¶
type TopologyZoneGenerator struct {
// contains filtered or unexported fields
}
TopologyZoneGenerator is a struct that generates a tree diagram of zone, it uses AddNode to add new zone node into this tree according to its parent, and gets a list of TopologyZone by calling GenerateTopologyZoneStatus with the zone information map. TopologyZoneGenerator will be used by reporter plugin
func NewNumaSocketTopologyZoneGenerator ¶
func NewNumaSocketTopologyZoneGenerator(numaSocketZoneNodeMap map[ZoneNode]ZoneNode) (*TopologyZoneGenerator, error)
NewNumaSocketTopologyZoneGenerator constructs topology generator by the numa zone node to socket zone node map
func NewZoneTopologyGenerator ¶
func NewZoneTopologyGenerator() *TopologyZoneGenerator
NewZoneTopologyGenerator creates a new TopologyZoneGenerator
func (*TopologyZoneGenerator) AddNode ¶
func (z *TopologyZoneGenerator) AddNode(parent *ZoneNode, current ZoneNode) error
AddNode adds a node to the zone tree,
- if parent is nil, it will be added to the root topology
- if parent is not nil, it will be added to the sub topology of the parent, the parent must already add into this generator before
func (*TopologyZoneGenerator) GenerateTopologyZoneStatus ¶
func (z *TopologyZoneGenerator) GenerateTopologyZoneStatus( allocationsMap map[ZoneNode]ZoneAllocations, resourcesMap map[ZoneNode]nodev1alpha1.Resources, attributesMap map[ZoneNode]ZoneAttributes, ) []*nodev1alpha1.TopologyZone
GenerateTopologyZoneStatus generates topology zone status by allocations, resources and attributes
type ZoneAllocations ¶
type ZoneAllocations []*nodev1alpha1.Allocation
ZoneAllocations is list of allocations
type ZoneAttributes ¶
type ZoneAttributes []nodev1alpha1.Attribute
ZoneAttributes is list of attributes
type ZoneMeta ¶
type ZoneMeta struct { Type nodev1alpha1.TopologyType Name string }
ZoneMeta is a struct that contains the type and name of a zone.
type ZoneNode ¶
type ZoneNode struct {
Meta ZoneMeta
}
ZoneNode is a struct that contains the meta and an ID of a zone.
func GenerateNumaZoneNode ¶
GenerateNumaZoneNode generates numa zone node by numa id, which must be unique
func GenerateSocketZoneNode ¶
GenerateSocketZoneNode generates socket zone node by socket id, which must be unique
type ZoneTopology ¶
type ZoneTopology struct {
Children map[ZoneNode]*ZoneTopology
}
ZoneTopology is a tree diagram of a zone
func NewZoneTopology ¶
func NewZoneTopology() *ZoneTopology