本文整理汇总了Golang中github.com/openshift/origin/pkg/image/api.JoinImageStreamTag函数的典型用法代码示例。如果您正苦于以下问题:Golang JoinImageStreamTag函数的具体用法?Golang JoinImageStreamTag怎么用?Golang JoinImageStreamTag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JoinImageStreamTag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestProcess_changeForUnregisteredTag
// TestProcess_changeForUnregisteredTag ensures that an image update for which
// there is a matching trigger results in a no-op due to the tag specified on
// the trigger not matching the tags defined on the image stream.
func TestProcess_changeForUnregisteredTag(t *testing.T) {
config := deploytest.OkDeploymentConfig(0)
stream := deploytest.OkStreamForConfig(config)
// The image has been resolved at least once before.
config.Spec.Triggers[0].ImageChangeParams.From.Name = imageapi.JoinImageStreamTag(stream.Name, "unrelatedtag")
fake := &testclient.Fake{}
fake.AddReactor("get", "imagestreams", func(action ktestclient.Action) (handled bool, ret runtime.Object, err error) {
return true, stream, nil
})
image := config.Spec.Template.Spec.Containers[0].Image
// verify no-op; should be the same for force=true and force=false
if err := processTriggers(config, fake, false); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if image != config.Spec.Template.Spec.Containers[0].Image {
t.Fatalf("unexpected image update: %#v", config.Spec.Template.Spec.Containers[0].Image)
}
if err := processTriggers(config, fake, true); err != nil {
t.Fatalf("unexpected error when forced: %v", err)
}
if image != config.Spec.Template.Spec.Containers[0].Image {
t.Fatalf("unexpected image update when forced: %#v", config.Spec.Template.Spec.Containers[0].Image)
}
}
示例2: MakeImageStreamTagObjectMeta
// MakeImageStreamTagObjectMeta returns an ImageStreamTag that has enough information to join the graph, but it is not
// based on a full IST object. This can be used to properly initialize the graph without having to retrieve all ISTs
func MakeImageStreamTagObjectMeta(namespace, name, tag string) *imageapi.ImageStreamTag {
return &imageapi.ImageStreamTag{
ObjectMeta: kapi.ObjectMeta{
Namespace: namespace,
Name: imageapi.JoinImageStreamTag(name, tag),
},
}
}
示例3: imageFor
// imageFor retrieves the most recent image for a tag in a given imageStreem.
func (r *REST) imageFor(ctx kapi.Context, tag string, imageStream *api.ImageStream) (*api.Image, error) {
event := api.LatestTaggedImage(imageStream, tag)
if event == nil || len(event.Image) == 0 {
return nil, kapierrors.NewNotFound("imageStreamTag", api.JoinImageStreamTag(imageStream.Name, tag))
}
return r.imageRegistry.GetImage(ctx, event.Image)
}
示例4: convert_api_BuildOutput_To_v1_BuildOutput
func convert_api_BuildOutput_To_v1_BuildOutput(in *newer.BuildOutput, out *BuildOutput, s conversion.Scope) error {
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
return err
}
if in.To != nil && (len(in.To.Kind) == 0 || in.To.Kind == "ImageStream") {
out.To.Kind = "ImageStreamTag"
out.To.Name = imageapi.JoinImageStreamTag(in.To.Name, in.Tag)
return nil
}
if len(in.DockerImageReference) != 0 {
out.To = &kapi_v1.ObjectReference{
Kind: "DockerImage",
Name: imageapi.JoinImageStreamTag(in.DockerImageReference, in.Tag),
}
}
return nil
}
示例5: Get
func (c *FakeImageStreamTags) Get(name, tag string) (*imageapi.ImageStreamTag, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("imagestreamtags", c.Namespace, imageapi.JoinImageStreamTag(name, tag)), &imageapi.ImageStreamTag{})
if obj == nil {
return nil, err
}
return obj.(*imageapi.ImageStreamTag), err
}
示例6: Convert_v1_BuildOutput_To_api_BuildOutput
func Convert_v1_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.BuildOutput, s conversion.Scope) error {
if err := autoConvert_v1_BuildOutput_To_api_BuildOutput(in, out, s); err != nil {
return err
}
if in.To != nil && (in.To.Kind == "ImageStream" || len(in.To.Kind) == 0) {
out.To.Kind = "ImageStreamTag"
out.To.Name = imageapi.JoinImageStreamTag(in.To.Name, "")
}
return nil
}
示例7: convert_api_CustomBuildStrategy_To_v1_CustomBuildStrategy
func convert_api_CustomBuildStrategy_To_v1_CustomBuildStrategy(in *newer.CustomBuildStrategy, out *CustomBuildStrategy, s conversion.Scope) error {
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
return err
}
if in.From != nil && in.From.Kind == "ImageStream" {
out.From.Kind = "ImageStreamTag"
out.From.Name = imageapi.JoinImageStreamTag(in.From.Name, "")
}
return nil
}
示例8: convert_v1beta3_BuildOutput_To_api_BuildOutput
func convert_v1beta3_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.BuildOutput, s conversion.Scope) error {
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
return err
}
if in.To != nil && (in.To.Kind == "ImageStream" || len(in.To.Kind) == 0) {
out.To.Kind = "ImageStreamTag"
out.To.Name = imageapi.JoinImageStreamTag(in.To.Name, "")
}
return nil
}
示例9: OkImageChangeDetails
func OkImageChangeDetails() *deployapi.DeploymentDetails {
return &deployapi.DeploymentDetails{
Causes: []deployapi.DeploymentCause{{
Type: deployapi.DeploymentTriggerOnImageChange,
ImageTrigger: &deployapi.DeploymentCauseImageTrigger{
From: kapi.ObjectReference{
Name: imageapi.JoinImageStreamTag(ImageStreamName, imageapi.DefaultImageTag),
Kind: "ImageStreamTag",
}}}}}
}
示例10: convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy
func convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBuildStrategy, out *newer.CustomBuildStrategy, s conversion.Scope) error {
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
return err
}
switch in.From.Kind {
case "ImageStream":
out.From.Kind = "ImageStreamTag"
out.From.Name = imageapi.JoinImageStreamTag(in.From.Name, "")
}
return nil
}
示例11: Convert_v1_CustomBuildStrategy_To_api_CustomBuildStrategy
func Convert_v1_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBuildStrategy, out *newer.CustomBuildStrategy, s conversion.Scope) error {
if err := autoConvert_v1_CustomBuildStrategy_To_api_CustomBuildStrategy(in, out, s); err != nil {
return err
}
switch in.From.Kind {
case "ImageStream":
out.From.Kind = "ImageStreamTag"
out.From.Name = imageapi.JoinImageStreamTag(in.From.Name, "")
}
return nil
}
示例12: ObjectReference
// ObjectReference returns an object reference from the image reference
func (r *ImageRef) ObjectReference() kapi.ObjectReference {
switch {
case r.Stream != nil:
return kapi.ObjectReference{
Kind: "ImageStreamTag",
Name: imageapi.JoinImageStreamTag(r.Stream.Name, r.Tag),
Namespace: r.Stream.Namespace,
}
case r.AsImageStream:
return kapi.ObjectReference{
Kind: "ImageStreamTag",
Name: imageapi.JoinImageStreamTag(r.Name, r.Tag),
}
default:
return kapi.ObjectReference{
Kind: "DockerImage",
Name: r.String(),
}
}
}
示例13: newISTag
func newISTag(tag string, imageStream *api.ImageStream, image *api.Image) (*api.ImageStreamTag, error) {
istagName := api.JoinImageStreamTag(imageStream.Name, tag)
event := api.LatestTaggedImage(imageStream, tag)
if event == nil || len(event.Image) == 0 {
return nil, kapierrors.NewNotFound("imageStreamTag", istagName)
}
ist := &api.ImageStreamTag{
ObjectMeta: kapi.ObjectMeta{
Namespace: imageStream.Namespace,
Name: istagName,
CreationTimestamp: event.Created,
Annotations: map[string]string{},
ResourceVersion: imageStream.ResourceVersion,
},
}
// if the imageStream has Spec.Tags[tag].Annotations[k] = v, copy it to the image's annotations
// and add them to the istag's annotations
if imageStream.Spec.Tags != nil {
if tagRef, ok := imageStream.Spec.Tags[tag]; ok {
if image != nil && image.Annotations == nil {
image.Annotations = make(map[string]string)
}
for k, v := range tagRef.Annotations {
ist.Annotations[k] = v
if image != nil {
image.Annotations[k] = v
}
}
}
}
if image != nil {
imageWithMetadata, err := api.ImageWithMetadata(*image)
if err != nil {
return nil, err
}
ist.Image = *imageWithMetadata
} else {
ist.Image = api.Image{}
ist.Image.Name = event.Image
}
// Replace the DockerImageReference with the value from event, which contains
// real value from status. This should fix the problem for v1 registries,
// where mutliple tags point to a single id and only the first image's metadata
// is saved. This in turn will always return the pull spec from the first
// imported image, which might be different than the requested tag.
ist.Image.DockerImageReference = event.DockerImageReference
return ist, nil
}
示例14: ObjectReference
// ObjectReference returns an object reference to this ref (as it would exist during generation)
func (r *ImageRef) ObjectReference() kapi.ObjectReference {
switch {
case r.Stream != nil:
return kapi.ObjectReference{
Kind: "ImageStreamTag",
Name: imageapi.JoinImageStreamTag(r.Stream.Name, r.Reference.Tag),
Namespace: r.Stream.Namespace,
}
case r.AsImageStream:
name, _ := r.SuggestName()
return kapi.ObjectReference{
Kind: "ImageStreamTag",
Name: imageapi.JoinImageStreamTag(name, r.InternalTag()),
}
default:
return kapi.ObjectReference{
Kind: "DockerImage",
Name: r.PullSpec(),
}
}
}
示例15: EnsureAllImageStreamTagNodes
// EnsureAllImageStreamTagNodes creates all the ImageStreamTagNodes that are guaranteed to be present based on the ImageStream.
// This is different than inferring the presence of an object, since the IST is an object derived from a join between the ImageStream
// and the Image it references.
func EnsureAllImageStreamTagNodes(g osgraph.MutableUniqueGraph, is *imageapi.ImageStream) []*ImageStreamTagNode {
ret := []*ImageStreamTagNode{}
for tag := range is.Status.Tags {
ist := &imageapi.ImageStreamTag{}
ist.Namespace = is.Namespace
ist.Name = imageapi.JoinImageStreamTag(is.Name, tag)
istNode := EnsureImageStreamTagNode(g, ist)
ret = append(ret, istNode)
}
return ret
}