graph

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultNodeNameLimit represents the default limit to truncate the node name to N characters.
	DefaultNodeNameLimit int = 12
)

Variables

This section is empty.

Functions

func FilterByValue added in v0.6.0

func FilterByValue(kv map[string]string, f func(string) bool) map[string]string

FilterByValue filters a key value map by value using a function.

func FromUnstructured

func FromUnstructured(unstr *unstructured.Unstructured, obj runtime.Object) error

FromUnstructured converts an unstructured object into a concrete type.

func ToUID

func ToUID(params ...interface{}) types.UID

ToUID converts all params to MD5 and returns this as types.UID.

Types

type CoreV1Graph

type CoreV1Graph struct {
	// contains filtered or unexported fields
}

CoreV1Graph is used to graph all core resources.

func NewCoreV1Graph

func NewCoreV1Graph(g *Graph) *CoreV1Graph

NewCoreV1Graph creates a new CoreV1Graph.

func (*CoreV1Graph) Cluster added in v0.4.0

func (g *CoreV1Graph) Cluster() (*Node, error)

Cluster adds a v1.Cluster resource to the Graph.

func (*CoreV1Graph) Container

func (g *CoreV1Graph) Container(pod *v1.Pod, container v1.Container) (*Node, error)

Container adds a v1.Container resource to the Graph.

func (*CoreV1Graph) Endpoints

func (g *CoreV1Graph) Endpoints(obj *v1.Endpoints) (*Node, error)

Endpoints adds a v1.Endpoints resource to the Graph.

func (*CoreV1Graph) Image

func (g *CoreV1Graph) Image(name string) (*Node, error)

Image adds a v1.Image resource to the Graph.

func (*CoreV1Graph) Namespace added in v0.1.2

func (g *CoreV1Graph) Namespace(ns *v1.Namespace) (*Node, error)

Namespace adds a v1.Namespace resource to the Graph.

func (*CoreV1Graph) Node

func (g *CoreV1Graph) Node(obj *v1.Node) (*Node, error)

Node adds a v1.Node resource to the Graph.

func (*CoreV1Graph) ObjectReference added in v0.1.1

func (g *CoreV1Graph) ObjectReference(obj *v1.ObjectReference) (*Node, error)

ObjectReference adds a v1.ObjectReference resource to the Graph.

func (*CoreV1Graph) Pod

func (g *CoreV1Graph) Pod(pod *v1.Pod) (*Node, error)

Pod adds a v1.Pod resource to the Graph.

func (*CoreV1Graph) Registry

func (g *CoreV1Graph) Registry(name string) (*Node, error)

Registry adds a v1.Registry resource to the Graph.

func (*CoreV1Graph) Service

func (g *CoreV1Graph) Service(obj *v1.Service) (*Node, error)

Service adds a v1.Service resource to the Graph.

func (*CoreV1Graph) ServiceTypeClusterIP

func (g *CoreV1Graph) ServiceTypeClusterIP(obj *v1.Service) (*Node, error)

ServiceTypeClusterIP adds a v1.Service of type ClusterIP to the Graph.

func (*CoreV1Graph) ServiceTypeExternalName

func (g *CoreV1Graph) ServiceTypeExternalName(obj *v1.Service) (*Node, error)

ServiceTypeExternalName adds a v1.Service of type ExternalName to the Graph.

func (*CoreV1Graph) ServiceTypeLoadBalancer

func (g *CoreV1Graph) ServiceTypeLoadBalancer(obj *v1.Service) (*Node, error)

ServiceTypeLoadBalancer adds a v1.Service of type LoadBalancer to the Graph.

func (*CoreV1Graph) TypedLocalObjectReference added in v0.3.0

func (g *CoreV1Graph) TypedLocalObjectReference(obj *v1.TypedLocalObjectReference, namespace string) (*Node, error)

TypedLocalObjectReference adds a v1.TypedLocalObjectReference resource to the Graph.

