本文整理汇总了Golang中github.com/openshift/origin/pkg/api/kubegraph.AddAllManagedByRCPodEdges函数的典型用法代码示例。如果您正苦于以下问题:Golang AddAllManagedByRCPodEdges函数的具体用法?Golang AddAllManagedByRCPodEdges怎么用?Golang AddAllManagedByRCPodEdges使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddAllManagedByRCPodEdges函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: MakeGraph
func (d *ProjectStatusDescriber) MakeGraph(namespace string) (osgraph.Graph, sets.String, error) {
g := osgraph.New()
loaders := []GraphLoader{
&serviceLoader{namespace: namespace, lister: d.K},
&serviceAccountLoader{namespace: namespace, lister: d.K},
&secretLoader{namespace: namespace, lister: d.K},
&rcLoader{namespace: namespace, lister: d.K},
&podLoader{namespace: namespace, lister: d.K},
// TODO check swagger for feature enablement and selectively add bcLoader and buildLoader
// then remove errors.TolerateNotFoundError method.
&bcLoader{namespace: namespace, lister: d.C},
&buildLoader{namespace: namespace, lister: d.C},
&isLoader{namespace: namespace, lister: d.C},
&dcLoader{namespace: namespace, lister: d.C},
&routeLoader{namespace: namespace, lister: d.C},
}
loadingFuncs := []func() error{}
for _, loader := range loaders {
loadingFuncs = append(loadingFuncs, loader.Load)
}
forbiddenResources := sets.String{}
if errs := parallel.Run(loadingFuncs...); len(errs) > 0 {
actualErrors := []error{}
for _, err := range errs {
if kapierrors.IsForbidden(err) {
forbiddenErr := err.(*kapierrors.StatusError)
if (forbiddenErr.Status().Details != nil) && (len(forbiddenErr.Status().Details.Kind) > 0) {
forbiddenResources.Insert(forbiddenErr.Status().Details.Kind)
}
continue
}
actualErrors = append(actualErrors, err)
}
if len(actualErrors) > 0 {
return g, forbiddenResources, utilerrors.NewAggregate(actualErrors)
}
}
for _, loader := range loaders {
loader.AddToGraph(g)
}
kubeedges.AddAllExposedPodTemplateSpecEdges(g)
kubeedges.AddAllExposedPodEdges(g)
kubeedges.AddAllManagedByRCPodEdges(g)
kubeedges.AddAllRequestedServiceAccountEdges(g)
kubeedges.AddAllMountableSecretEdges(g)
kubeedges.AddAllMountedSecretEdges(g)
buildedges.AddAllInputOutputEdges(g)
buildedges.AddAllBuildEdges(g)
deployedges.AddAllTriggerEdges(g)
deployedges.AddAllDeploymentEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
routeedges.AddAllRouteEdges(g)
return g, forbiddenResources, nil
}
示例2: TestBareRCGroup
func TestBareRCGroup(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/bare-rc.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
kubeedges.AddAllExposedPodTemplateSpecEdges(g)
kubeedges.AddAllExposedPodEdges(g)
kubeedges.AddAllManagedByRCPodEdges(g)
coveredNodes := IntSet{}
serviceGroups, coveredByServiceGroups := AllServiceGroups(g, coveredNodes)
coveredNodes.Insert(coveredByServiceGroups.List()...)
bareRCs, coveredByRCs := AllReplicationControllers(g, coveredNodes)
coveredNodes.Insert(coveredByRCs.List()...)
if e, a := 1, len(serviceGroups); e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := 1, len(bareRCs); e != a {
t.Errorf("expected %v, got %v", e, a)
}
}
示例3: TestDuelingRC
func TestDuelingRC(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/dueling-rcs.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
kubeedges.AddAllManagedByRCPodEdges(g)
markers := FindDuelingReplicationControllers(g)
if e, a := 2, len(markers); e != a {
t.Errorf("expected %v, got %v", e, a)
}
expectedRC1 := g.Find(osgraph.UniqueName("ReplicationController|/rc-1"))
expectedRC2 := g.Find(osgraph.UniqueName("ReplicationController|/rc-2"))
found1 := false
found2 := false
for i := 0; i < 2; i++ {
actualPod := osgraph.GetTopLevelContainerNode(g, markers[i].RelatedNodes[0])
expectedPod := g.Find(osgraph.UniqueName("Pod|/conflicted-pod"))
if e, a := expectedPod.ID(), actualPod.ID(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
actualOtherRC := osgraph.GetTopLevelContainerNode(g, markers[i].RelatedNodes[1])
actualRC := markers[i].Node
if e, a := expectedRC1.ID(), actualRC.ID(); e == a {
found1 = true
expectedOtherRC := expectedRC2
if e, a := expectedOtherRC.ID(), actualOtherRC.ID(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
}
if e, a := expectedRC2.ID(), actualRC.ID(); e == a {
found2 = true
expectedOtherRC := expectedRC1
if e, a := expectedOtherRC.ID(), actualOtherRC.ID(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
}
}
if !found1 {
t.Errorf("expected %v, got %v", expectedRC1, markers)
}
if !found2 {
t.Errorf("expected %v, got %v", expectedRC2, markers)
}
}
示例4: MakeGraph
func (d *ProjectStatusDescriber) MakeGraph(namespace string) (osgraph.Graph, error) {
g := osgraph.New()
loaders := []GraphLoader{
&serviceLoader{namespace: namespace, lister: d.K},
&serviceAccountLoader{namespace: namespace, lister: d.K},
&secretLoader{namespace: namespace, lister: d.K},
&rcLoader{namespace: namespace, lister: d.K},
&podLoader{namespace: namespace, lister: d.K},
&bcLoader{namespace: namespace, lister: d.C},
&buildLoader{namespace: namespace, lister: d.C},
&isLoader{namespace: namespace, lister: d.C},
&dcLoader{namespace: namespace, lister: d.C},
}
loadingFuncs := []func() error{}
for _, loader := range loaders {
loadingFuncs = append(loadingFuncs, loader.Load)
}
if errs := parallel.Run(loadingFuncs...); len(errs) > 0 {
return g, utilerrors.NewAggregate(errs)
}
for _, loader := range loaders {
loader.AddToGraph(g)
}
kubeedges.AddAllExposedPodTemplateSpecEdges(g)
kubeedges.AddAllExposedPodEdges(g)
kubeedges.AddAllManagedByRCPodEdges(g)
kubeedges.AddAllRequestedServiceAccountEdges(g)
kubeedges.AddAllMountableSecretEdges(g)
kubeedges.AddAllMountedSecretEdges(g)
buildedges.AddAllInputOutputEdges(g)
buildedges.AddAllBuildEdges(g)
deployedges.AddAllTriggerEdges(g)
deployedges.AddAllDeploymentEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
return g, nil
}