当前位置: 首页>>代码示例>>Golang>>正文


Golang runtime.ImageSpec类代码示例

本文整理汇总了Golang中k8s/io/kubernetes/pkg/kubelet/api/v1alpha1/runtime.ImageSpec的典型用法代码示例。如果您正苦于以下问题:Golang ImageSpec类的具体用法?Golang ImageSpec怎么用?Golang ImageSpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ImageSpec类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: ImageStatus

func (r *FakeImageService) ImageStatus(image *runtimeApi.ImageSpec) (*runtimeApi.Image, error) {
	r.Lock()
	defer r.Unlock()

	r.Called = append(r.Called, "ImageStatus")

	return r.Images[image.GetImage()], nil
}
开发者ID:humblec,项目名称:kubernetes,代码行数:8,代码来源:fake_image_service.go

示例2: ImageStatus

// ImageStatus returns the status of the image, returns nil if the image doesn't present.
func (ds *dockerService) ImageStatus(image *runtimeapi.ImageSpec) (*runtimeapi.Image, error) {
	imageInspect, err := ds.client.InspectImageByRef(image.GetImage())
	if err != nil {
		if dockertools.IsImageNotFoundError(err) {
			return nil, nil
		}
		return nil, err
	}
	return imageInspectToRuntimeAPIImage(imageInspect)
}
开发者ID:alex-mohr,项目名称:kubernetes,代码行数:11,代码来源:docker_image.go

示例3: RemoveImage

func (r *FakeImageService) RemoveImage(image *runtimeApi.ImageSpec) error {
	r.Lock()
	defer r.Unlock()

	r.Called = append(r.Called, "RemoveImage")

	// Remove the image
	delete(r.Images, image.GetImage())

	return nil
}
开发者ID:ncdc,项目名称:kubernetes,代码行数:11,代码来源:fake_image_service.go

示例4: ImageStatus

func (r *FakeImageService) ImageStatus(image *runtimeApi.ImageSpec) (*runtimeApi.Image, error) {
	r.Lock()
	defer r.Unlock()

	r.Called = append(r.Called, "ImageStatus")

	if img, ok := r.Images[image.GetImage()]; ok {
		return img, nil
	}

	return nil, fmt.Errorf("image %q not found", image.GetImage())
}
开发者ID:ncdc,项目名称:kubernetes,代码行数:12,代码来源:fake_image_service.go

示例5: PullImage

// PullImage pulls an image with authentication config.
func (ds *dockerService) PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig) error {
	return ds.client.PullImage(image.GetImage(),
		dockertypes.AuthConfig{
			Username:      auth.GetUsername(),
			Password:      auth.GetPassword(),
			ServerAddress: auth.GetServerAddress(),
			IdentityToken: auth.GetIdentityToken(),
			RegistryToken: auth.GetRegistryToken(),
		},
		dockertypes.ImagePullOptions{},
	)
}
开发者ID:alex-mohr,项目名称:kubernetes,代码行数:13,代码来源:docker_image.go

示例6: PullImage

// PullImage pulls a image with authentication config.
func (ds *dockerService) PullImage(image *runtimeApi.ImageSpec, auth *runtimeApi.AuthConfig) error {
	// TODO: add default tags for images or should this be done by kubelet?
	return ds.client.PullImage(image.GetImage(),
		dockertypes.AuthConfig{
			Username:      auth.GetUsername(),
			Password:      auth.GetPassword(),
			ServerAddress: auth.GetServerAddress(),
			IdentityToken: auth.GetIdentityToken(),
			RegistryToken: auth.GetRegistryToken(),
		},
		dockertypes.ImagePullOptions{},
	)
}
开发者ID:rlugojr,项目名称:kubernetes,代码行数:14,代码来源:docker_image.go

示例7: RemoveImage

// RemoveImage removes the image.
func (r *RemoteImageService) RemoveImage(image *runtimeapi.ImageSpec) error {
	ctx, cancel := getContextWithTimeout(r.timeout)
	defer cancel()

	_, err := r.imageClient.RemoveImage(ctx, &runtimeapi.RemoveImageRequest{
		Image: image,
	})
	if err != nil {
		glog.Errorf("RemoveImage %q from image service failed: %v", image.GetImage(), err)
		return err
	}

	return nil
}
开发者ID:kubernetes,项目名称:kubernetes,代码行数:15,代码来源:remote_image.go

