当前位置: 首页>>代码示例>>Golang>>正文


Golang Graph.NodeList方法代码示例

本文整理汇总了Golang中github.com/openshift/origin/pkg/api/graph.Graph.NodeList方法的典型用法代码示例。如果您正苦于以下问题:Golang Graph.NodeList方法的具体用法?Golang Graph.NodeList怎么用?Golang Graph.NodeList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/openshift/origin/pkg/api/graph.Graph的用法示例。


在下文中一共展示了Graph.NodeList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: AddAllRequestedServiceAccountEdges

func AddAllRequestedServiceAccountEdges(g osgraph.Graph) {
	for _, node := range g.NodeList() {
		if podSpecNode, ok := node.(*kubegraph.PodSpecNode); ok {
			AddRequestedServiceAccountEdges(g, podSpecNode)
		}
	}
}
开发者ID:naheedmk,项目名称:origin,代码行数:7,代码来源:edges.go

示例2: AddAllMountedSecretEdges

func AddAllMountedSecretEdges(g osgraph.Graph) {
	for _, node := range g.NodeList() {
		if podSpecNode, ok := node.(*kubegraph.PodSpecNode); ok {
			AddMountedSecretEdges(g, podSpecNode)
		}
	}
}
开发者ID:naheedmk,项目名称:origin,代码行数:7,代码来源:edges.go

示例3: AddAllMountableSecretEdges

func AddAllMountableSecretEdges(g osgraph.Graph) {
	for _, node := range g.NodeList() {
		if saNode, ok := node.(*kubegraph.ServiceAccountNode); ok {
			AddMountableSecretEdges(g, saNode)
		}
	}
}
开发者ID:naheedmk,项目名称:origin,代码行数:7,代码来源:edges.go

示例4: calculatePrunableLayers

// calculatePrunableLayers returns the list of prunable layers.
func calculatePrunableLayers(g graph.Graph) []*imagegraph.ImageLayerNode {
	prunable := []*imagegraph.ImageLayerNode{}

	nodes := g.NodeList()
	for i := range nodes {
		layerNode, ok := nodes[i].(*imagegraph.ImageLayerNode)
		if !ok {
			continue
		}

		glog.V(4).Infof("Examining layer %q", layerNode.Layer)

		if layerIsPrunable(g, layerNode) {
			glog.V(4).Infof("Layer %q is prunable", layerNode.Layer)
			prunable = append(prunable, layerNode)
		}
	}

	return prunable
}
开发者ID:brandon-adams,项目名称:origin,代码行数:21,代码来源:imagepruner.go

示例5: DeploymentPipelines

// DeploymentPipelines returns a map of DeploymentConfigs to the deployment flows that create them,
// extracted from the provided Graph.
func DeploymentPipelines(g osgraph.Graph) (DeploymentPipelineMap, osgraph.NodeSet) {
	covered := make(osgraph.NodeSet)
	g = g.EdgeSubgraph(osgraph.ReverseGraphEdge)
	flows := make(DeploymentPipelineMap)
	for _, node := range g.NodeList() {
		switch t := node.(type) {
		case *deploygraph.DeploymentConfigNode:
			covered.Add(t.ID())
			images := []ImagePipeline{}
			for _, n := range g.Neighbors(node) {
				// find incoming image edges only
				switch g.EdgeKind(g.EdgeBetween(node, n)) {
				case deployedges.TriggersDeploymentEdgeKind, deployedges.UsedInDeploymentEdgeKind:
					if flow, ok := ImagePipelineFromNode(g, n, covered); ok {
						images = append(images, flow)
					}
				}
			}

			output := []ImagePipeline{}

			// ensure the list of images is ordered the same as what is in the template
			if template := t.DeploymentConfig.Template.ControllerTemplate.Template; template != nil {
				deployedges.EachTemplateImage(
					&template.Spec,
					deployedges.DeploymentConfigHasTrigger(t.DeploymentConfig),
					func(image deployedges.TemplateImage, err error) {
						if err != nil {
							return
						}
						for i := range images {
							switch t := images[i].Image.(type) {
							case *imagegraph.ImageStreamTagNode:
								if image.Ref != nil {
									continue
								}
								from := image.From
								if t.ImageStream.Name != from.Name || t.ImageStream.Namespace != from.Namespace {
									continue
								}
								output = append(output, images[i])
								return
							case *imagegraph.DockerImageRepositoryNode:
								if image.From != nil {
									continue
								}
								ref1, ref2 := t.Ref.Minimal(), image.Ref.DockerClientDefaults().Minimal()
								if ref1 != ref2 {
									continue
								}
								output = append(output, images[i])
								return
							}
						}
					},
				)
			}
			flows[t] = output
		}
	}
	return flows, covered
}
开发者ID:cjnygard,项目名称:origin,代码行数:64,代码来源:deployment.go


注:本文中的github.com/openshift/origin/pkg/api/graph.Graph.NodeList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。