adapter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAll

func GetAll() map[reflect.Type]ResourceAdapter

GetAll returns all adapters registered

func Register

func Register(adapter ResourceAdapter)

Register sets up a given resource type adapter

Types

type Edge added in v0.2.0

type Edge interface {
	dot.Edge
}

type Graph added in v0.2.0

type Graph interface {
	dot.Graph
}

func NewGraph added in v0.2.0

func NewGraph() (Graph, error)

type Node added in v0.2.0

type Node interface {
	dot.Node
}

type ResourceAdapter

type ResourceAdapter interface {
	// GetType returns the reflected type of the k8s kind managed by this instance
	GetType() reflect.Type
	// Create add a graph node for the given object and stores it for further actions
	Create(sgraph StatefulGraph, obj runtime.Object) (Node, error)
	// Connect creates and edge between the given node and an object on this adapter
	Connect(sgraph StatefulGraph, source Node, targetName string) (Edge, error)
	// Configure connects the resources on this adapter with its dependencies
	Configure(sgraph StatefulGraph) error
}

ResourceAdapter instructions on how to deal with a given kubernetes kind

func Get

func Get(resourceType reflect.Type) (ResourceAdapter, error)

Get returns the adapter for a resource type, if it is registered

type ResourceData

type ResourceData struct {
	ResourceType reflect.Type
}

ResourceData data used by kubernetes resource adapters

type StatefulGraph

type StatefulGraph interface {
	io.WriterTo
	// AddStyledNode creates a new styled node with the given resource
	AddStyledNode(resourceType reflect.Type, resourceObject runtime.Object, nodeName string, resourceName string, icon string) (Node, error)
	// LinkNode links the node to the target node type/name, if it exists
	LinkNode(node Node, targetNodeType reflect.Type, targetNodeName string) (Edge, error)
	// GetObjects gets all objects in store
	GetObjects(objectType reflect.Type) (map[string]runtime.Object, error)
	// GetNode gets a node by type/name
	GetNode(nodeType reflect.Type, nodeName string) (Node, error)
}

StatefulGraph graphviz-compatible struct with runtime object and node storage

Jump to

Keyboard shortcuts

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