topology

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	LastFetch     time.Time
	CacheDuration time.Duration
	Topology      *Topology
}

Cache is the structure which can be used to cache the generated topology graph in the applications plugin.

type Edge

type Edge struct {
	Data EdgeData `json:"data"`
}

Edge is the structure for a edge in the topology graph.

type EdgeData

type EdgeData struct {
	ID              string `json:"id"`
	Source          string `json:"source"`
	SourceCluster   string `json:"-"`
	SourceNamespace string `json:"-"`
	SourceName      string `json:"-"`
	Target          string `json:"target"`
	TargetCluster   string `json:"-"`
	TargetNamespace string `json:"-"`
	TargetName      string `json:"-"`
	Description     string `json:"description"`
}

EdgeData is the data for a edge. Each edge must contain a unique id a source and a target. Where the source and target is a reference to the id of a node. Each edge also contains the cluster, namespace and name of the source and target and an optional description, which can be used to describe the relationship between the source and target.

type Node

type Node struct {
	Data NodeData `json:"data"`
}

Node is the structure for a node in the topology graph.

type NodeData

type NodeData struct {
	ID     string `json:"id"`
	Type   string `json:"type"`
	Label  string `json:"label"`
	Parent string `json:"parent"`
	application.ApplicationSpec
}

NodeData is the data for a node. Each node must contain a unique id, type (application, namespace, cluster) a label and a parent. Each application node has a namespace nodes as parent and each namespace has a cluster as parent.

type Topology

type Topology struct {
	Edges []Edge `json:"edges"`
	Nodes []Node `json:"nodes"`
}

Topology is the structure of the topology graph. The topology contains a list of nodes (applications, namespaces and clusters) and a list of edges, which are defined by the dependencies field in the Applications CR.

func Generate

func Generate(topology *Topology, clusters, namespaces []string) *Topology

Generate is used to generate the topology chart for the users selected clusters and namespace. To generate this part of the topology graph we are going through all given clusters and namespace and add all the edges which are containing the given cluster/namespace as source or target. After that we are looping through all the edges and we are adding the source and target nodes. We are also creating an additional slice for the cluster and namespace nodes, which are then merged with the nodes slice. This is necessary, because we do not save the clusters and namespaces as nodes in the cached topology.

func Get

func Get(ctx context.Context, clusters *clusters.Clusters) *Topology

Get returnes the topology graph for all the configured clusters. To generate the topology chart we have to loop through all clusters and get all applications for all clusters. Then we are going through all the applications and and add them as node in the topology grahp. The defined dependencies for all applications are added as edges in the topology.

Jump to

Keyboard shortcuts

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