示例8: ImageStatus

// ImageStatus returns the status of the image.
func (r *RemoteImageService) ImageStatus(image *runtimeapi.ImageSpec) (*runtimeapi.Image, error) {
	ctx, cancel := getContextWithTimeout(r.timeout)
	defer cancel()

	resp, err := r.imageClient.ImageStatus(ctx, &runtimeapi.ImageStatusRequest{
		Image: image,
	})
	if err != nil {
		glog.Errorf("ImageStatus %q from image service failed: %v", image.GetImage(), err)
		return nil, err
	}

	return resp.Image, nil
}
开发者ID:kubernetes,项目名称:kubernetes,代码行数:15,代码来源:remote_image.go

示例9: PullImage

func (r *FakeImageService) PullImage(image *runtimeApi.ImageSpec, auth *runtimeApi.AuthConfig) error {
	r.Lock()
	defer r.Unlock()

	r.Called = append(r.Called, "PullImage")

	// ImageID should be randomized for real container runtime, but here just use
	// image's name for easily making fake images.
	imageID := image.GetImage()
	if _, ok := r.Images[imageID]; !ok {
		r.Images[imageID] = r.makeFakeImage(image.GetImage())
	}

	return nil
}
开发者ID:ncdc,项目名称:kubernetes,代码行数:15,代码来源:fake_image_service.go

示例10: PullImage

// PullImage pulls an image with authentication config.
func (r *RemoteImageService) PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig) (string, error) {
	ctx, cancel := getContextWithTimeout(r.timeout)
	defer cancel()

	resp, err := r.imageClient.PullImage(ctx, &runtimeapi.PullImageRequest{
		Image: image,
		Auth:  auth,
	})
	if err != nil {
		glog.Errorf("PullImage %q from image service failed: %v", image.GetImage(), err)
		return "", err
	}

	return resp.GetImageRef(), nil
}
开发者ID:kubernetes,项目名称:kubernetes,代码行数:16,代码来源:remote_image.go

示例11: RemoveImage

// RemoveImage removes the image.
func (ds *dockerService) RemoveImage(image *runtimeapi.ImageSpec) error {
	// If the image has multiple tags, we need to remove all the tags
	// TODO: We assume image.Image is image ID here, which is true in the current implementation
	// of kubelet, but we should still clarify this in CRI.
	imageInspect, err := ds.client.InspectImageByID(image.GetImage())
	if err == nil && imageInspect != nil && len(imageInspect.RepoTags) > 1 {
		for _, tag := range imageInspect.RepoTags {
			if _, err := ds.client.RemoveImage(tag, dockertypes.ImageRemoveOptions{PruneChildren: true}); err != nil {
				return err
			}
		}
		return nil
	}

	_, err = ds.client.RemoveImage(image.GetImage(), dockertypes.ImageRemoveOptions{PruneChildren: true})
	return err
}
开发者ID:alex-mohr,项目名称:kubernetes,代码行数:18,代码来源:docker_image.go

示例12: PullImage

// PullImage pulls an image with authentication config.
func (ds *dockerService) PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig) (string, error) {
	err := ds.client.PullImage(image.GetImage(),
		dockertypes.AuthConfig{
			Username:      auth.GetUsername(),
			Password:      auth.GetPassword(),
			ServerAddress: auth.GetServerAddress(),
			IdentityToken: auth.GetIdentityToken(),
			RegistryToken: auth.GetRegistryToken(),
		},
		dockertypes.ImagePullOptions{},
	)
	if err != nil {
		return "", err
	}

	return dockertools.GetImageRef(ds.client, image.GetImage())
}
开发者ID:kubernetes,项目名称:kubernetes,代码行数:18,代码来源:docker_image.go

示例13: RemoveImage

// RemoveImage removes the image.
func (ds *dockerService) RemoveImage(image *runtimeApi.ImageSpec) error {
	_, err := ds.client.RemoveImage(image.GetImage(), dockertypes.ImageRemoveOptions{PruneChildren: true})
	return err
}
开发者ID:rlugojr,项目名称:kubernetes,代码行数:5,代码来源:docker_image.go


注:本文中的k8s/io/kubernetes/pkg/kubelet/api/v1alpha1/runtime.ImageSpec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。