Documentation
¶
Index ¶
- Constants
- func AddReversedEdge(g Interface, head, tail graph.Node, edgeKind int) bool
- func AllNodes(g Interface, node graph.Node) bool
- func BuildConfig(g MutableUniqueGraph, config *build.BuildConfig) graph.Node
- func CompareImagePipeline(a, b *ImagePipeline) bool
- func CompareObjectMeta(a, b *kapi.ObjectMeta) bool
- func DeploymentConfig(g MutableUniqueGraph, config *deploy.DeploymentConfig) graph.Node
- func DeploymentPipelines(g Graph) (DeploymentPipelineMap, NodeSet)
- func DockerRepository(g MutableUniqueGraph, name, tag string) graph.Node
- func EachTemplateImage(pod *kapi.PodSpec, triggerFn TriggeredByFunc, fn func(TemplateImage, error))
- func EnsureUnique(g UniqueNodeInitializer, name UniqueName, fn NodeInitializerFunc) graph.Node
- func ExistingDirectEdge(g Interface, head, tail graph.Node, edgeKind int) bool
- func ImageStreamTag(g MutableUniqueGraph, namespace, name, tag string) graph.Node
- func NodesByKind(g Interface, nodes []graph.Node, kinds ...int) [][]graph.Node
- func ReverseExistingDirectEdge(g Interface, head, tail graph.Node, edgeKind int) bool
- func ReverseGraphEdge(g Interface, head, tail graph.Node, edgeKind int) bool
- func Service(g MutableUniqueGraph, svc *kapi.Service) graph.Node
- func SourceRepository(g MutableUniqueGraph, source build.BuildSource) (graph.Node, bool)
- type BuildConfigNode
- type DeploymentConfigNode
- type DeploymentFlow
- type DeploymentPipelineMap
- type DockerImageRepositoryNode
- type Edge
- type EdgeFunc
- type Graph
- func (g Graph) AddEdge(head, tail graph.Node, edgeKind int)
- func (g Graph) AddNode(n graph.Node)
- func (g Graph) ConnectedEdgeSubgraph(fn EdgeFunc) Graph
- func (g Graph) EdgeList() []graph.Edge
- func (g Graph) EdgeSubgraph(edgeFn EdgeFunc) Graph
- func (g Graph) FindOrCreate(name UniqueName, fn NodeInitializerFunc) (graph.Node, bool)
- func (g Graph) PredecessorEdges(node graph.Node, fn EdgeFunc, edgeKind ...int)
- func (g Graph) RootNodes() []graph.Node
- func (g Graph) Subgraph(nodeFn NodeFunc, edgeFn EdgeFunc) Graph
- func (g Graph) SubgraphWithNodes(nodes []graph.Node, fn EdgeFunc) Graph
- func (g Graph) SuccessorEdges(node graph.Node, fn EdgeFunc, edgeKind ...int)
- type GraphDescriber
- type ImagePipeline
- type ImageStreamTagNode
- type ImageTagLocation
- type Interface
- type MutableDirectedEdge
- type MutableUniqueGraph
- type Node
- type NodeFunc
- type NodeInitializerFunc
- type NodeSet
- type ServiceGroup
- type ServiceNode
- type ServiceReference
- type SortedDeploymentPipelines
- type SortedImagePipelines
- type SortedServiceGroups
- type SortedServiceReferences
- type SourceLocation
- type SourceRepositoryNode
- type TemplateImage
- type TriggeredByFunc
- type UniqueName
- type UniqueNodeInitializer
Constants ¶
const (
UnknownGraphKind = iota
ImageStreamGraphKind
DockerRepositoryGraphKind
BuildConfigGraphKind
DeploymentConfigGraphKind
SourceRepositoryGraphKind
ServiceGraphKind
)
const (
UnknownGraphEdgeKind = iota
ReferencedByGraphEdgeKind
BuildInputImageGraphEdgeKind
TriggersDeploymentGraphEdgeKind
BuildInputGraphEdgeKind
BuildOutputGraphEdgeKind
UsedInDeploymentGraphEdgeKind
ExposedThroughServiceGraphEdgeKind
)
Variables ¶
This section is empty.
Functions ¶
func AddReversedEdge ¶
func AddReversedEdge(g Interface, head, tail graph.Node, edgeKind int) bool
AddReversedEdge adds a reversed edge for every passed edge and preserves the existing edge. Used to convert a one directional edge into a bidirectional edge, but will create duplicate edges if a bidirectional edge between two nodes already exists.
func AllNodes ¶
func AllNodes(g Interface, node graph.Node) bool
AllNodes includes all nodes in the graph
func BuildConfig ¶
func BuildConfig(g MutableUniqueGraph, config *build.BuildConfig) graph.Node
BuildConfig adds a graph node for the specific build config if it does not exist, and will link the build config to other nodes for the images and source repositories it depends on.
func CompareImagePipeline ¶
func CompareImagePipeline(a, b *ImagePipeline) bool
func CompareObjectMeta ¶
func CompareObjectMeta(a, b *kapi.ObjectMeta) bool
func DeploymentConfig ¶
func DeploymentConfig(g MutableUniqueGraph, config *deploy.DeploymentConfig) graph.Node
DeploymentConfig adds the provided deployment config to the graph if it does not exist, and will create edges that point to named Docker image repositories for each image used in the deployment.
func DeploymentPipelines ¶
func DeploymentPipelines(g Graph) (DeploymentPipelineMap, NodeSet)
DeploymentPipelines returns a map of DeploymentConfigs to the deployment flows that create them, extracted from the provided Graph.
func DockerRepository ¶
func DockerRepository(g MutableUniqueGraph, name, tag string) graph.Node
DockerRepository adds the named Docker repository tag reference to the graph if it does not already exist. If the reference is invalid, the Name field of the graph will be used directly.
func EachTemplateImage ¶
func EachTemplateImage(pod *kapi.PodSpec, triggerFn TriggeredByFunc, fn func(TemplateImage, error))
func EnsureUnique ¶
func EnsureUnique(g UniqueNodeInitializer, name UniqueName, fn NodeInitializerFunc) graph.Node
func ExistingDirectEdge ¶
func ExistingDirectEdge(g Interface, head, tail graph.Node, edgeKind int) bool
ExistingDirectEdge returns true if both head and tail already exist in the graph and the edge kind is not ReferencedByGraphEdgeKind (the generic reverse edge kind). This will purge the graph of any edges created by AddReversedEdge.
func ImageStreamTag ¶
func ImageStreamTag(g MutableUniqueGraph, namespace, name, tag string) graph.Node
ImageStreamTag adds a graph node for the specific tag in an Image Repository if it does not already exist.
func NodesByKind ¶
func NodesByKind(g Interface, nodes []graph.Node, kinds ...int) [][]graph.Node
func ReverseExistingDirectEdge ¶
func ReverseExistingDirectEdge(g Interface, head, tail graph.Node, edgeKind int) bool
ExistingDirectEdge returns true if both nodes exist in the graph already and the edge kind is not ReferencedByGraphEdgeKind (the generic reverse edge kind).
func ReverseGraphEdge ¶
func ReverseGraphEdge(g Interface, head, tail graph.Node, edgeKind int) bool
ReverseGraphEdge reverses the order of the edge and drops the existing edge.
func Service ¶
func Service(g MutableUniqueGraph, svc *kapi.Service) graph.Node
Service adds the provided service to the graph if it does not already exist. It does not link the service to covered nodes (that is a separate method).
func SourceRepository ¶
func SourceRepository(g MutableUniqueGraph, source build.BuildSource) (graph.Node, bool)
SourceRepository adds the specific BuildSource to the graph if it does not already exist.
Types ¶
type BuildConfigNode ¶
type BuildConfigNode struct {
Node
*build.BuildConfig
}
type DeploymentConfigNode ¶
type DeploymentConfigNode struct {
Node
*deploy.DeploymentConfig
}
type DeploymentFlow ¶
type DeploymentFlow struct {
Deployment *DeploymentConfigNode
Images []ImagePipeline
}
type DeploymentPipelineMap ¶
type DeploymentPipelineMap map[*DeploymentConfigNode][]ImagePipeline
DeploymentPipelineMap describes a single deployment config and the objects that contributed to that deployment.
type DockerImageRepositoryNode ¶
type DockerImageRepositoryNode struct {
Node
Ref image.DockerImageReference
}
type EdgeFunc ¶
type EdgeFunc func(g Interface, head, tail graph.Node, edgeKind int) bool
EdgeFunc is passed a new graph, an edge in the current graph, and should mutate the new graph as needed. If true is returned, the existing edge will be added to the graph.
func AddGraphEdgesTo ¶
func AddGraphEdgesTo(g Interface) EdgeFunc
AddGraphEdgesTo returns an EdgeFunc that will add the selected edges to the passed graph.
func UncoveredDeploymentFlowEdges ¶
func UncoveredDeploymentFlowEdges(covered NodeSet) EdgeFunc
UncoveredDeploymentFlowEdges preserves (and duplicates) edges that were not covered by a deployment flow. As a special case, it preserves edges between Services and DeploymentConfigs.
type Graph ¶
type Graph struct {
// the standard graph
graph.DirectedGraph
// helper methods for switching on the kind and types of the node
GraphDescriber
// contains filtered or unexported fields
}
func CoverServices ¶
func CoverServices(g Graph) Graph
CoverServices ensures that a directed edge exists between all deployment configs and the services that expose them (via label selectors).
func (Graph) AddEdge ¶
func (g Graph) AddEdge(head, tail graph.Node, edgeKind int)
AddEdge implements MutableUniqueGraph
func (Graph) ConnectedEdgeSubgraph ¶
func (g Graph) ConnectedEdgeSubgraph(fn EdgeFunc) Graph
ConnectedEdgeSubgraph creates a new graph that iterates through all edges in the graph and includes all edges the provided function returns true for. Nodes not referenced by an edge will be dropped unless the function adds them explicitly.
func (Graph) EdgeSubgraph ¶
func (g Graph) EdgeSubgraph(edgeFn EdgeFunc) Graph
Subgraph returns the directed subgraph with only the nodes and edges that match the provided functions.
func (Graph) FindOrCreate ¶
func (g Graph) FindOrCreate(name UniqueName, fn NodeInitializerFunc) (graph.Node, bool)
func (Graph) PredecessorEdges ¶
func (g Graph) PredecessorEdges(node graph.Node, fn EdgeFunc, edgeKind ...int)
PredecessorEdges invokes fn with all of the predecessor edges of node that have the specified edge kind.
func (Graph) RootNodes ¶
func (g Graph) RootNodes() []graph.Node
RootNodes returns all the roots of this graph.
func (Graph) Subgraph ¶
func (g Graph) Subgraph(nodeFn NodeFunc, edgeFn EdgeFunc) Graph
Subgraph returns the directed subgraph with only the nodes and edges that match the provided functions.
func (Graph) SubgraphWithNodes ¶
func (g Graph) SubgraphWithNodes(nodes []graph.Node, fn EdgeFunc) Graph
SubgraphWithNodes returns the directed subgraph with only the listed nodes and edges that match the provided function.
func (Graph) SuccessorEdges ¶
func (g Graph) SuccessorEdges(node graph.Node, fn EdgeFunc, edgeKind ...int)
SuccessorEdges invokes fn with all of the successor edges of node that have the specified edge kind.
type GraphDescriber ¶
type GraphDescriber interface {
Name(node graph.Node) string
Kind(node graph.Node) int
Object(node graph.Node) interface{}
EdgeKind(edge graph.Edge) int
}
type ImagePipeline ¶
type ImagePipeline struct {
Image ImageTagLocation
Build *BuildConfigNode
// If set, the base image used by the build
BaseImage ImageTagLocation
// If set, the source repository that inputs to the build
Source SourceLocation
}
ImagePipeline represents a build, its output, and any inputs. The input to a build may be another ImagePipeline.
func ImagePipelineFromNode ¶
func ImagePipelineFromNode(g Graph, n graph.Node, covered NodeSet) (ImagePipeline, bool)
ImagePipelineFromNode attempts to locate a build flow from the provided node. If no such build flow can be located, false is returned.
type ImageStreamTagNode ¶
type ImageStreamTagNode struct {
Node
*image.ImageStream
Tag string
}
type ImageTagLocation ¶
type ImageTagLocation interface {
ID() int
ImageSpec() string
ImageTag() string
}
ImageTagLocation identifies the source or destination of an image. Represents both a tag in a Docker image repository, as well as a tag in an OpenShift image stream.
type Interface ¶
type Interface interface {
graph.DirectedGraph
graph.EdgeLister
GraphDescriber
MutableUniqueGraph
}
type MutableDirectedEdge ¶
type MutableDirectedEdge interface {
AddEdge(head, tail graph.Node, edgeKind int)
}
type MutableUniqueGraph ¶
type MutableUniqueGraph interface {
graph.Mutable
MutableDirectedEdge
UniqueNodeInitializer
}
type NodeFunc ¶
type NodeFunc func(g Interface, n graph.Node) bool
NodeFunc is passed a new graph, a node in the graph, and should return true if the node should be included.
func UncoveredDeploymentFlowNodes ¶
func UncoveredDeploymentFlowNodes(covered NodeSet) NodeFunc
UncoveredDeploymentFlowNodes includes nodes that either services or deployment configs, or which haven't previously been covered.
type NodeInitializerFunc ¶
type NodeInitializerFunc func(Node) graph.Node
type ServiceGroup ¶
type ServiceGroup struct {
Services []ServiceReference
Deployments []DeploymentFlow
Builds []ImagePipeline
}
ServiceGroup is a related set of resources that should be displayed together logically. They are usually sorted internally.
func ServiceAndDeploymentGroups ¶
func ServiceAndDeploymentGroups(g Graph) []ServiceGroup
ServiceAndDeploymentGroups breaks the provided graph of API relationships into ServiceGroup objects, ordered consistently. Groups are organized so that overlapping Services and DeploymentConfigs are part of the same group, Deployment Configs are each in their own group, and then BuildConfigs are part of the last service group.
type ServiceNode ¶
type ServiceNode struct {
Node
*kapi.Service
}
type ServiceReference ¶
type ServiceReference struct {
Service *ServiceNode
Covers []*DeploymentConfigNode
}
ServiceReference is a service and the DeploymentConfigs it covers
type SortedDeploymentPipelines ¶
type SortedDeploymentPipelines []DeploymentFlow
type SortedImagePipelines ¶
type SortedImagePipelines []ImagePipeline
type SortedServiceGroups ¶
type SortedServiceGroups []ServiceGroup
type SortedServiceReferences ¶
type SortedServiceReferences []ServiceReference
type SourceLocation ¶
type SourceLocation interface {
ID() int
}
SourceLocation identifies a repository that is an input to a build.
type SourceRepositoryNode ¶
type SourceRepositoryNode struct {
Node
Source build.BuildSource
}
type TemplateImage ¶
type TemplateImage struct {
Image string
Ref *image.DockerImageReference
From *kapi.ObjectReference
FromTag string
}
type TriggeredByFunc ¶
type TriggeredByFunc func(container *kapi.Container) (TemplateImage, bool)
func DeploymentConfigHasTrigger ¶
func DeploymentConfigHasTrigger(config *deploy.DeploymentConfig) TriggeredByFunc
type UniqueName ¶
type UniqueName string
func (UniqueName) UniqueName ¶
func (n UniqueName) UniqueName() string
type UniqueNodeInitializer ¶
type UniqueNodeInitializer interface {
FindOrCreate(name UniqueName, fn NodeInitializerFunc) (graph.Node, bool)
}
UniqueNodeInitializer is a graph that allows nodes with a unique name to be added without duplication. If the node is newly added, true will be returned.