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 Fprint(out io.Writer, g Graph)
- func ImageStreamTag(g MutableUniqueGraph, namespace, name, tag string) graph.Node
- func JoinBuilds(node *BuildConfigNode, builds []build.Build)
- func JoinDeployments(node *DeploymentConfigNode, deploys []kapi.ReplicationController)
- 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 RecentBuildReferences
- type RecentDeploymentReferences
- 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 ¶
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 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 ¶
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 JoinBuilds ¶ added in v0.4.4
func JoinBuilds(node *BuildConfigNode, builds []build.Build)
func JoinDeployments ¶ added in v0.4.4
func JoinDeployments(node *DeploymentConfigNode, deploys []kapi.ReplicationController)
func ReverseExistingDirectEdge ¶
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 ¶
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 LastSuccessfulBuild *build.Build LastUnsuccessfulBuild *build.Build ActiveBuilds []build.Build }
func (*BuildConfigNode) Kind ¶
func (*BuildConfigNode) Kind() int
func (BuildConfigNode) Object ¶
func (n BuildConfigNode) Object() interface{}
func (BuildConfigNode) String ¶
func (n BuildConfigNode) String() string
type DeploymentConfigNode ¶
type DeploymentConfigNode struct { Node *deploy.DeploymentConfig ActiveDeployment *kapi.ReplicationController Deployments []*kapi.ReplicationController }
func (*DeploymentConfigNode) Kind ¶
func (*DeploymentConfigNode) Kind() int
func (DeploymentConfigNode) Object ¶
func (n DeploymentConfigNode) Object() interface{}
func (DeploymentConfigNode) String ¶
func (n DeploymentConfigNode) String() string
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 }
func (DockerImageRepositoryNode) ImageSpec ¶
func (n DockerImageRepositoryNode) ImageSpec() string
func (DockerImageRepositoryNode) ImageTag ¶
func (n DockerImageRepositoryNode) ImageTag() string
func (*DockerImageRepositoryNode) Kind ¶
func (*DockerImageRepositoryNode) Kind() int
func (DockerImageRepositoryNode) String ¶
func (n DockerImageRepositoryNode) String() string
type EdgeFunc ¶
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 ¶
AddGraphEdgesTo returns an EdgeFunc that will add the selected edges to the passed graph.
func UncoveredDeploymentFlowEdges ¶
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 ¶
CoverServices ensures that a directed edge exists between all deployment configs and the services that expose them (via label selectors).
func (Graph) ConnectedEdgeSubgraph ¶
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 ¶
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 ¶
PredecessorEdges invokes fn with all of the predecessor edges of node that have the specified edge kind.
func (Graph) Subgraph ¶
Subgraph returns the directed subgraph with only the nodes and edges that match the provided functions.
func (Graph) SubgraphWithNodes ¶
SubgraphWithNodes returns the directed subgraph with only the listed nodes and edges that match the provided function.
type GraphDescriber ¶
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 ¶
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 }
func (ImageStreamTagNode) ImageSpec ¶
func (n ImageStreamTagNode) ImageSpec() string
func (ImageStreamTagNode) ImageTag ¶
func (n ImageStreamTagNode) ImageTag() string
func (*ImageStreamTagNode) Kind ¶
func (*ImageStreamTagNode) Kind() int
func (ImageStreamTagNode) Object ¶
func (n ImageStreamTagNode) Object() interface{}
func (ImageStreamTagNode) String ¶
func (n ImageStreamTagNode) String() string
type ImageTagLocation ¶
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 MutableUniqueGraph ¶
type MutableUniqueGraph interface { graph.Mutable MutableDirectedEdge UniqueNodeInitializer }
type Node ¶
type Node struct { concrete.Node UniqueName }
type NodeFunc ¶
NodeFunc is passed a new graph, a node in the graph, and should return true if the node should be included.
func UncoveredDeploymentFlowNodes ¶
UncoveredDeploymentFlowNodes includes nodes that either services or deployment configs, or which haven't previously been covered.
type NodeInitializerFunc ¶
type RecentBuildReferences ¶ added in v0.4.4
func (RecentBuildReferences) Len ¶ added in v0.4.4
func (m RecentBuildReferences) Len() int
func (RecentBuildReferences) Less ¶ added in v0.4.4
func (m RecentBuildReferences) Less(i, j int) bool
func (RecentBuildReferences) Swap ¶ added in v0.4.4
func (m RecentBuildReferences) Swap(i, j int)
type RecentDeploymentReferences ¶ added in v0.4.4
type RecentDeploymentReferences []*kapi.ReplicationController
func (RecentDeploymentReferences) Len ¶ added in v0.4.4
func (m RecentDeploymentReferences) Len() int
func (RecentDeploymentReferences) Less ¶ added in v0.4.4
func (m RecentDeploymentReferences) Less(i, j int) bool
func (RecentDeploymentReferences) Swap ¶ added in v0.4.4
func (m RecentDeploymentReferences) Swap(i, j int)
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 ¶
func (*ServiceNode) Kind ¶
func (*ServiceNode) Kind() int
func (ServiceNode) Object ¶
func (n ServiceNode) Object() interface{}
func (ServiceNode) String ¶
func (n ServiceNode) String() string
type ServiceReference ¶
type ServiceReference struct { Service *ServiceNode Covers []*DeploymentConfigNode }
ServiceReference is a service and the DeploymentConfigs it covers
type SortedDeploymentPipelines ¶
type SortedDeploymentPipelines []DeploymentFlow
func (SortedDeploymentPipelines) Len ¶
func (m SortedDeploymentPipelines) Len() int
func (SortedDeploymentPipelines) Less ¶
func (m SortedDeploymentPipelines) Less(i, j int) bool
func (SortedDeploymentPipelines) Swap ¶
func (m SortedDeploymentPipelines) Swap(i, j int)
type SortedImagePipelines ¶
type SortedImagePipelines []ImagePipeline
func (SortedImagePipelines) Len ¶
func (m SortedImagePipelines) Len() int
func (SortedImagePipelines) Less ¶
func (m SortedImagePipelines) Less(i, j int) bool
func (SortedImagePipelines) Swap ¶
func (m SortedImagePipelines) Swap(i, j int)
type SortedServiceGroups ¶
type SortedServiceGroups []ServiceGroup
func (SortedServiceGroups) Len ¶
func (m SortedServiceGroups) Len() int
func (SortedServiceGroups) Less ¶
func (m SortedServiceGroups) Less(i, j int) bool
func (SortedServiceGroups) Swap ¶
func (m SortedServiceGroups) Swap(i, j int)
type SortedServiceReferences ¶
type SortedServiceReferences []ServiceReference
func (SortedServiceReferences) Len ¶
func (m SortedServiceReferences) Len() int
func (SortedServiceReferences) Less ¶
func (m SortedServiceReferences) Less(i, j int) bool
func (SortedServiceReferences) Swap ¶
func (m SortedServiceReferences) Swap(i, j int)
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 }
func (SourceRepositoryNode) Kind ¶
func (SourceRepositoryNode) Kind() int
func (SourceRepositoryNode) String ¶
func (n SourceRepositoryNode) String() string
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.