本文整理汇总了Golang中github.com/openshift/origin/pkg/api/graph.EnsureUnique函数的典型用法代码示例。如果您正苦于以下问题:Golang EnsureUnique函数的具体用法?Golang EnsureUnique怎么用?Golang EnsureUnique使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EnsureUnique函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: EnsureDockerRepositoryNode
// EnsureDockerRepositoryNode 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 EnsureDockerRepositoryNode(g osgraph.MutableUniqueGraph, name, tag string) graph.Node {
ref, err := imageapi.ParseDockerImageReference(name)
if err == nil {
if len(tag) != 0 {
ref.Tag = tag
}
if len(ref.Tag) == 0 {
ref.Tag = imageapi.DefaultImageTag
}
if len(ref.Registry) == 0 {
ref.Registry = "docker.io"
}
if len(ref.Namespace) == 0 {
ref.Namespace = imageapi.DockerDefaultNamespace
}
} else {
ref = imageapi.DockerImageReference{Name: name}
}
return osgraph.EnsureUnique(g,
DockerImageRepositoryNodeName(ref),
func(node osgraph.Node) graph.Node {
return &DockerImageRepositoryNode{node, ref}
},
)
}
示例2: FindOrCreateSyntheticReplicationControllerNode
func FindOrCreateSyntheticReplicationControllerNode(g osgraph.MutableUniqueGraph, rc *kapi.ReplicationController) *ReplicationControllerNode {
return osgraph.EnsureUnique(g,
ReplicationControllerNodeName(rc),
func(node osgraph.Node) graph.Node {
return &ReplicationControllerNode{node, rc, false}
},
).(*ReplicationControllerNode)
}
示例3: EnsureImageStreamNode
// EnsureImageStreamNode adds a graph node for the Image Stream if it does not already exist.
func EnsureImageStreamNode(g osgraph.MutableUniqueGraph, stream *imageapi.ImageStream) graph.Node {
return osgraph.EnsureUnique(g,
ImageStreamNodeName(stream),
func(node osgraph.Node) graph.Node {
return &ImageStreamNode{node, stream}
},
)
}
示例4: FindOrCreateSyntheticPVCNode
func FindOrCreateSyntheticPVCNode(g osgraph.MutableUniqueGraph, pvc *kapi.PersistentVolumeClaim) *PersistentVolumeClaimNode {
return osgraph.EnsureUnique(g,
PersistentVolumeClaimNodeName(pvc),
func(node osgraph.Node) graph.Node {
return &PersistentVolumeClaimNode{Node: node, PersistentVolumeClaim: pvc, IsFound: false}
},
).(*PersistentVolumeClaimNode)
}
示例5: EnsurePersistentVolumeClaimNode
func EnsurePersistentVolumeClaimNode(g osgraph.MutableUniqueGraph, pvc *kapi.PersistentVolumeClaim) *PersistentVolumeClaimNode {
return osgraph.EnsureUnique(g,
PersistentVolumeClaimNodeName(pvc),
func(node osgraph.Node) graph.Node {
return &PersistentVolumeClaimNode{Node: node, PersistentVolumeClaim: pvc, IsFound: true}
},
).(*PersistentVolumeClaimNode)
}
示例6: EnsureHorizontalPodAutoscalerNode
func EnsureHorizontalPodAutoscalerNode(g osgraph.MutableUniqueGraph, hpa *autoscaling.HorizontalPodAutoscaler) *HorizontalPodAutoscalerNode {
return osgraph.EnsureUnique(g,
HorizontalPodAutoscalerNodeName(hpa),
func(node osgraph.Node) graph.Node {
return &HorizontalPodAutoscalerNode{Node: node, HorizontalPodAutoscaler: hpa}
},
).(*HorizontalPodAutoscalerNode)
}
示例7: EnsureSecretNode
func EnsureSecretNode(g osgraph.MutableUniqueGraph, o *kapi.Secret) *SecretNode {
return osgraph.EnsureUnique(g,
SecretNodeName(o),
func(node osgraph.Node) graph.Node {
return &SecretNode{node, o, true}
},
).(*SecretNode)
}
示例8: EnsureImageStreamTagNode
// EnsureImageStreamTagNode adds a graph node for the specific tag in an Image Stream if it does not already exist.
func EnsureImageStreamTagNode(g osgraph.MutableUniqueGraph, ist *imageapi.ImageStreamTag) *ImageStreamTagNode {
return osgraph.EnsureUnique(g,
ImageStreamTagNodeName(ist),
func(node osgraph.Node) graph.Node {
return &ImageStreamTagNode{node, ist, true}
},
).(*ImageStreamTagNode)
}
示例9: EnsureBuildNode
// EnsureBuildNode adds a graph node for the build if it does not already exist.
func EnsureBuildNode(g osgraph.MutableUniqueGraph, build *buildapi.Build) *BuildNode {
return osgraph.EnsureUnique(g,
BuildNodeName(build),
func(node osgraph.Node) graph.Node {
return &BuildNode{node, build}
},
).(*BuildNode)
}
示例10: EnsureImageStreamNode
// EnsureImageStreamNode adds a graph node for the Image Stream if it does not already exist.
func EnsureImageStreamNode(g osgraph.MutableUniqueGraph, is *imageapi.ImageStream) graph.Node {
return osgraph.EnsureUnique(g,
ImageStreamNodeName(is),
func(node osgraph.Node) graph.Node {
return &ImageStreamNode{node, is, true}
},
)
}
示例11: EnsureImageNode
func EnsureImageNode(g osgraph.MutableUniqueGraph, img *imageapi.Image) graph.Node {
return osgraph.EnsureUnique(g,
ImageNodeName(img),
func(node osgraph.Node) graph.Node {
return &ImageNode{node, img}
},
)
}
示例12: EnsurePodSpecNode
func EnsurePodSpecNode(g osgraph.MutableUniqueGraph, podSpec *kapi.PodSpec, ownerName osgraph.UniqueName) *PodSpecNode {
return osgraph.EnsureUnique(g,
PodSpecNodeName(podSpec, ownerName),
func(node osgraph.Node) graph.Node {
return &PodSpecNode{node, podSpec, ownerName}
},
).(*PodSpecNode)
}
示例13: FindOrCreateSyntheticSecretNode
func FindOrCreateSyntheticSecretNode(g osgraph.MutableUniqueGraph, o *kapi.Secret) *SecretNode {
return osgraph.EnsureUnique(g,
SecretNodeName(o),
func(node osgraph.Node) graph.Node {
return &SecretNode{node, o, false}
},
).(*SecretNode)
}
示例14: EnsureServiceNode
// EnsureServiceNode adds the provided service to the graph if it does not already exist.
func EnsureServiceNode(g osgraph.MutableUniqueGraph, svc *kapi.Service) *ServiceNode {
return osgraph.EnsureUnique(g,
ServiceNodeName(svc),
func(node osgraph.Node) graph.Node {
return &ServiceNode{node, svc}
},
).(*ServiceNode)
}
示例15: FindOrCreateSyntheticImageStreamNode
// FindOrCreateSyntheticImageStreamNode returns the existing ISNode or creates a synthetic node in its place
func FindOrCreateSyntheticImageStreamNode(g osgraph.MutableUniqueGraph, is *imageapi.ImageStream) *ImageStreamNode {
return osgraph.EnsureUnique(g,
ImageStreamNodeName(is),
func(node osgraph.Node) graph.Node {
return &ImageStreamNode{node, is, false}
},
).(*ImageStreamNode)
}