Documentation ¶
Overview ¶
This example demonstrates a distance queue built using the heap interface.
Index ¶
- Constants
- func DecodeJSON(input map[string]interface{}, output interface{}) error
- func Dijkstra(graph *Graph, src schema.GroupVersionResource) (dist map[schema.GroupVersionResource]uint64, ...)
- func Extract(u unstructured.Unstructured, fieldPath string, v interface{}) (bool, error)
- func ExtractName(name, selector string) (string, bool)
- func ExtractSelector(u unstructured.Unstructured, fieldPath string) (string, labels.Selector, error)
- func GeneratePaths(src schema.GroupVersionResource, dist map[schema.GroupVersionResource]uint64, ...) map[schema.GroupVersionResource]*Path
- func IsOwnedBy(obj metav1.Object, owner metav1.Object) bool
- func Namespaces(ref unstructured.Unstructured, nsSelector string) ([]string, error)
- type AdjacencyMap
- type Edge
- type Graph
- func (g *Graph) AddEdge(e *Edge)
- func (g *Graph) List(ctx context.Context, dc dynamic.Interface, src unstructured.Unstructured, ...) ([]unstructured.Unstructured, error)
- func (g *Graph) ResourcesFor(ctx context.Context, dc dynamic.Interface, src unstructured.Unstructured, ...) ([]unstructured.Unstructured, error)
- type Item
- type NamespaceSelector
- type Path
- type Queue
- type ResourceRef
Constants ¶
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 = "{.metadata.name}" )
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶
func Dijkstra ¶
func Dijkstra(graph *Graph, src schema.GroupVersionResource) (dist map[schema.GroupVersionResource]uint64, prev map[schema.GroupVersionResource]*Edge)
func Extract ¶
func Extract(u unstructured.Unstructured, fieldPath string, v interface{}) (bool, error)
func ExtractName ¶
func ExtractSelector ¶
func ExtractSelector(u unstructured.Unstructured, fieldPath string) (string, labels.Selector, error)
func GeneratePaths ¶
func GeneratePaths(src schema.GroupVersionResource, dist map[schema.GroupVersionResource]uint64, prev map[schema.GroupVersionResource]*Edge) map[schema.GroupVersionResource]*Path
func Namespaces ¶
func Namespaces(ref unstructured.Unstructured, nsSelector string) ([]string, error)
len([]string) == 0 && err == nil => all namespaces
Types ¶
type AdjacencyMap ¶
type AdjacencyMap map[schema.GroupVersionResource]*Edge
type Edge ¶
type Edge struct { Src schema.GroupVersionResource Dst schema.GroupVersionResource W uint64 Connection v1alpha1.ResourceConnectionSpec Forward bool }
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
func LoadGraphOfKnownResources ¶ added in v0.2.2
func (*Graph) List ¶
func (g *Graph) List(ctx context.Context, dc dynamic.Interface, src unstructured.Unstructured, dstGVR schema.GroupVersionResource) ([]unstructured.Unstructured, error)
func (*Graph) ResourcesFor ¶
func (g *Graph) ResourcesFor(ctx context.Context, dc dynamic.Interface, src unstructured.Unstructured, e Edge) ([]unstructured.Unstructured, error)
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: https://github.com/coreos/prometheus-operator/blob/cc584ecfa08d2eb95ba9401f116e3a20bf71be8b/pkg/apis/monitoring/v1/types.go#L578 NamespaceSelector is a selector for selecting either all namespaces or a list of namespaces. +k8s:openapi-gen=true
type Path ¶
type Path struct { Source schema.GroupVersionResource Target schema.GroupVersionResource Distance uint64 Edges []*Edge }
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)
Click to show internal directories.
Click to hide internal directories.