Documentation
¶
Index ¶
- func Alternate(tree map[string][]string, algorithm string) ([]string, error)
- func AlternateKahn(tree map[string][]string) ([]string, error)
- func AlternateTarjan(tree map[string][]string) ([]string, error)
- func CreateMergePatch(original, new interface{}) ([]byte, error)
- func FindWorkloadBySelector(workloadList v1alpha1.AppGroupWorkloadList, selector string) *v1alpha1.AppGroupWorkloadInfo
- func GetPodAppGroupLabel(pod *v1.Pod) string
- func GetPodAppGroupSelector(pod *v1.Pod) string
- func KahnSort(tree map[string][]string) ([]string, error)
- func NormalizeTree(source map[string][]string) map[string][]string
- func Reverse(tree map[string][]string, algorithm string) ([]string, error)
- func ReverseKahn(tree map[string][]string) ([]string, error)
- func ReverseTarjan(tree map[string][]string) ([]string, error)
- func TarjanSort(tree map[string][]string) ([]string, error)
- type BySelector
- type ByWorkloadSelector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alternate ¶
Alternate : inverts the order given by a Topology Sorting algorithm (e.g., Kahn, Tarjan). Example: [1, N-1, 2, N-2, ...] (element indices)
func AlternateKahn ¶
AlternateKahn : inverts the order of the elements given by KahnSort in the resulting sorted list.
func AlternateTarjan ¶
AlternateTarjan : inverts the order of the elements given by TarjanSort in the resulting sorted list.
func CreateMergePatch ¶
CreateMergePatch return patch generated from original and new interfaces
func FindWorkloadBySelector ¶
func FindWorkloadBySelector(workloadList v1alpha1.AppGroupWorkloadList, selector string) *v1alpha1.AppGroupWorkloadInfo
FindWorkloadBySelector : return the workload's Info based on its selector
func GetPodAppGroupLabel ¶
GetPodAppGroupLabel : get AppGroup from pod annotations
func GetPodAppGroupSelector ¶
GetPodAppGroupSelector : get Workload Selector from pod annotations
func KahnSort ¶
Implementation of Topology Sorting algorithms based on https://github.com/otaviokr/topological-sort KahnSort : receives a tree (AppGroup Service Topology) and returns an array with the pods sorted.
func NormalizeTree ¶
NormalizeTree: checks if all Pods referred in the slices are present in the map as key too. If not, it will create the entry to make sure all nodes are accounted for.
func Reverse ¶
Reverse : inverts the order given by a Topology Sorting algorithm (e.g., Kahn, Tarjan).
func ReverseKahn ¶
ReverseKahn : reverses the order of the elements given by KahnSort in the resulting sorted list.
func ReverseTarjan ¶
ReverseTarjan : reverses the order of the elements given by TarjanSort in the resulting sorted list.
Types ¶
type BySelector ¶
type BySelector v1alpha1.AppGroupWorkloadList
Sort AppGroupWorkloadList by Workload.Selector
func (BySelector) Len ¶
func (s BySelector) Len() int
func (BySelector) Less ¶
func (s BySelector) Less(i, j int) bool
func (BySelector) Swap ¶
func (s BySelector) Swap(i, j int)
type ByWorkloadSelector ¶
type ByWorkloadSelector v1alpha1.AppGroupTopologyList
Sort AppGroupTopologyList by Workload.Selector
func (ByWorkloadSelector) Len ¶
func (s ByWorkloadSelector) Len() int
func (ByWorkloadSelector) Less ¶
func (s ByWorkloadSelector) Less(i, j int) bool
func (ByWorkloadSelector) Swap ¶
func (s ByWorkloadSelector) Swap(i, j int)