func (*CoreV1Graph) Unstructured

func (g *CoreV1Graph) Unstructured(unstr *unstructured.Unstructured) (*Node, error)

Unstructured adds an unstructured node to the Graph.

type Graph

type Graph struct {
	Nodes         map[types.UID]*Node
	Relationships map[types.UID][]*Relationship
	Options       *Options
	// contains filtered or unexported fields
}

Graph stores nodes and relationships between them.

func NewGraph

func NewGraph(clientset *kubernetes.Clientset, objs []*unstructured.Unstructured, processed func()) (*Graph, error)

NewGraph returns a new initialized a Graph.

func (*Graph) CoreV1

func (g *Graph) CoreV1() *CoreV1Graph

CoreV1 retrieves the CoreV1Graph.

func (*Graph) Finalize added in v0.4.0

func (g *Graph) Finalize() error

Finalize adds missing relationships to the Graph.

func (*Graph) NetworkingV1

func (g *Graph) NetworkingV1() *NetworkingV1Graph

NetworkingV1 retrieves the NetworkingV1Graph.

func (*Graph) Node

func (g *Graph) Node(gvk schema.GroupVersionKind, obj metav1.Object) *Node

Node adds a node and the owner references to the Graph.

func (*Graph) NodeList added in v0.4.0

func (g *Graph) NodeList() []*Node

NodeList returns a list of all nodes.

func (*Graph) Relationship

func (g *Graph) Relationship(from *Node, label string, to *Node) *Relationship

Relationship creates a new relationship between two nodes.

func (*Graph) RelationshipList added in v0.4.0

func (g *Graph) RelationshipList() []*Relationship

RelationshipList returns a list of all relationships.

func (*Graph) RouteV1 added in v0.1.2

func (g *Graph) RouteV1() *RouteV1Graph

RouteV1 retrieves the RouteV1Graph.

func (*Graph) String

func (g *Graph) String(format string) string

String returns the graph in requested format.

func (*Graph) Unstructured

func (g *Graph) Unstructured(unstr *unstructured.Unstructured) (*Node, error)

Unstructured adds an unstructured node to the Graph.

func (*Graph) Write

func (g *Graph) Write(w io.Writer, format string) error

Write formats according to the requested format and writes to w.

type NetworkingV1Graph

type NetworkingV1Graph struct {
	// contains filtered or unexported fields
}

NetworkingV1Graph is used to graph all networking resources.

func NewNetworkingV1Graph

func NewNetworkingV1Graph(g *Graph) *NetworkingV1Graph

NewNetworkingV1Graph creates a new NetworkingV1Graph.

func (*NetworkingV1Graph) Host added in v0.3.0

func (g *NetworkingV1Graph) Host(name string) (*Node, error)

Host adds a v1.Host resource to the Graph.

func (*NetworkingV1Graph) IPBlock added in v0.2.0

func (g *NetworkingV1Graph) IPBlock(cidr string) (*Node, error)

IPBlock adds a v1.IPBlock resource to the Graph.

func (*NetworkingV1Graph) Ingress added in v0.3.0

func (g *NetworkingV1Graph) Ingress(obj *v1.Ingress) (*Node, error)

Ingress adds a v1.Ingress resource to the Graph.

func (*NetworkingV1Graph) IngressBackend added in v0.3.0

func (g *NetworkingV1Graph) IngressBackend(obj *v1.Ingress, backend v1.IngressBackend) (*Node, error)

IngressBackend adds a v1.IngressBackend resource to the Graph.

func (*NetworkingV1Graph) NetworkPolicy

func (g *NetworkingV1Graph) NetworkPolicy(obj *v1.NetworkPolicy) (*Node, error)

NetworkPolicy adds a v1.NetworkPolicy resource to the Graph.

func (*NetworkingV1Graph) NetworkPolicyPeer added in v0.2.0

