generator

package
v1.57.13 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Dense creates a graph with many nodes.
	Dense = "dense"
	// Sparse creates a graph with few nodes.
	Sparse = "sparse"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	// Cluster is the name of the cluster all nodes will live in.
	Cluster string

	// Type of graph to render e.g. Versioned App Graph.
	GraphType string

	// IncludeBoxing determines whether nodes will include boxing or not.
	IncludeBoxing bool

	// NumberOfApps sets how many apps to create.
	NumberOfApps int

	// NumberOfIngress sets how many ingress to create.
	NumberOfIngress int

	// PopulationStrategy determines how many connections from ingress i.e. dense or sparse.
	PopulationStrategy string
	// contains filtered or unexported fields
}

Generator creates cytoscape graph data based on the options provided. It is used for testing a variety of graph layouts, large dense graphs in particular, without needing to deploy the actual resources. It is not intended to be used for anything other than testing.

func New

func New(opts Options) (*Generator, error)

New create a new Generator. Options can be nil.

func (*Generator) EnsureNamespaces

func (g *Generator) EnsureNamespaces(cyGraph cytoscape.Config) error

EnsureNamespaces makes sure a kube namespace exists for the nodes. The namespaces need to actually exist in order for the UI to render the graph. Does nothing if a kubeclient is not configured.

func (*Generator) Generate

func (g *Generator) Generate() cytoscape.Config

Generate creates a graph response object based on the generator's options. The generated graph assumes that: 1. Workloads send requests to services. 2. Services send requests to the workloads in their app. 3. Ingress workloads are root nodes.

type Options

type Options struct {
	// Cluster is the name of the cluster all nodes will live in.
	Cluster *string

	// IncludeBoxing determines whether nodes will include boxing or not.
	IncludeBoxing *bool

	// KubeClient if passed enables talking to the kube api to get/create namespaces.
	KubeClient kubernetes.Interface

	// NumberOfApps sets how many apps to create.
	NumberOfApps *int

	// NumberOfIngress sets how many ingress to create.
	NumberOfIngress *int

	// PopulationStrategy determines how many connections from ingress i.e. dense or sparse.
	PopulationStrategy *string
}

Options used to configure a Generator.

type PopStratValue

type PopStratValue string

PopStratValue implements flag.Value interface so pop strategy can be used as a flag.

func (*PopStratValue) Set

func (i *PopStratValue) Set(value string) error

func (*PopStratValue) String

func (p *PopStratValue) String() string

Jump to

Keyboard shortcuts

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