本文整理匯總了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
}