@@ -3,67 +3,11 @@ package nodes
33import (
44 "github.com/gonum/graph"
55
6- kapisext "k8s.io/kubernetes/pkg/apis/extensions"
7-
86 appsapi "github.com/openshift/origin/pkg/apps/apis/apps"
97 osgraph "github.com/openshift/origin/pkg/oc/graph/genericgraph"
108 kubegraph "github.com/openshift/origin/pkg/oc/graph/kubegraph/nodes"
119)
1210
13- // EnsureDaemonSetNode adds the provided daemon set to the graph if it does not exist
14- func EnsureDaemonSetNode (g osgraph.MutableUniqueGraph , ds * kapisext.DaemonSet ) * DaemonSetNode {
15- dsName := DaemonSetNodeName (ds )
16- dsNode := osgraph .EnsureUnique (
17- g ,
18- dsName ,
19- func (node osgraph.Node ) graph.Node {
20- return & DaemonSetNode {Node : node , DaemonSet : ds , IsFound : true }
21- },
22- ).(* DaemonSetNode )
23-
24- podTemplateSpecNode := kubegraph .EnsurePodTemplateSpecNode (g , & ds .Spec .Template , ds .Namespace , dsName )
25- g .AddEdge (dsNode , podTemplateSpecNode , osgraph .ContainsEdgeKind )
26-
27- return dsNode
28- }
29-
30- func FindOrCreateSyntheticDaemonSetNode (g osgraph.MutableUniqueGraph , ds * kapisext.DaemonSet ) * DaemonSetNode {
31- return osgraph .EnsureUnique (
32- g ,
33- DaemonSetNodeName (ds ),
34- func (node osgraph.Node ) graph.Node {
35- return & DaemonSetNode {Node : node , DaemonSet : ds , IsFound : false }
36- },
37- ).(* DaemonSetNode )
38- }
39-
40- // EnsureDeploymentNode adds the provided upstream deployment to the graph if it does not exist
41- func EnsureDeploymentNode (g osgraph.MutableUniqueGraph , deployment * kapisext.Deployment ) * DeploymentNode {
42- deploymentName := DeploymentNodeName (deployment )
43- deploymentNode := osgraph .EnsureUnique (
44- g ,
45- deploymentName ,
46- func (node osgraph.Node ) graph.Node {
47- return & DeploymentNode {Node : node , Deployment : deployment , IsFound : true }
48- },
49- ).(* DeploymentNode )
50-
51- podTemplateSpecNode := kubegraph .EnsurePodTemplateSpecNode (g , & deployment .Spec .Template , deployment .Namespace , deploymentName )
52- g .AddEdge (deploymentNode , podTemplateSpecNode , osgraph .ContainsEdgeKind )
53-
54- return deploymentNode
55- }
56-
57- func FindOrCreateSyntheticDeploymentNode (g osgraph.MutableUniqueGraph , deployment * kapisext.Deployment ) * DeploymentNode {
58- return osgraph .EnsureUnique (
59- g ,
60- DeploymentNodeName (deployment ),
61- func (node osgraph.Node ) graph.Node {
62- return & DeploymentNode {Node : node , Deployment : deployment , IsFound : false }
63- },
64- ).(* DeploymentNode )
65- }
66-
6711// EnsureDeploymentConfigNode adds the provided deployment config to the graph if it does not exist
6812func EnsureDeploymentConfigNode (g osgraph.MutableUniqueGraph , dc * appsapi.DeploymentConfig ) * DeploymentConfigNode {
6913 dcName := DeploymentConfigNodeName (dc )
@@ -92,30 +36,3 @@ func FindOrCreateSyntheticDeploymentConfigNode(g osgraph.MutableUniqueGraph, dc
9236 },
9337 ).(* DeploymentConfigNode )
9438}
95-
96- // EnsureReplicaSetNode adds the provided replica set to the graph if it does not exist
97- func EnsureReplicaSetNode (g osgraph.MutableUniqueGraph , rs * kapisext.ReplicaSet ) * ReplicaSetNode {
98- rsName := ReplicaSetNodeName (rs )
99- rsNode := osgraph .EnsureUnique (
100- g ,
101- rsName ,
102- func (node osgraph.Node ) graph.Node {
103- return & ReplicaSetNode {Node : node , ReplicaSet : rs , IsFound : true }
104- },
105- ).(* ReplicaSetNode )
106-
107- podTemplateSpecNode := kubegraph .EnsurePodTemplateSpecNode (g , & rs .Spec .Template , rs .Namespace , rsName )
108- g .AddEdge (rsNode , podTemplateSpecNode , osgraph .ContainsEdgeKind )
109-
110- return rsNode
111- }
112-
113- func FindOrCreateSyntheticReplicaSetNode (g osgraph.MutableUniqueGraph , rs * kapisext.ReplicaSet ) * ReplicaSetNode {
114- return osgraph .EnsureUnique (
115- g ,
116- ReplicaSetNodeName (rs ),
117- func (node osgraph.Node ) graph.Node {
118- return & ReplicaSetNode {Node : node , ReplicaSet : rs , IsFound : false }
119- },
120- ).(* ReplicaSetNode )
121- }
0 commit comments