func (g *NetworkingV1Graph) NetworkPolicyPeer(obj *v1.NetworkPolicy, policyType v1.PolicyType, peer v1.NetworkPolicyPeer) (*Node, error)

NetworkPolicyPeer adds a v1.NetworkPolicyPeer resource to the Graph.

func (*NetworkingV1Graph) NetworkPolicyPeerIPBlock added in v0.2.0

func (g *NetworkingV1Graph) NetworkPolicyPeerIPBlock(obj *v1.NetworkPolicy, policyType v1.PolicyType, peer v1.NetworkPolicyPeer) (*Node, error)

NetworkPolicyPeerIPBlock adds a v1.NetworkPolicyPeer of type IPBlock to the Graph.

func (*NetworkingV1Graph) NetworkPolicyPeerNamespaceAndPodSelector added in v0.2.0

func (g *NetworkingV1Graph) NetworkPolicyPeerNamespaceAndPodSelector(obj *v1.NetworkPolicy, policyType v1.PolicyType, peer v1.NetworkPolicyPeer) (*Node, error)

NetworkPolicyPeerNamespaceAndPodSelector adds a v1.NetworkPolicyPeer of type NamespaceAndPodSelector to the Graph.

func (*NetworkingV1Graph) NetworkPolicyPeerNamespaceSelector added in v0.2.0

func (g *NetworkingV1Graph) NetworkPolicyPeerNamespaceSelector(obj *v1.NetworkPolicy, policyType v1.PolicyType, peer v1.NetworkPolicyPeer) (*Node, error)

NetworkPolicyPeerNamespaceSelector adds a v1.NetworkPolicyPeer of type NamespaceSelector to the Graph.

func (*NetworkingV1Graph) NetworkPolicyPeerPodSelector added in v0.2.0

func (g *NetworkingV1Graph) NetworkPolicyPeerPodSelector(obj *v1.NetworkPolicy, policyType v1.PolicyType, peer v1.NetworkPolicyPeer) (*Node, error)

NetworkPolicyPeerPodSelector adds a v1.NetworkPolicyPeer of type PodSelector to the Graph.

func (*NetworkingV1Graph) Relationship added in v0.2.0

func (g *NetworkingV1Graph) Relationship(from *Node, policyType v1.PolicyType, to *Node) (r *Relationship)

Relationship creates a new relationship between two nodes based on v1.PolicyType.

func (*NetworkingV1Graph) Unstructured

func (g *NetworkingV1Graph) Unstructured(unstr *unstructured.Unstructured) (*Node, error)

Unstructured adds an unstructured node to the Graph.

type Node

type Node struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
}

Node represents a node in the graph.

type Options added in v0.6.0

type Options struct {
	NodeNameLimit int
}

Options represents attributes to configure the graph.

type Relationship

type Relationship struct {
	From  types.UID
	Label string
	To    types.UID
	Attr  map[string]string
}

Relationship represents a relationship between nodes in the graph.

func (*Relationship) Attribute added in v0.1.2

func (r *Relationship) Attribute(key string, value string) *Relationship

Attribute adds an attribute to a relationship.

type RouteV1Graph added in v0.1.2

type RouteV1Graph struct {
	// contains filtered or unexported fields
}

RouteV1Graph is used to graph all routing resources.

func NewRouteV1Graph added in v0.1.2

func NewRouteV1Graph(g *Graph) *RouteV1Graph

NewRouteV1Graph creates a new RouteV1Graph.

func (*RouteV1Graph) Route added in v0.1.2

func (g *RouteV1Graph) Route(obj *v1.Route) (*Node, error)

Route adds a v1.Route resource to the Graph.

func (*RouteV1Graph) Unstructured added in v0.1.2

func (g *RouteV1Graph) Unstructured(unstr *unstructured.Unstructured) (*Node, error)

Unstructured adds an unstructured node to the Graph.

Jump to

Keyboard shortcuts

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