grapher

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportMultiDocYAML

func ImportMultiDocYAML(source []byte) (arr []map[string]interface{})

ImportMultiDocYAML is a helper function that goes through a yaml file with multiple documents (or objects) separated by '---' or '...' and returns an array of yamls.

Types

type ControlRel

type ControlRel struct {
	Relation
	Replicas int
	Template map[string]interface{}
}

ControlRel describes the relationship between a controller and its children pod.

type LabelRel

type LabelRel struct {
	Relation
}

LabelRel connects objects with spec.selector with pods that have corresponding metadata.labels.

type MatchExpression

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

MatchExpression is used to match Set-based label selectors.

type MatchLabel

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

MatchLabel is used to match Equality label selector.

type Object

type Object struct {
	ID        int
	Kind      string
	Name      string
	Namespace string
	RawYAML   map[string]interface{}
	Relations Relations
}

Object contains information about each k8s component in the chart.

func ParseControllers

func ParseControllers(objs []map[string]interface{}) []Object

ParseControllers parses a k8s object from a single-document yaml and returns an array of controllers.

func ParseObjs

func ParseObjs(objs []map[string]interface{}, releaseNamespace string) []Object

ParseObjs parses a k8s object from a single-document yaml and returns an array of objects that includes its children.

type ParsedObjs

type ParsedObjs struct {
	Objects      []Object
	PodSelectors []string
}

ParsedObjs has methods GetControlRel and GetLabelRel that updates its objects array.

func (*ParsedObjs) GetControlRel

func (parsed *ParsedObjs) GetControlRel()

GetControlRel generates relationships and children objects for common k8s controller types. Note that this only includes controllers whose children are 1) pods and 2) do not have its own YAML. i.e. Children relies entirely on the parent's template. Controllers like CronJob are excluded because its children are not pods.

func (*ParsedObjs) GetLabelRel

func (parsed *ParsedObjs) GetLabelRel()

GetLabelRel is generates relationships between objects connected by selector-label. It supports both Equality-based and Set-based operators with MatchLabels and MatchExpressions, respectively.

func (*ParsedObjs) GetSpecRel

func (parsed *ParsedObjs) GetSpecRel()

GetSpecRel draws relationships between two objects that are tied via various fields in their spec.

type Relation

type Relation struct {
	Source int
	Target int
}

Relation describes the relationship between k8s components. Type is one of CostrolRel, LabelRel, AnnotationsRel, SpecRel. Source and Target contains the ID of the k8s component that is either the giver or recipient of a relationship. All relations are bi-directional in that each object contains both the incoming and outbound relationships.

type Relations

type Relations struct {
	ControlRels []ControlRel
	LabelRels   []LabelRel
	SpecRels    []SpecRel
}

Relations is embedded into the Object struct and contains arrays of the three types of relationships.

type SpecRel

type SpecRel struct {
	Relation
}

SpecRel connects objects via various spec properties.

Jump to

Keyboard shortcuts

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