本文整理汇总了Golang中github.com/coreos/rkt/pkg/pod.Pod.AppImageManifest方法的典型用法代码示例。如果您正苦于以下问题:Golang Pod.AppImageManifest方法的具体用法?Golang Pod.AppImageManifest怎么用?Golang Pod.AppImageManifest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/coreos/rkt/pkg/pod.Pod
的用法示例。
在下文中一共展示了Pod.AppImageManifest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getImageName
func getImageName(p *pkgPod.Pod, appName types.ACName) (string, error) {
aim, err := p.AppImageManifest(appName.String())
if err != nil {
return "", errwrap.Wrap(errors.New("problem retrieving ImageManifests from pod"), err)
}
imageName := aim.Name.String()
if version, ok := aim.Labels.Get("version"); ok {
imageName = fmt.Sprintf("%s:%s", imageName, version)
}
return imageName, nil
}
示例2: fillStaticAppInfo
// fillStaticAppInfo will modify the 'v1pod' in place with the information retrieved with 'pod'.
// Today, these information are static and will not change during the pod's lifecycle.
func fillStaticAppInfo(store *imagestore.Store, pod *pkgPod.Pod, v1pod *v1alpha.Pod) error {
var errlist []error
// Fill static app image info.
for _, app := range v1pod.Apps {
// Fill app's image info.
app.Image = &v1alpha.Image{
BaseFormat: &v1alpha.ImageFormat{
// Only support appc image now. If it's a docker image, then it
// will be transformed to appc before storing in the disk store.
Type: v1alpha.ImageType_IMAGE_TYPE_APPC,
Version: schema.AppContainerVersion.String(),
},
Id: app.Image.Id,
// Other information are not available because they require the image
// info from store. Some of it is filled in below if possible.
}
im, err := pod.AppImageManifest(app.Name)
if err != nil {
stderr.PrintE(fmt.Sprintf("failed to get image manifests for app %q", app.Name), err)
errlist = append(errlist, err)
} else {
app.Image.Name = im.Name.String()
version, ok := im.Labels.Get("version")
if !ok {
version = "latest"
}
app.Image.Version = version
}
}
if len(errlist) != 0 {
return errs{errlist}
}
return nil
}