v0.7.0 Latest Latest

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 32 Imported by: 0



This example demonstrates a distance queue built using the heap interface.



View Source
const (
	// CostFactorOfInAppFiltering = 4 means, we assume that the cost of listing all resources and
	// filtering them in the app (instead of using kube-apiserver) is 5x of that via label based selection
	CostFactorOfInAppFiltering = 4

	MetadataNamespace      = "metadata.namespace"
	MetadataNamespaceQuery = "{." + MetadataNamespace + "}"
	MetadataLabels         = "metadata.labels"
	MetadataNameQuery      = "{}"


This section is empty.


func DecodeJSON

func DecodeJSON(input map[string]interface{}, output interface{}) error

func Extract

func Extract(u *unstructured.Unstructured, fieldPath string, v interface{}) (bool, error)

func ExtractName

func ExtractName(name, selector string) (string, bool)

func ExtractSelector

func ExtractSelector(u *unstructured.Unstructured, fieldPath string) (string, labels.Selector, error)

func IsOwnedBy

func IsOwnedBy(obj metav1.Object, owner metav1.Object) bool

func Namespaces

func Namespaces(ref *unstructured.Unstructured, nsSelector string) ([]string, error)

len([]string) == 0 && err == nil => all namespaces


type AdjacencyMap

type AdjacencyMap map[schema.GroupVersionResource]*Edge

type Edge

func GetConnectedGraph added in v0.5.3

func GetConnectedGraph(config *rest.Config, reg *hub.Registry, srcGVR schema.GroupVersionResource, ref types.NamespacedName) ([]*Edge, error)

type Graph

type Graph struct {
	// contains filtered or unexported fields

func LoadGraph

func LoadGraph(r *hub.Registry) (*Graph, error)

func LoadGraphOfKnownResources added in v0.2.2

func LoadGraphOfKnownResources() (*Graph, error)

func NewGraph

func NewGraph(r *hub.Registry) *Graph

func (*Graph) AddEdge

func (g *Graph) AddEdge(e *Edge)

func (*Graph) Edges added in v0.5.5

func (*Graph) ListUsingDFS added in v0.5.3

func (*Graph) ListUsingDijkstra added in v0.5.3

type Item

type Item struct {
	// contains filtered or unexported fields

An Item is something we manage in a priority queue.

type NamespaceSelector

type NamespaceSelector struct {
	// Boolean describing whether all namespaces are selected in contrast to a
	// list restricting them.
	Any bool `json:"any,omitempty"`
	// List of namespace names.
	MatchNames []string `json:"matchNames,omitempty"`

ref: NamespaceSelector is a selector for selecting either all namespaces or a list of namespaces. +k8s:openapi-gen=true

type ObjectFinder added in v0.5.5

type ObjectFinder struct {
	Factory dynamicfactory.Factory
	Mapper  disco_util.ResourceMapper

func (ObjectFinder) Get added in v0.5.5

func (ObjectFinder) List added in v0.5.5

func (finder ObjectFinder) List(src *unstructured.Unstructured, path []*Edge) ([]*unstructured.Unstructured, error)

func (ObjectFinder) ListConnectedPartials added in v0.5.5

func (ObjectFinder) ListConnectedResources added in v0.5.5

func (finder ObjectFinder) ListConnectedResources(src *unstructured.Unstructured, edges AdjacencyMap) (map[schema.GroupVersionResource][]*unstructured.Unstructured, error)

func (ObjectFinder) Locate added in v0.5.5

func (finder ObjectFinder) Locate(locator *v1alpha1.ObjectLocator, edgeList []v1alpha1.NamedEdge) (*unstructured.Unstructured, error)

func (ObjectFinder) ResourcesFor added in v0.5.5

func (finder ObjectFinder) ResourcesFor(src *unstructured.Unstructured, e *Edge) ([]*unstructured.Unstructured, error)

type Path

type Path struct {
	Source   schema.GroupVersionResource
	Target   schema.GroupVersionResource
	Distance uint64
	Edges    []*Edge

type Queue

type Queue []*Item

A Queue implements heap.Interface and holds Items.

func (Queue) Len

func (q Queue) Len() int

func (Queue) Less

func (q Queue) Less(i, j int) bool

func (*Queue) Pop

func (q *Queue) Pop() interface{}

func (*Queue) Push

func (q *Queue) Push(x interface{})

func (Queue) Swap

func (q Queue) Swap(i, j int)

func (*Queue) Update

func (q *Queue) Update(item *Item, dist uint64)

Update modifies the priority and value of an Item in the queue.

type ResourceRef

type ResourceRef struct {
	// Name is the name of resource being referenced
	Name string `json:"name"`
	// Namespace is the namespace of resource being referenced
	Namespace string `json:"namespace,omitempty"`
	// Kind is the type of resource being referenced
	Kind string `json:"kind,omitempty"`
	// APIGroup is the group for the resource being referenced
	APIGroup string `json:"apiGroup,omitempty"`

ResourceRef contains information that points to the resource being used

func ParseResourceRefs

func ParseResourceRefs(records [][]string) ([]ResourceRef, error)

Jump to

Keyboard shortcuts

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