本文整理汇总了Golang中github.com/openshift/origin/pkg/image/api.ImageStream.Annotations方法的典型用法代码示例。如果您正苦于以下问题:Golang ImageStream.Annotations方法的具体用法?Golang ImageStream.Annotations怎么用?Golang ImageStream.Annotations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/origin/pkg/image/api.ImageStream
的用法示例。
在下文中一共展示了ImageStream.Annotations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: done
// done marks the stream as being processed due to an error or failure condition.
func (c *ImportController) done(stream *api.ImageStream, reason string) error {
if len(reason) == 0 {
reason = unversioned.Now().UTC().Format(time.RFC3339)
} else if len(reason) > 300 {
// cut down the reason up to 300 characters max.
reason = reason[:300]
}
if stream.Annotations == nil {
stream.Annotations = make(map[string]string)
}
stream.Annotations[api.DockerImageRepositoryCheckAnnotation] = reason
if _, err := c.streams.ImageStreams(stream.Namespace).Update(stream); err != nil {
return err
}
return nil
}
示例2: done
// done marks the stream as being processed due to an error or failure condition
func (c *ImportController) done(stream *api.ImageStream, reason string, retry int) error {
if len(reason) == 0 {
reason = util.Now().UTC().Format(time.RFC3339)
}
if stream.Annotations == nil {
stream.Annotations = make(map[string]string)
}
stream.Annotations[api.DockerImageRepositoryCheckAnnotation] = reason
if _, err := c.streams.ImageStreams(stream.Namespace).Update(stream); err != nil && !errors.IsNotFound(err) {
if errors.IsConflict(err) && retry > 0 {
if stream, err := c.streams.ImageStreams(stream.Namespace).Get(stream.Name); err == nil {
return c.done(stream, reason, retry-1)
}
}
return err
}
return nil
}